2025-07-12 17:56:28 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
<!DOCTYPE mapper
|
2025-07-15 18:40:22 +08:00
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
2025-07-18 15:27:22 +08:00
|
|
|
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScTransGroupMapper">
|
2025-07-15 18:40:22 +08:00
|
|
|
|
2025-07-12 17:56:28 +08:00
|
|
|
<resultMap type="ScTransGroup" id="ScTransGroupResult">
|
2025-07-15 18:40:22 +08:00
|
|
|
<result property="id" column="id"/>
|
|
|
|
<result property="sheepId" column="sheep_id"/>
|
2025-07-22 14:55:18 +08:00
|
|
|
<result property="manageTags" column="manageTags"/>
|
2025-07-15 18:40:22 +08:00
|
|
|
<result property="foldTo" column="fold_to"/>
|
|
|
|
<result property="foldFrom" column="fold_from"/>
|
|
|
|
<result property="reason" column="reason"/>
|
2025-07-17 09:58:44 +08:00
|
|
|
<result property="varietyId" column="variety_id"/>
|
|
|
|
<result property="varietyName" column="varietyName"/>
|
2025-07-15 18:40:22 +08:00
|
|
|
<result property="technician" column="technician"/>
|
|
|
|
<result property="status" column="status"/>
|
|
|
|
<result property="comment" column="comment"/>
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
<result property="createTime" column="create_time"/>
|
2025-07-12 17:56:28 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectScTransGroupVo">
|
2025-07-15 18:40:22 +08:00
|
|
|
SELECT tg.id,
|
|
|
|
tg.sheep_id,
|
2025-07-22 14:55:18 +08:00
|
|
|
s.manage_tags AS manageTags,
|
2025-07-15 18:40:22 +08:00
|
|
|
tg.fold_to,
|
|
|
|
tg.fold_from,
|
|
|
|
tg.reason,
|
2025-07-17 09:58:44 +08:00
|
|
|
tg.variety_id,
|
|
|
|
bv.variety AS varietyName,
|
2025-07-15 18:40:22 +08:00
|
|
|
tg.technician,
|
|
|
|
tg.status,
|
|
|
|
tg.comment,
|
|
|
|
tg.create_by,
|
|
|
|
tg.create_time,
|
|
|
|
sf_from.sheepfold_name AS foldFromName,
|
|
|
|
sf_to.sheepfold_name AS foldToName
|
|
|
|
FROM sc_trans_group tg
|
2025-07-22 14:55:18 +08:00
|
|
|
LEFT JOIN bas_sheep s ON tg.sheep_id = s.id
|
2025-07-15 18:40:22 +08:00
|
|
|
LEFT JOIN da_sheepfold sf_from ON tg.fold_from = sf_from.id
|
|
|
|
LEFT JOIN da_sheepfold sf_to ON tg.fold_to = sf_to.id
|
2025-07-17 09:58:44 +08:00
|
|
|
LEFT JOIN bas_sheep_variety bv ON tg.variety_id = bv.id
|
2025-07-12 17:56:28 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectScTransGroupList" parameterType="ScTransGroup" resultMap="ScTransGroupResult">
|
|
|
|
<include refid="selectScTransGroupVo"/>
|
2025-07-15 18:40:22 +08:00
|
|
|
<where>
|
2025-07-17 09:58:44 +08:00
|
|
|
<if test="sheepId != null">and sheep_id = #{sheepId}</if>
|
2025-07-22 14:55:18 +08:00
|
|
|
<if test="manageTags != null and manageTags != ''">
|
|
|
|
and s.manage_tags like concat('%', #{manageTags}, '%')
|
|
|
|
</if>
|
2025-07-17 09:58:44 +08:00
|
|
|
<if test="foldTo != null and foldTo != ''">and fold_to = #{foldTo}</if>
|
|
|
|
<if test="foldFrom != null and foldFrom != ''">and fold_from = #{foldFrom}</if>
|
|
|
|
<if test="status != null">and status = #{status}</if>
|
|
|
|
<if test="varietyId != null">and tg.variety_id = #{varietyId}</if>
|
2025-07-15 18:40:22 +08:00
|
|
|
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
|
|
|
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
|
|
|
</if>
|
2025-07-12 17:56:28 +08:00
|
|
|
</where>
|
|
|
|
</select>
|
2025-07-15 18:40:22 +08:00
|
|
|
|
|
|
|
|
2025-07-12 17:56:28 +08:00
|
|
|
<select id="selectScTransGroupById" parameterType="Integer" resultMap="ScTransGroupResult">
|
|
|
|
<include refid="selectScTransGroupVo"/>
|
2025-07-15 18:40:22 +08:00
|
|
|
where tg.id = #{id}
|
2025-07-12 17:56:28 +08:00
|
|
|
</select>
|
|
|
|
|
2025-07-17 09:58:44 +08:00
|
|
|
<insert id="insertScTransGroup" parameterType="ScTransGroup"
|
|
|
|
useGeneratedKeys="true" keyProperty="id">
|
2025-07-12 17:56:28 +08:00
|
|
|
insert into sc_trans_group
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="sheepId != null">sheep_id,</if>
|
|
|
|
<if test="foldTo != null and foldTo != ''">fold_to,</if>
|
|
|
|
<if test="foldFrom != null and foldFrom != ''">fold_from,</if>
|
2025-07-17 09:58:44 +08:00
|
|
|
<if test="varietyId != null">variety_id,</if>
|
|
|
|
<if test="reason != null">reason,</if>
|
2025-07-12 17:56:28 +08:00
|
|
|
<if test="technician != null and technician != ''">technician,</if>
|
|
|
|
<if test="status != null">status,</if>
|
|
|
|
<if test="comment != null">comment,</if>
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
<if test="createTime != null">create_time,</if>
|
2025-07-15 18:40:22 +08:00
|
|
|
</trim>
|
2025-07-12 17:56:28 +08:00
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="sheepId != null">#{sheepId},</if>
|
|
|
|
<if test="foldTo != null and foldTo != ''">#{foldTo},</if>
|
|
|
|
<if test="foldFrom != null and foldFrom != ''">#{foldFrom},</if>
|
2025-07-17 09:58:44 +08:00
|
|
|
<if test="varietyId != null">#{varietyId},</if>
|
|
|
|
<if test="reason != null">#{reason},</if>
|
2025-07-12 17:56:28 +08:00
|
|
|
<if test="technician != null and technician != ''">#{technician},</if>
|
|
|
|
<if test="status != null">#{status},</if>
|
|
|
|
<if test="comment != null">#{comment},</if>
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
2025-07-15 18:40:22 +08:00
|
|
|
</trim>
|
2025-07-12 17:56:28 +08:00
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateScTransGroup" parameterType="ScTransGroup">
|
|
|
|
update sc_trans_group
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
|
|
|
<if test="foldTo != null and foldTo != ''">fold_to = #{foldTo},</if>
|
|
|
|
<if test="foldFrom != null and foldFrom != ''">fold_from = #{foldFrom},</if>
|
2025-07-17 09:58:44 +08:00
|
|
|
<if test="varietyId != null">variety_id = #{varietyId},</if>
|
|
|
|
<if test="reason != null">reason = #{reason},</if>
|
2025-07-12 17:56:28 +08:00
|
|
|
<if test="technician != null and technician != ''">technician = #{technician},</if>
|
|
|
|
<if test="status != null">status = #{status},</if>
|
|
|
|
<if test="comment != null">comment = #{comment},</if>
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
</trim>
|
2025-07-17 09:58:44 +08:00
|
|
|
where id = #{id}
|
2025-07-12 17:56:28 +08:00
|
|
|
</update>
|
|
|
|
|
|
|
|
<delete id="deleteScTransGroupById" parameterType="Integer">
|
2025-07-15 18:40:22 +08:00
|
|
|
delete
|
|
|
|
from sc_trans_group
|
|
|
|
where tg.id = #{id}
|
2025-07-12 17:56:28 +08:00
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteScTransGroupByIds" parameterType="String">
|
2025-07-15 18:40:22 +08:00
|
|
|
delete from sc_trans_group where id in
|
2025-07-12 17:56:28 +08:00
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
</mapper>
|