2025-07-12 17:56:28 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
<!DOCTYPE mapper
|
2025-07-18 11:34:55 +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.ScTransitionInfoMapper">
|
2025-07-12 17:56:28 +08:00
|
|
|
<resultMap type="ScTransitionInfo" id="ScTransitionInfoResult">
|
2025-07-18 11:34:55 +08:00
|
|
|
<result property="id" column="id"/>
|
|
|
|
<result property="sheepId" column="sheep_id"/>
|
|
|
|
<result property="varietyId" column="variety_id"/>
|
|
|
|
<result property="varietyName" column="varietyName"/>
|
|
|
|
<result property="transTo" column="trans_to"/>
|
|
|
|
<result property="transFrom" column="trans_from"/>
|
|
|
|
<result property="transType" column="trans_type"/>
|
|
|
|
<result property="transTypeText" column="trans_type_text"/>
|
|
|
|
<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="selectScTransitionInfoVo">
|
2025-07-18 11:34:55 +08:00
|
|
|
SELECT t.*, bv.variety AS varietyName,
|
|
|
|
CASE t.trans_type
|
|
|
|
WHEN 0 THEN '内部转场'
|
|
|
|
WHEN 1 THEN '跨场转场'
|
|
|
|
WHEN 2 THEN '销售转场'
|
|
|
|
ELSE '未知'
|
|
|
|
END AS trans_type_text
|
|
|
|
FROM sc_transition_info t
|
|
|
|
LEFT JOIN bas_sheep_variety bv ON t.variety_id = bv.id
|
2025-07-12 17:56:28 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectScTransitionInfoList" parameterType="ScTransitionInfo" resultMap="ScTransitionInfoResult">
|
|
|
|
<include refid="selectScTransitionInfoVo"/>
|
2025-07-18 11:34:55 +08:00
|
|
|
<where>
|
|
|
|
<if test="sheepId != null ">and sheep_id = #{sheepId}</if>
|
|
|
|
<if test="varietyId != null">and t.variety_id = #{varietyId}</if>
|
|
|
|
<if test="transTo != null and transTo != ''">and trans_to = #{transTo}</if>
|
|
|
|
<if test="transFrom != null and transFrom != ''">and trans_from = #{transFrom}</if>
|
|
|
|
<if test="status != null ">and status = #{status}</if>
|
|
|
|
<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-18 11:34:55 +08:00
|
|
|
|
2025-07-12 17:56:28 +08:00
|
|
|
<select id="selectScTransitionInfoById" parameterType="Integer" resultMap="ScTransitionInfoResult">
|
|
|
|
<include refid="selectScTransitionInfoVo"/>
|
2025-07-18 11:34:55 +08:00
|
|
|
WHERE t.id = #{id}
|
2025-07-12 17:56:28 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertScTransitionInfo" parameterType="ScTransitionInfo" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
insert into sc_transition_info
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="sheepId != null">sheep_id,</if>
|
2025-07-18 11:34:55 +08:00
|
|
|
<if test="varietyId != null">variety_id,</if>
|
2025-07-12 17:56:28 +08:00
|
|
|
<if test="transTo != null and transTo != ''">trans_to,</if>
|
|
|
|
<if test="transFrom != null and transFrom != ''">trans_from,</if>
|
|
|
|
<if test="transType != null">trans_type,</if>
|
|
|
|
<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-18 11:34:55 +08:00
|
|
|
</trim>
|
2025-07-12 17:56:28 +08:00
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="sheepId != null">#{sheepId},</if>
|
2025-07-18 11:34:55 +08:00
|
|
|
<if test="varietyId != null">#{varietyId},</if>
|
2025-07-12 17:56:28 +08:00
|
|
|
<if test="transTo != null and transTo != ''">#{transTo},</if>
|
|
|
|
<if test="transFrom != null and transFrom != ''">#{transFrom},</if>
|
|
|
|
<if test="transType != null">#{transType},</if>
|
|
|
|
<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-18 11:34:55 +08:00
|
|
|
</trim>
|
2025-07-12 17:56:28 +08:00
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateScTransitionInfo" parameterType="ScTransitionInfo">
|
|
|
|
update sc_transition_info
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
2025-07-18 11:34:55 +08:00
|
|
|
<if test="varietyId != null">variety_id = #{varietyId},</if>
|
2025-07-12 17:56:28 +08:00
|
|
|
<if test="transTo != null and transTo != ''">trans_to = #{transTo},</if>
|
|
|
|
<if test="transFrom != null and transFrom != ''">trans_from = #{transFrom},</if>
|
|
|
|
<if test="transType != null">trans_type = #{transType},</if>
|
|
|
|
<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>
|
|
|
|
where id = #{id}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<delete id="deleteScTransitionInfoById" parameterType="Integer">
|
2025-07-18 11:34:55 +08:00
|
|
|
delete
|
|
|
|
from sc_transition_info
|
|
|
|
where id = #{id}
|
2025-07-12 17:56:28 +08:00
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteScTransitionInfoByIds" parameterType="String">
|
2025-07-18 11:34:55 +08:00
|
|
|
delete from sc_transition_info where id in
|
2025-07-12 17:56:28 +08:00
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
</mapper>
|