新增羊只,转场,转群,改耳号,改品种,改备注,体尺测量,体况评分,乳况评分,修蹄,去势初版

This commit is contained in:
zyh
2025-07-29 21:58:46 +08:00
parent 4f45e1fcbf
commit 9b0fd3799e
79 changed files with 4399 additions and 306 deletions

View File

@@ -5,36 +5,34 @@
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScAddSheepMapper">
<!-- 1. 结果映射:包含羊舍名称、品种名称 -->
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScAddSheep" id="ScAddSheepResult">
<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"/>
<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"/>
<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"/>
<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"/>
</resultMap>
<!-- 2. 查询列表:支持按品种筛选 -->
<select id="selectScAddSheepList" parameterType="ScAddSheep" resultMap="ScAddSheepResult">
SELECT
sas.*,
sf.sheepfold_name AS sheepfoldName,
bv.variety AS varietyName
bv.variety AS varietyName
FROM sc_add_sheep sas
LEFT JOIN da_sheepfold sf ON sas.sheepfold = sf.id
LEFT JOIN bas_sheep_variety bv ON sas.variety_id = bv.id
LEFT JOIN da_sheepfold sf ON sas.sheepfold = sf.id
LEFT JOIN bas_sheep_variety bv ON sas.variety_id = bv.id
<where>
<if test="earNumber != null and earNumber != ''">
AND sas.ear_number LIKE CONCAT('%', #{earNumber}, '%')
@@ -48,46 +46,43 @@
</where>
</select>
<!-- 3. 根据耳号精确查询 -->
<select id="selectByEarNumber" parameterType="string" resultMap="ScAddSheepResult">
SELECT * FROM sc_add_sheep WHERE ear_number = #{earNumber}
SELECT *
FROM sc_add_sheep
WHERE ear_number = #{earNumber}
</select>
<!-- 4. 插入 -->
<insert id="insert" parameterType="ScAddSheep" useGeneratedKeys="true" keyProperty="id">
INSERT INTO sc_add_sheep
(ear_number, sheepfold, father, mother, born_weight, birthday,
gender, parity, variety_id, join_date, comment, technician,
create_by, create_time)
VALUES
(#{earNumber}, #{sheepfold}, #{father}, #{mother}, #{bornWeight},
#{birthday}, #{gender}, #{parity}, #{varietyId}, #{joinDate},
#{comment}, #{technician}, #{createBy}, #{createTime})
VALUES (#{earNumber}, #{sheepfold}, #{father}, #{mother}, #{bornWeight},
#{birthday}, #{gender}, #{parity}, #{varietyId}, #{joinDate},
#{comment}, #{technician}, #{createBy}, #{createTime})
</insert>
<!-- 5. 更新 -->
<update id="updateScAddSheep" parameterType="ScAddSheep">
UPDATE sc_add_sheep
<set>
ear_number = #{earNumber},
sheepfold = #{sheepfold},
father = #{father},
mother = #{mother},
born_weight = #{bornWeight},
birthday = #{birthday},
gender = #{gender},
parity = #{parity},
variety_id = #{varietyId},
join_date = #{joinDate},
comment = #{comment},
technician = #{technician},
update_by = #{updateBy},
update_time = NOW()
ear_number = #{earNumber},
sheepfold = #{sheepfold},
father = #{father},
mother = #{mother},
born_weight = #{bornWeight},
birthday = #{birthday},
gender = #{gender},
parity = #{parity},
variety_id = #{varietyId},
join_date = #{joinDate},
comment = #{comment},
technician = #{technician},
update_by = #{updateBy},
update_time = NOW()
</set>
WHERE id = #{id}
</update>
<!-- 6. 批量删除 -->
<delete id="deleteScAddSheepByIds">
DELETE FROM sc_add_sheep WHERE id IN
<foreach collection="array" item="id" open="(" separator="," close=")">