新增羊只,转群功能完善

This commit is contained in:
zyh
2025-07-15 18:40:22 +08:00
parent cf295d0279
commit e6826f64f9
25 changed files with 1134 additions and 524 deletions

View File

@@ -5,45 +5,52 @@
<mapper namespace="com.zhyc.module.produce.manage_sheep.add_sheep.mapper.ScAddSheepMapper">
<resultMap type="com.zhyc.module.produce.manage_sheep.add_sheep.domain.ScAddSheep" id="ScAddSheepResult">
<result property="id" column="id" />
<result property="sheepId" column="sheep_id" />
<result property="sheepfold" column="sheepfold" />
<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="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="sheepfoldNameExcel" 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="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>
<insert id="insert" parameterType="ScAddSheep" useGeneratedKeys="true" keyProperty="id">
INSERT INTO sc_add_sheep
(sheep_id, sheepfold, father, mother, born_weight, birthday, gender, parity,
(ear_number, sheepfold, father, mother, born_weight, birthday, gender, parity,
variety_id, join_date, comment, technician, create_by, create_time)
VALUES
(#{sheepId}, #{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>
<select id="selectScAddSheepList" parameterType="ScAddSheep" resultMap="ScAddSheepResult">
SELECT * FROM sc_add_sheep
SELECT
sas.*,
sf.sheepfold_name AS sheepfoldName
FROM sc_add_sheep sas
LEFT JOIN da_sheepfold sf ON sas.sheepfold = sf.id
<where>
<if test="sheepId != null and sheepId != ''">AND sheep_id LIKE CONCAT('%', #{sheepId}, '%')</if>
<!-- 其他字段同理,按需扩展 -->
<if test="earNumber != null and earNumber != ''">
AND sas.ear_number LIKE CONCAT('%', #{earNumber}, '%')
</if>
</where>
</select>
<update id="updateScAddSheep" parameterType="ScAddSheep">
UPDATE sc_add_sheep
<set>
sheep_id = #{sheepId},
ear_number = #{earNumber},
sheepfold = #{sheepfold},
father = #{father},
mother = #{mother},
@@ -68,4 +75,7 @@
</foreach>
</delete>
<select id="selectByEarNumber" parameterType="string" resultMap="ScAddSheepResult">
SELECT * FROM sc_add_sheep WHERE ear_number = #{earNumber}
</select>
</mapper>

View File

@@ -1,40 +1,57 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.produce.manage_sheep.trans_group.mapper.ScTransGroupMapper">
<resultMap type="ScTransGroup" id="ScTransGroupResult">
<result property="id" column="id" />
<result property="sheepId" column="sheep_id" />
<result property="foldTo" column="fold_to" />
<result property="foldFrom" column="fold_from" />
<result property="reason" column="reason" />
<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" />
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="foldTo" column="fold_to"/>
<result property="foldFrom" column="fold_from"/>
<result property="reason" column="reason"/>
<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"/>
</resultMap>
<sql id="selectScTransGroupVo">
select id, sheep_id, fold_to, fold_from, reason, technician, status, comment, create_by, create_time from sc_trans_group
SELECT tg.id,
tg.sheep_id,
tg.fold_to,
tg.fold_from,
tg.reason,
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
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
</sql>
<select id="selectScTransGroupList" parameterType="ScTransGroup" resultMap="ScTransGroupResult">
<include refid="selectScTransGroupVo"/>
<where>
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
<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="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
<where>
<if test="sheepId != null ">and sheep_id = #{sheepId}</if>
<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="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
</select>
<select id="selectScTransGroupById" parameterType="Integer" resultMap="ScTransGroupResult">
<include refid="selectScTransGroupVo"/>
where id = #{id}
where tg.id = #{id}
</select>
<insert id="insertScTransGroup" parameterType="ScTransGroup" useGeneratedKeys="true" keyProperty="id">
@@ -49,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="foldTo != null and foldTo != ''">#{foldTo},</if>
@@ -60,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</trim>
</insert>
<update id="updateScTransGroup" parameterType="ScTransGroup">
@@ -76,15 +93,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
where sc_trans_group.id = #{id}
</update>
<delete id="deleteScTransGroupById" parameterType="Integer">
delete from sc_trans_group where id = #{id}
delete
from sc_trans_group
where tg.id = #{id}
</delete>
<delete id="deleteScTransGroupByIds" parameterType="String">
delete from sc_trans_group where id in
delete from sc_trans_group where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>