2025-07-12 17:56:28 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
<!DOCTYPE mapper
|
|
|
|
|
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.ScAddSheepMapper">
|
2025-07-17 09:58:44 +08:00
|
|
|
|
2025-07-18 15:27:22 +08:00
|
|
|
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScAddSheep" id="ScAddSheepResult">
|
2025-07-29 21:58:46 +08:00
|
|
|
<result property="id" column="id"/>
|
|
|
|
|
<result property="earNumber" column="ear_number"/>
|
|
|
|
|
<result property="sheepfold" column="sheepfold"/>
|
|
|
|
|
<result property="sheepfoldName" column="sheepfoldName"/>
|
|
|
|
|
<result property="father" column="father"/>
|
|
|
|
|
<result property="mother" column="mother"/>
|
|
|
|
|
<result property="bornWeight" column="born_weight"/>
|
|
|
|
|
<result property="birthday" column="birthday"/>
|
|
|
|
|
<result property="gender" column="gender"/>
|
|
|
|
|
<result property="parity" column="parity"/>
|
|
|
|
|
<result property="varietyId" column="variety_id"/>
|
|
|
|
|
<result property="varietyName" column="varietyName"/>
|
2025-08-19 17:07:16 +08:00
|
|
|
<result property="typeId" column="type_id"/>
|
|
|
|
|
<result property="typeName" column="type_name"/>
|
2025-07-29 21:58:46 +08:00
|
|
|
<result property="joinDate" column="join_date"/>
|
|
|
|
|
<result property="comment" column="comment"/>
|
|
|
|
|
<result property="technician" column="technician"/>
|
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
2026-02-09 20:22:51 +08:00
|
|
|
<result property="userId" column="user_id"/>
|
|
|
|
|
<result property="deptId" column="dept_id"/>
|
2025-07-12 17:56:28 +08:00
|
|
|
</resultMap>
|
2026-02-09 20:22:51 +08:00
|
|
|
<sql id="selectScAddSheepVo">
|
2025-07-15 18:40:22 +08:00
|
|
|
SELECT
|
2026-02-09 20:22:51 +08:00
|
|
|
sas.id,
|
|
|
|
|
sas.ear_number,
|
|
|
|
|
sas.sheepfold,
|
|
|
|
|
sas.ranch_id,
|
|
|
|
|
sas.father,
|
|
|
|
|
sas.mother,
|
|
|
|
|
sas.born_weight,
|
|
|
|
|
sas.birthday,
|
|
|
|
|
sas.gender,
|
|
|
|
|
sas.parity,
|
|
|
|
|
sas.variety_id,
|
|
|
|
|
sas.type_id,
|
|
|
|
|
sas.join_date,
|
|
|
|
|
sas.comment,
|
|
|
|
|
sas.technician,
|
|
|
|
|
sas.create_by,
|
|
|
|
|
sas.create_time,
|
|
|
|
|
sas.user_id,
|
|
|
|
|
sas.dept_id,
|
|
|
|
|
sf.sheepfold_name AS sheepfoldName,
|
|
|
|
|
bv.variety AS varietyName,
|
|
|
|
|
st.type_name AS typeName
|
2025-07-15 18:40:22 +08:00
|
|
|
FROM sc_add_sheep sas
|
2026-02-09 20:22:51 +08:00
|
|
|
LEFT JOIN da_sheepfold sf ON sas.sheepfold = sf.id
|
|
|
|
|
LEFT JOIN bas_sheep_variety bv ON sas.variety_id = bv.id
|
|
|
|
|
LEFT JOIN bas_sheep_type st ON sas.type_id = st.id
|
|
|
|
|
</sql>
|
|
|
|
|
<select id="selectScAddSheepList" parameterType="ScAddSheep" resultMap="ScAddSheepResult">
|
|
|
|
|
<include refid="selectScAddSheepVo"/>
|
2025-07-12 17:56:28 +08:00
|
|
|
<where>
|
2025-07-15 18:40:22 +08:00
|
|
|
<if test="earNumber != null and earNumber != ''">
|
|
|
|
|
AND sas.ear_number LIKE CONCAT('%', #{earNumber}, '%')
|
|
|
|
|
</if>
|
2025-07-17 09:58:44 +08:00
|
|
|
<if test="sheepfold != null">
|
|
|
|
|
AND sas.sheepfold = #{sheepfold}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="varietyId != null">
|
|
|
|
|
AND sas.variety_id = #{varietyId}
|
|
|
|
|
</if>
|
2025-08-19 17:07:16 +08:00
|
|
|
<if test="typeId != null">
|
|
|
|
|
AND sas.type_id = #{typeId}
|
|
|
|
|
</if>
|
2026-02-09 20:22:51 +08:00
|
|
|
${params.dataScope}
|
2025-07-12 17:56:28 +08:00
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
2025-07-17 09:58:44 +08:00
|
|
|
<select id="selectByEarNumber" parameterType="string" resultMap="ScAddSheepResult">
|
2025-07-29 21:58:46 +08:00
|
|
|
SELECT *
|
|
|
|
|
FROM sc_add_sheep
|
|
|
|
|
WHERE ear_number = #{earNumber}
|
2025-07-17 09:58:44 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insert" parameterType="ScAddSheep" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
INSERT INTO sc_add_sheep
|
2026-02-09 20:22:51 +08:00
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="earNumber != null">ear_number,</if>
|
|
|
|
|
<if test="sheepfold != null">sheepfold,</if>
|
|
|
|
|
<if test="ranchId != null">ranch_id,</if>
|
|
|
|
|
<if test="father != null">father,</if>
|
|
|
|
|
<if test="mother != null">mother,</if>
|
|
|
|
|
<if test="bornWeight != null">born_weight,</if>
|
|
|
|
|
<if test="birthday != null">birthday,</if>
|
|
|
|
|
<if test="gender != null">gender,</if>
|
|
|
|
|
<if test="parity != null">parity,</if>
|
|
|
|
|
<if test="varietyId != null">variety_id,</if>
|
|
|
|
|
<if test="typeId != null">type_id,</if>
|
|
|
|
|
<if test="joinDate != null">join_date,</if>
|
|
|
|
|
<if test="comment != null">comment,</if>
|
|
|
|
|
<if test="technician != null">technician,</if>
|
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
<if test="userId != null">user_id,</if>
|
|
|
|
|
<if test="deptId != null">dept_id,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="earNumber != null">#{earNumber},</if>
|
|
|
|
|
<if test="sheepfold != null">#{sheepfold},</if>
|
|
|
|
|
<if test="ranchId != null">#{ranchId},</if>
|
|
|
|
|
<if test="father != null">#{father},</if>
|
|
|
|
|
<if test="mother != null">#{mother},</if>
|
|
|
|
|
<if test="bornWeight != null">#{bornWeight},</if>
|
|
|
|
|
<if test="birthday != null">#{birthday},</if>
|
|
|
|
|
<if test="gender != null">#{gender},</if>
|
|
|
|
|
<if test="parity != null">#{parity},</if>
|
|
|
|
|
<if test="varietyId != null">#{varietyId},</if>
|
|
|
|
|
<if test="typeId != null">#{typeId},</if>
|
|
|
|
|
<if test="joinDate != null">#{joinDate},</if>
|
|
|
|
|
<if test="comment != null">#{comment},</if>
|
|
|
|
|
<if test="technician != null">#{technician},</if>
|
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
<if test="userId != null">#{userId},</if>
|
|
|
|
|
<if test="deptId != null">#{deptId},</if>
|
|
|
|
|
</trim>
|
2025-07-17 09:58:44 +08:00
|
|
|
</insert>
|
|
|
|
|
|
2025-07-12 17:56:28 +08:00
|
|
|
<update id="updateScAddSheep" parameterType="ScAddSheep">
|
|
|
|
|
UPDATE sc_add_sheep
|
|
|
|
|
<set>
|
2025-07-29 21:58:46 +08:00
|
|
|
ear_number = #{earNumber},
|
2025-08-20 13:15:17 +08:00
|
|
|
ranch_id = #{ranchId},
|
2025-07-29 21:58:46 +08:00
|
|
|
sheepfold = #{sheepfold},
|
|
|
|
|
father = #{father},
|
|
|
|
|
mother = #{mother},
|
|
|
|
|
born_weight = #{bornWeight},
|
|
|
|
|
birthday = #{birthday},
|
|
|
|
|
gender = #{gender},
|
|
|
|
|
parity = #{parity},
|
|
|
|
|
variety_id = #{varietyId},
|
2025-08-19 17:07:16 +08:00
|
|
|
type_id = #{typeId},
|
2025-07-29 21:58:46 +08:00
|
|
|
join_date = #{joinDate},
|
|
|
|
|
comment = #{comment},
|
|
|
|
|
technician = #{technician},
|
|
|
|
|
update_by = #{updateBy},
|
|
|
|
|
update_time = NOW()
|
2025-07-12 17:56:28 +08:00
|
|
|
</set>
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteScAddSheepByIds">
|
|
|
|
|
DELETE FROM sc_add_sheep WHERE id IN
|
|
|
|
|
<foreach collection="array" item="id" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
</mapper>
|