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

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

@@ -1,124 +1,178 @@
<?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.base.mapper.BasSheepMapper">
<resultMap type="BasSheep" id="BasSheepResult">
<result property="id" column="id" />
<result property="manageTags" column="manage_tags" />
<result property="ranchId" column="ranch_id" />
<result property="sheepfoldId" column="sheepfold_id" />
<result property="electronicTags" column="electronic_tags" />
<result property="varietyId" column="variety_id" />
<result property="family" column="family" />
<result property="typeId" column="type_id" />
<result property="gender" column="gender" />
<result property="birthday" column="birthday" />
<result property="birthWeight" column="birth_weight" />
<result property="parity" column="parity" />
<result property="statusId" column="status_id" />
<result property="weaningDate" column="weaning_date" />
<result property="weaningWeight" column="weaning_weight" />
<result property="breedStatusId" column="breed_status_id" />
<result property="fatherId" column="father_id" />
<result property="motherId" column="mother_id" />
<result property="receptorId" column="receptor_id" />
<result property="matingDate" column="mating_date" />
<result property="matingTypeId" column="mating_type_id" />
<result property="pregDate" column="preg_date" />
<result property="lambingDate" column="lambing_date" />
<result property="lambingDay" column="lambing_day" />
<result property="expectedDate" column="expected_date" />
<result property="controlled" column="controlled" />
<result property="matingCounts" column="mating_counts" />
<result property="matingTotal" column="mating_total" />
<result property="miscarriageCounts" column="miscarriage_counts" />
<result property="body" column="body" />
<result property="breast" column="breast" />
<result property="source" column="source" />
<result property="sourceDate" column="source_date" />
<result property="sourceRanchId" column="source_ranch_id" />
<result property="comment" column="comment" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="isDelete" column="is_delete" />
<resultMap type="com.zhyc.module.base.domain.BasSheep" id="BasSheepResult">
<result property="id" column="id"/>
<result property="manageTags" column="manage_tags"/>
<result property="ranchId" column="ranch_id"/>
<result property="sheepfoldId" column="sheepfold_id"/>
<result property="electronicTags" column="electronic_tags"/>
<result property="varietyId" column="variety_id"/>
<result property="family" column="family"/>
<result property="typeId" column="type_id"/>
<result property="gender" column="gender"/>
<result property="birthday" column="birthday"/>
<result property="birthWeight" column="birth_weight"/>
<result property="parity" column="parity"/>
<result property="statusId" column="status_id"/>
<result property="weaningDate" column="weaning_date"/>
<result property="weaningWeight" column="weaning_weight"/>
<result property="breedStatusId" column="breed_status_id"/>
<result property="fatherId" column="father_id"/>
<result property="motherId" column="mother_id"/>
<result property="receptorId" column="receptor_id"/>
<result property="matingDate" column="mating_date"/>
<result property="matingTypeId" column="mating_type_id"/>
<result property="pregDate" column="preg_date"/>
<result property="lambingDate" column="lambing_date"/>
<result property="lambingDay" column="lambing_day"/>
<result property="expectedDate" column="expected_date"/>
<result property="controlled" column="controlled"/>
<result property="matingCounts" column="mating_counts"/>
<result property="matingTotal" column="mating_total"/>
<result property="miscarriageCounts" column="miscarriage_counts"/>
<result property="body" column="body"/>
<result property="breast" column="breast"/>
<result property="source" column="source"/>
<result property="sourceDate" column="source_date"/>
<result property="sourceRanchId" column="source_ranch_id"/>
<result property="comment" column="comment"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="isDelete" column="is_delete"/>
</resultMap>
<sql id="selectBasSheepVo">
select id, manage_tags, ranch_id, sheepfold_id, electronic_tags, variety_id, family, type_id, gender, birthday, birth_weight, parity, status_id, weaning_date, weaning_weight, breed_status_id, father_id, mother_id, receptor_id, mating_date, mating_type_id, preg_date, lambing_date, lambing_day, expected_date, controlled, mating_counts, mating_total, miscarriage_counts, body, breast, source, source_date, source_ranch_id, comment, update_by, update_time, create_by, create_time, is_delete from bas_sheep
select id,
manage_tags,
ranch_id,
sheepfold_id,
electronic_tags,
variety_id,
family,
type_id,
gender,
birthday,
birth_weight,
parity,
status_id,
weaning_date,
weaning_weight,
breed_status_id,
father_id,
mother_id,
receptor_id,
mating_date,
mating_type_id,
preg_date,
lambing_date,
lambing_day,
expected_date,
controlled,
mating_counts,
mating_total,
miscarriage_counts,
body,
breast,
source,
source_date,
source_ranch_id,
comment,
update_by,
update_time,
create_by,
create_time,
is_delete
from bas_sheep
</sql>
<select id="selectBasSheepList" parameterType="BasSheep" resultMap="BasSheepResult">
<include refid="selectBasSheepVo"/>
<where>
<if test="manageTags != null and manageTags != ''"> and manage_tags = #{manageTags}</if>
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
<if test="electronicTags != null and electronicTags != ''"> and electronic_tags = #{electronicTags}</if>
<if test="varietyId != null "> and variety_id = #{varietyId}</if>
<if test="family != null and family != ''"> and family = #{family}</if>
<if test="typeId != null "> and type_id = #{typeId}</if>
<if test="gender != null "> and gender = #{gender}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
<if test="birthWeight != null "> and birth_weight = #{birthWeight}</if>
<if test="parity != null "> and parity = #{parity}</if>
<if test="statusId != null "> and status_id = #{statusId}</if>
<if test="weaningDate != null "> and weaning_date = #{weaningDate}</if>
<if test="weaningWeight != null "> and weaning_weight = #{weaningWeight}</if>
<if test="breedStatusId != null "> and breed_status_id = #{breedStatusId}</if>
<if test="fatherId != null "> and father_id = #{fatherId}</if>
<if test="motherId != null "> and mother_id = #{motherId}</if>
<if test="receptorId != null "> and receptor_id = #{receptorId}</if>
<if test="matingDate != null "> and mating_date = #{matingDate}</if>
<if test="matingTypeId != null "> and mating_type_id = #{matingTypeId}</if>
<if test="pregDate != null "> and preg_date = #{pregDate}</if>
<if test="lambingDate != null "> and lambing_date = #{lambingDate}</if>
<if test="lambingDay != null "> and lambing_day = #{lambingDay}</if>
<if test="expectedDate != null "> and expected_date = #{expectedDate}</if>
<if test="controlled != null "> and controlled = #{controlled}</if>
<if test="matingCounts != null "> and mating_counts = #{matingCounts}</if>
<if test="matingTotal != null "> and mating_total = #{matingTotal}</if>
<if test="miscarriageCounts != null "> and miscarriage_counts = #{miscarriageCounts}</if>
<if test="body != null "> and body = #{body}</if>
<if test="breast != null "> and breast = #{breast}</if>
<if test="source != null and source != ''"> and source = #{source}</if>
<if test="sourceDate != null "> and source_date = #{sourceDate}</if>
<if test="sourceRanchId != null "> and source_ranch_id = #{sourceRanchId}</if>
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="manageTags != null and manageTags != ''">and manage_tags = #{manageTags}</if>
<if test="ranchId != null ">and ranch_id = #{ranchId}</if>
<if test="sheepfoldId != null ">and sheepfold_id = #{sheepfoldId}</if>
<if test="electronicTags != null and electronicTags != ''">and electronic_tags = #{electronicTags}</if>
<if test="varietyId != null ">and variety_id = #{varietyId}</if>
<if test="family != null and family != ''">and family = #{family}</if>
<if test="typeId != null ">and type_id = #{typeId}</if>
<if test="gender != null ">and gender = #{gender}</if>
<if test="birthday != null ">and birthday = #{birthday}</if>
<if test="birthWeight != null ">and birth_weight = #{birthWeight}</if>
<if test="parity != null ">and parity = #{parity}</if>
<if test="statusId != null ">and status_id = #{statusId}</if>
<if test="weaningDate != null ">and weaning_date = #{weaningDate}</if>
<if test="weaningWeight != null ">and weaning_weight = #{weaningWeight}</if>
<if test="breedStatusId != null ">and breed_status_id = #{breedStatusId}</if>
<if test="fatherId != null ">and father_id = #{fatherId}</if>
<if test="motherId != null ">and mother_id = #{motherId}</if>
<if test="receptorId != null ">and receptor_id = #{receptorId}</if>
<if test="matingDate != null ">and mating_date = #{matingDate}</if>
<if test="matingTypeId != null ">and mating_type_id = #{matingTypeId}</if>
<if test="pregDate != null ">and preg_date = #{pregDate}</if>
<if test="lambingDate != null ">and lambing_date = #{lambingDate}</if>
<if test="lambingDay != null ">and lambing_day = #{lambingDay}</if>
<if test="expectedDate != null ">and expected_date = #{expectedDate}</if>
<if test="controlled != null ">and controlled = #{controlled}</if>
<if test="matingCounts != null ">and mating_counts = #{matingCounts}</if>
<if test="matingTotal != null ">and mating_total = #{matingTotal}</if>
<if test="miscarriageCounts != null ">and miscarriage_counts = #{miscarriageCounts}</if>
<if test="body != null ">and body = #{body}</if>
<if test="breast != null ">and breast = #{breast}</if>
<if test="source != null and source != ''">and source = #{source}</if>
<if test="sourceDate != null ">and source_date = #{sourceDate}</if>
<if test="sourceRanchId != null ">and source_ranch_id = #{sourceRanchId}</if>
<if test="comment != null and comment != ''">and comment = #{comment}</if>
<if test="isDelete != null ">and is_delete = #{isDelete}</if>
</where>
</select>
<select id="selectBasSheepById" parameterType="java.lang.Long" resultType="com.zhyc.module.base.domain.BasSheep">
SELECT s.id,
s.sheepfold_id AS sheepfoldId,
sf.sheepfold_name AS sheepfoldName,
s.variety_id AS varietyId,
bv.variety AS varietyName
s.manage_tags AS manageTags,
s.electronic_tags AS electronicTags,
s.sheepfold_id AS sheepfoldId,
sf.sheepfold_name AS sheepfoldName,
s.variety_id AS varietyId,
bv.variety AS varietyName
FROM bas_sheep s
LEFT JOIN da_sheepfold sf ON s.sheepfold_id = sf.id
LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id
WHERE s.id = #{id}
</select>
<select id="selectBasSheepByManageTags" parameterType="BasSheep" resultMap="BasSheepResult">
<include refid="selectBasSheepVo"/>
<where>
manage_tags = #{manageTags}
</where>
<select id="selectBasSheepByManageTags" parameterType="String" resultMap="BasSheepResult">
SELECT s.*,
bv.variety AS varietyName
FROM bas_sheep s
LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id
WHERE s.manage_tags = #{manageTags} LIMIT 1
</select>
<select id="selectBasSheepBySheepfold" parameterType="BasSheep" resultMap="BasSheepResult">
<include refid="selectBasSheepVo"/>
<where>
sheepfold_id = #{id}
</where>
<where>
sheepfold_id = #{id}
</where>
</select>
<select id="getSheepByRanchId" resultMap="BasSheepResult">
SELECT *
FROM bas_sheep
WHERE ranch_id = #{ranchId}
</select>
<select id="selectBasSheepListByIds" parameterType="list" resultMap="BasSheepResult">
SELECT * FROM bas_sheep WHERE id IN
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id">
insert into bas_sheep
@@ -162,7 +216,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="isDelete != null">is_delete,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="manageTags != null">#{manageTags},</if>
<if test="ranchId != null">#{ranchId},</if>
@@ -203,7 +257,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="isDelete != null">#{isDelete},</if>
</trim>
</trim>
</insert>
<update id="updateBasSheep" parameterType="BasSheep">
@@ -253,7 +307,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteBasSheepById" parameterType="Long">
delete from bas_sheep where id = #{id}
delete
from bas_sheep
where id = #{id}
</delete>
<delete id="deleteBasSheepByIds" parameterType="String">
@@ -263,5 +319,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="existsByManageTag" resultType="int">
SELECT COUNT(*) FROM bas_sheep WHERE manage_tags = #{tag} AND is_delete = 0
</select>
<select id="existsByElectronicTag" resultType="int">
SELECT COUNT(*) FROM bas_sheep WHERE electronic_tags = #{tag} AND is_delete = 0
</select>
</mapper>

View File

@@ -1,25 +1,26 @@
<?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.base.mapper.BasSheepVarietyMapper">
<resultMap type="BasSheepVariety" id="BasSheepVarietyResult">
<result property="id" column="id" />
<result property="variety" column="variety" />
<result property="id" column="id"/>
<result property="variety" column="variety"/>
</resultMap>
<sql id="selectBasSheepVarietyVo">
select id, variety from bas_sheep_variety
select id, variety
from bas_sheep_variety
</sql>
<select id="selectBasSheepVarietyList" parameterType="BasSheepVariety" resultMap="BasSheepVarietyResult">
<include refid="selectBasSheepVarietyVo"/>
<where>
<if test="variety != null and variety != ''"> and variety = #{variety}</if>
<where>
<if test="variety != null and variety != ''">and variety = #{variety}</if>
</where>
</select>
<select id="selectBasSheepVarietyById" parameterType="Long" resultMap="BasSheepVarietyResult">
<include refid="selectBasSheepVarietyVo"/>
where id = #{id}
@@ -29,10 +30,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into bas_sheep_variety
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="variety != null">variety,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="variety != null">#{variety},</if>
</trim>
</trim>
</insert>
<update id="updateBasSheepVariety" parameterType="BasSheepVariety">
@@ -44,11 +45,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteBasSheepVarietyById" parameterType="Long">
delete from bas_sheep_variety where id = #{id}
delete
from bas_sheep_variety
where id = #{id}
</delete>
<delete id="deleteBasSheepVarietyByIds" parameterType="String">
delete from bas_sheep_variety where id in
delete from bas_sheep_variety where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
@@ -57,7 +60,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectIdByName" parameterType="string" resultType="java.lang.Long">
SELECT id
FROM bas_sheep_variety
WHERE variety = #{varietyName}
LIMIT 1
WHERE variety = #{varietyName} LIMIT 1
</select>
<select id="selectByVarietyName" parameterType="String" resultMap="BasSheepVarietyResult">
SELECT id, variety
FROM bas_sheep_variety
WHERE variety = #{varietyName} LIMIT 1
</select>
</mapper>

View File

@@ -0,0 +1,59 @@
<?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">
<mapper namespace="com.zhyc.module.base.mapper.DaRanchMapper">
<resultMap type="DaRanch" id="DaRanchResult">
<result property="id" column="id"/>
<result property="ranch" column="ranch"/>
</resultMap>
<sql id="selectDaRanchVo">
select id, ranch
from da_ranch
</sql>
<select id="selectDaRanchList" parameterType="DaRanch" resultMap="DaRanchResult">
<include refid="selectDaRanchVo"/>
<where>
<if test="ranch != null and ranch != ''">and ranch = #{ranch}</if>
</where>
</select>
<select id="selectDaRanchById" parameterType="Long" resultMap="DaRanchResult">
<include refid="selectDaRanchVo"/>
where id = #{id}
</select>
<insert id="insertDaRanch" parameterType="DaRanch" useGeneratedKeys="true" keyProperty="id">
insert into da_ranch
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ranch != null">ranch,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ranch != null">#{ranch},</if>
</trim>
</insert>
<update id="updateDaRanch" parameterType="DaRanch">
update da_ranch
<trim prefix="SET" suffixOverrides=",">
<if test="ranch != null">ranch = #{ranch},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDaRanchById" parameterType="Long">
delete
from da_ranch
where id = #{id}
</delete>
<delete id="deleteDaRanchByIds" parameterType="String">
delete from da_ranch where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -1,32 +1,40 @@
<?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.base.mapper.DaSheepfoldMapper">
<resultMap type="DaSheepfold" id="DaSheepfoldResult">
<result property="id" column="id" />
<result property="ranchId" column="ranch_id" />
<result property="sheepfoldName" column="sheepfold_name" />
<result property="sheepfoldTypeId" column="sheepfold_type_id" />
<result property="sheepfoldNo" column="sheepfold_no" />
<result property="rowNo" column="row_no" />
<result property="columns" column="columns" />
<result property="comment" column="comment" />
<resultMap type="com.zhyc.module.base.domain.DaSheepfold" id="DaSheepfoldResult">
<result property="id" column="id"/>
<result property="ranchId" column="ranch_id"/>
<result property="sheepfoldName" column="sheepfold_name"/>
<result property="sheepfoldTypeId" column="sheepfold_type_id"/>
<result property="sheepfoldNo" column="sheepfold_no"/>
<result property="rowNo" column="row_no"/>
<result property="columns" column="columns"/>
<result property="comment" column="comment"/>
</resultMap>
<sql id="selectDaSheepfoldVo">
select id, ranch_id, sheepfold_name, sheepfold_type_id, sheepfold_no, row_no, columns, comment from da_sheepfold
select id,
ranch_id,
sheepfold_name,
sheepfold_type_id,
sheepfold_no,
row_no,
columns,
comment
from da_sheepfold
</sql>
<select id="selectDaSheepfoldList" parameterType="DaSheepfold" resultMap="DaSheepfoldResult">
<include refid="selectDaSheepfoldVo"/>
<where>
<if test="ranchId != null "> and ranch_id = #{ranchId}</if>
<if test="sheepfoldTypeId != null "> and sheepfold_type_id = #{sheepfoldTypeId}</if>
<where>
<if test="ranchId != null ">and ranch_id = #{ranchId}</if>
<if test="sheepfoldTypeId != null ">and sheepfold_type_id = #{sheepfoldTypeId}</if>
</where>
</select>
<select id="selectDaSheepfoldById" parameterType="Long" resultMap="DaSheepfoldResult">
<include refid="selectDaSheepfoldVo"/>
where id = #{id}
@@ -42,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rowNo != null">row_no,</if>
<if test="columns != null">columns,</if>
<if test="comment != null">comment,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ranchId != null">#{ranchId},</if>
<if test="sheepfoldName != null">#{sheepfoldName},</if>
@@ -51,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rowNo != null">#{rowNo},</if>
<if test="columns != null">#{columns},</if>
<if test="comment != null">#{comment},</if>
</trim>
</trim>
</insert>
<update id="updateDaSheepfold" parameterType="DaSheepfold">
@@ -69,11 +77,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteDaSheepfoldById" parameterType="Long">
delete from da_sheepfold where id = #{id}
delete
from da_sheepfold
where id = #{id}
</delete>
<delete id="deleteDaSheepfoldByIds" parameterType="String">
delete from da_sheepfold where id in
delete from da_sheepfold where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>

View File

@@ -0,0 +1,139 @@
<?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">
<mapper namespace="com.zhyc.module.produce.bodyManage.mapper.ScBodyMeasureMapper">
<resultMap type="com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure" id="ScBodyMeasureResult">
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manage_tags"/>
<result property="height" column="height"/>
<result property="bust" column="bust"/>
<result property="bodyLength" column="body_length"/>
<result property="pipeLength" column="pipe_length"/>
<result property="chestDepth" column="chest_depth"/>
<result property="hipHeight" column="hip_height"/>
<result property="rumpWidth" column="rump_width"/>
<result property="rumpHeignt" column="rump_heignt"/>
<result property="hipWidth" column="hip_width"/>
<result property="hipCrossHeight" column="hip_cross_height"/>
<result property="comment" column="comment"/>
<result property="technician" column="technician"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectScBodyMeasureVo">
select sm.id,
sm.sheep_id,
bs.manage_tags,
sm.height,
sm.bust,
sm.body_length,
sm.pipe_length,
sm.chest_depth,
sm.hip_height,
sm.rump_width,
sm.rump_heignt,
sm.hip_width,
sm.hip_cross_height,
sm.comment,
sm.technician,
sm.create_by,
sm.create_time
from sc_body_measure sm
left join bas_sheep bs on sm.sheep_id = bs.id
</sql>
<select id="selectScBodyMeasureList" parameterType="ScBodyMeasure" resultMap="ScBodyMeasureResult">
<include refid="selectScBodyMeasureVo"/>
<where>
<if test="sheepId != null ">and sm.sheep_id = #{sheepId}</if>
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
<if test="params.beginCreateTime != null and params.endCreateTime != null">
and sm.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
</select>
<select id="selectScBodyMeasureById" parameterType="Long" resultMap="ScBodyMeasureResult">
<include refid="selectScBodyMeasureVo"/>
where sm.id = #{id}
</select>
<insert id="insertScBodyMeasure" parameterType="ScBodyMeasure" useGeneratedKeys="true" keyProperty="id">
insert into sc_body_measure
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="height != null">height,</if>
<if test="bust != null">bust,</if>
<if test="bodyLength != null">body_length,</if>
<if test="pipeLength != null">pipe_length,</if>
<if test="chestDepth != null">chest_depth,</if>
<if test="hipHeight != null">hip_height,</if>
<if test="rumpWidth != null">rump_width,</if>
<if test="rumpHeignt != null">rump_heignt,</if>
<if test="hipWidth != null">hip_width,</if>
<if test="hipCrossHeight != null">hip_cross_height,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="height != null">#{height},</if>
<if test="bust != null">#{bust},</if>
<if test="bodyLength != null">#{bodyLength},</if>
<if test="pipeLength != null">#{pipeLength},</if>
<if test="chestDepth != null">#{chestDepth},</if>
<if test="hipHeight != null">#{hipHeight},</if>
<if test="rumpWidth != null">#{rumpWidth},</if>
<if test="rumpHeignt != null">#{rumpHeignt},</if>
<if test="hipWidth != null">#{hipWidth},</if>
<if test="hipCrossHeight != null">#{hipCrossHeight},</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>
</trim>
</insert>
<update id="updateScBodyMeasure" parameterType="ScBodyMeasure">
update sc_body_measure
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="height != null">height = #{height},</if>
<if test="bust != null">bust = #{bust},</if>
<if test="bodyLength != null">body_length = #{bodyLength},</if>
<if test="pipeLength != null">pipe_length = #{pipeLength},</if>
<if test="chestDepth != null">chest_depth = #{chestDepth},</if>
<if test="hipHeight != null">hip_height = #{hipHeight},</if>
<if test="rumpWidth != null">rump_width = #{rumpWidth},</if>
<if test="rumpHeignt != null">rump_heignt = #{rumpHeignt},</if>
<if test="hipWidth != null">hip_width = #{hipWidth},</if>
<if test="hipCrossHeight != null">hip_cross_height = #{hipCrossHeight},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="technician != null">technician = #{technician},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteScBodyMeasureById" parameterType="Long">
delete
from sc_body_measure
where id = #{id}
</delete>
<delete id="deleteScBodyMeasureByIds" parameterType="String">
delete from sc_body_measure where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,111 @@
<?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">
<mapper namespace="com.zhyc.module.produce.bodyManage.mapper.ScBodyScoreMapper">
<resultMap type="com.zhyc.module.produce.bodyManage.domain.ScBodyScore" id="ScBodyScoreResult">
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manage_tags"/>
<result property="datetime" column="datetime"/>
<result property="score" column="score"/>
<result property="sheepfold" column="sheepfold"/>
<result property="comment" column="comment"/>
<result property="technician" column="technician"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectScBodyScoreVo">
select sbs.id,
sbs.sheep_id,
bs.manage_tags,
sbs.datetime,
sbs.score,
sbs.sheepfold,
ds.sheepfold_name as sheepfoldName,
sbs.comment,
sbs.technician,
sbs.create_by,
sbs.create_time
from sc_body_score sbs
left join bas_sheep bs on sbs.sheep_id = bs.id
left join da_sheepfold ds on sbs.sheepfold = ds.id
</sql>
<select id="selectScBodyScoreList" parameterType="ScBodyScore" resultMap="ScBodyScoreResult">
<include refid="selectScBodyScoreVo"/>
<where>
<if test="sheepId != null and sheepId != ''">and sbs.sheep_id = #{sheepId}</if>
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''">
and sbs.datetime between #{params.beginDatetime} and #{params.endDatetime}
</if>
<if test="score != null ">and score = #{score}</if>
<if test="sheepfold != null ">and sheepfold = #{sheepfold}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and sbs.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
</where>
</select>
<select id="selectScBodyScoreById" parameterType="Long" resultMap="ScBodyScoreResult">
<include refid="selectScBodyScoreVo"/>
where sbs.id = #{id}
</select>
<insert id="insertScBodyScore" parameterType="ScBodyScore" useGeneratedKeys="true" keyProperty="id">
insert into sc_body_score
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="datetime != null">datetime,</if>
<if test="score != null">score,</if>
<if test="sheepfold != null">sheepfold,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="datetime != null">#{datetime},</if>
<if test="score != null">#{score},</if>
<if test="sheepfold != null">#{sheepfold},</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>
</trim>
</insert>
<update id="updateScBodyScore" parameterType="ScBodyScore">
update sc_body_score
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="datetime != null">datetime = #{datetime},</if>
<if test="score != null">score = #{score},</if>
<if test="sheepfold != null">sheepfold = #{sheepfold},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="technician != null">technician = #{technician},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteScBodyScoreById" parameterType="Long">
delete
from sc_body_score
where id = #{id}
</delete>
<delete id="deleteScBodyScoreByIds" parameterType="String">
delete from sc_body_score where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,107 @@
<?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">
<mapper namespace="com.zhyc.module.produce.bodyManage.mapper.ScBreastRatingMapper">
<resultMap type="com.zhyc.module.produce.bodyManage.domain.ScBreastRating" id="ScBreastRatingResult">
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manageTags"/>
<result property="depth" column="depth"/>
<result property="length" column="length"/>
<result property="position" column="position"/>
<result property="adbere" column="adbere"/>
<result property="spacing" column="spacing"/>
<result property="score" column="score"/>
<result property="comment" column="comment"/>
<result property="technician" column="technician"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectScBreastRatingVo">
select sbr.*,
bs.manage_tags as manageTags
from sc_breast_rating sbr
left join bas_sheep bs on sbr.sheep_id = bs.id
</sql>
<select id="selectScBreastRatingList" parameterType="ScBreastRating" resultMap="ScBreastRatingResult">
<include refid="selectScBreastRatingVo"/>
<where>
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
<if test="params.beginCreateTime != null and params.endCreateTime != null">
and sbr.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
</select>
<select id="selectScBreastRatingById" parameterType="Long" resultMap="ScBreastRatingResult">
<include refid="selectScBreastRatingVo"/>
where sbr.id = #{id}
</select>
<insert id="insertScBreastRating" parameterType="ScBreastRating" useGeneratedKeys="true" keyProperty="id">
insert into sc_breast_rating
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="depth != null">depth,</if>
<if test="length != null">length,</if>
<if test="position != null">position,</if>
<if test="adbere != null">adbere,</if>
<if test="spacing != null">spacing,</if>
<if test="score != null">score,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="depth != null">#{depth},</if>
<if test="length != null">#{length},</if>
<if test="position != null">#{position},</if>
<if test="adbere != null">#{adbere},</if>
<if test="spacing != null">#{spacing},</if>
<if test="score != null">#{score},</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>
</trim>
</insert>
<update id="updateScBreastRating" parameterType="ScBreastRating">
update sc_breast_rating
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="depth != null">depth = #{depth},</if>
<if test="length != null">length = #{length},</if>
<if test="position != null">position = #{position},</if>
<if test="adbere != null">adbere = #{adbere},</if>
<if test="spacing != null">spacing = #{spacing},</if>
<if test="score != null">score = #{score},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="technician != null">technician = #{technician},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteScBreastRatingById" parameterType="Long">
delete
from sc_breast_rating
where id = #{id}
</delete>
<delete id="deleteScBreastRatingByIds" parameterType="String">
delete from sc_breast_rating where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

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=")">

View File

@@ -0,0 +1,95 @@
<?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">
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScChangeCommentMapper">
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScChangeComment" id="ScChangeCommentResult">
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manage_tags"/>
<result property="newComment" column="new_comment"/>
<result property="oldComment" column="old_comment"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectScChangeCommentVo">
select scc.id,
scc.sheep_id,
bs.manage_tags as manage_tags,
scc.new_comment,
scc.old_comment,
scc.create_by,
scc.create_time
from sc_change_comment scc
left join bas_sheep bs on scc.sheep_id = bs.id
</sql>
<select id="selectScChangeCommentList" parameterType="ScChangeComment" resultMap="ScChangeCommentResult">
<include refid="selectScChangeCommentVo"/>
<where>
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
<if test="newComment != null and newComment != ''">
and scc.new_comment like concat('%', #{newComment}, '%')
</if>
<if test="oldComment != null and oldComment != ''">
and scc.old_comment like concat('%', #{oldComment}, '%')
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != ''
and params.endCreateTime != null and params.endCreateTime != ''">
and scc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
</select>
<select id="selectScChangeCommentById" parameterType="Long" resultMap="ScChangeCommentResult">
<include refid="selectScChangeCommentVo"/>
where scc.id = #{id}
</select>
<insert id="insertScChangeComment" parameterType="ScChangeComment" useGeneratedKeys="true" keyProperty="id">
insert into sc_change_comment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null and sheepId != ''">sheep_id,</if>
<if test="newComment != null and newComment != ''">new_comment,</if>
<if test="oldComment != null and oldComment != ''">old_comment,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null and sheepId != ''">#{sheepId},</if>
<if test="newComment != null and newComment != ''">#{newComment},</if>
<if test="oldComment != null and oldComment != ''">#{oldComment},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateScChangeComment" parameterType="ScChangeComment">
update sc_change_comment
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null and sheepId != ''">sheep_id = #{sheepId},</if>
<if test="newComment != null and newComment != ''">new_comment = #{newComment},</if>
<if test="oldComment != null and oldComment != ''">old_comment = #{oldComment},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteScChangeCommentById" parameterType="Long">
delete
from sc_change_comment
where id = #{id}
</delete>
<delete id="deleteScChangeCommentByIds" parameterType="String">
delete from sc_change_comment where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,106 @@
<?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">
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScChangeEarMapper">
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScChangeEar" id="ScChangeEarResult">
<result property="id" column="sce_id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manage_tags"/>
<result property="earType" column="ear_type"/>
<result property="newTag" column="newTag"/>
<result property="oldTag" column="oldTag"/>
<result property="comment" column="comment"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectScChangeEarVo">
select sce.id as sce_id,
sce.sheep_id,
bs.manage_tags as manage_tags,
sce.ear_type,
sce.newTag,
sce.oldTag as oldTag,
sce.comment,
sce.create_by,
sce.create_time
from sc_change_ear sce
LEFT JOIN bas_sheep bs ON sce.sheep_id = bs.id
</sql>
<select id="selectScChangeEarList" parameterType="ScChangeEar" resultMap="ScChangeEarResult">
<include refid="selectScChangeEarVo"/>
<where>
<if test="sheepId != null">and sce.sheep_id = #{sheepId}</if>
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%')
</if>
<if test="earType != null ">and sce.ear_type = #{earType}</if>
<if test="newTag != null and newTag != ''">
and sce.newTag LIKE CONCAT('%', #{newTag}, '%')
</if>
<if test="oldTag != null and oldTag != ''">
and sce.oldTag LIKE CONCAT('%', #{oldTag}, '%')
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and sce.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
</select>
<select id="selectScChangeEarById" parameterType="Integer" resultMap="ScChangeEarResult">
<include refid="selectScChangeEarVo"/>
where sce.id = #{id}
</select>
<insert id="insertScChangeEar" parameterType="ScChangeEar" useGeneratedKeys="true" keyProperty="id">
insert into sc_change_ear
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="earType != null">ear_type,</if>
<if test="newTag != null and newTag != ''">newTag,</if>
<if test="oldTag != null and oldTag != ''">oldTag,</if>
<if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="earType != null">#{earType},</if>
<if test="newTag != null and newTag != ''">#{newTag},</if>
<if test="oldTag != null and oldTag != ''">#{oldTag},</if>
<if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateScChangeEar" parameterType="ScChangeEar">
update sc_change_ear
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="earType != null">ear_type = #{earType},</if>
<if test="newTag != null and newTag != ''">newTag = #{newTag},</if>
<if test="oldTag != null and oldTag != ''">oldTag = #{oldTag},</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="deleteScChangeEarById" parameterType="Integer">
delete
from sc_change_ear
where id = #{id}
</delete>
<delete id="deleteScChangeEarByIds" parameterType="String">
delete from sc_change_ear where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,101 @@
<?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">
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScChangeVarietyMapper">
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScChangeVariety" id="ScChangeVarietyResult">
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manage_tags"/>
<result property="varietyOld" column="variety_old"/>
<result property="varietyNew" column="variety_new"/>
<result property="comment" column="comment"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectScChangeVarietyVo">
select scv.id,
scv.sheep_id,
bs.manage_tags as manage_tags,
scv.variety_old,
scv.variety_new,
scv.comment,
scv.create_by,
scv.create_time
from sc_change_variety scv
left join bas_sheep bs on scv.sheep_id = bs.id
</sql>
<select id="selectScChangeVarietyList" parameterType="ScChangeVariety" resultMap="ScChangeVarietyResult">
<include refid="selectScChangeVarietyVo"/>
<where>
<if test="sheepId != null">and scv.sheep_id = #{sheepId}</if>
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
<if test="varietyOld != null and varietyOld != ''">
and scv.variety_old like concat('%', #{varietyOld}, '%')
</if>
<if test="varietyNew != null and varietyNew != ''">
and scv.variety_new like concat('%', #{varietyNew}, '%')
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != ''
and params.endCreateTime != null and params.endCreateTime != ''">
and scv.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
</select>
<select id="selectScChangeVarietyById" parameterType="Integer" resultMap="ScChangeVarietyResult">
<include refid="selectScChangeVarietyVo"/>
where scv.id = #{id}
</select>
<insert id="insertScChangeVariety" parameterType="ScChangeVariety" useGeneratedKeys="true" keyProperty="id">
insert into sc_change_variety
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="varietyOld != null and varietyOld != ''">variety_old,</if>
<if test="varietyNew != null and varietyNew != ''">variety_new,</if>
<if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="varietyOld != null and varietyOld != ''">#{varietyOld},</if>
<if test="varietyNew != null and varietyNew != ''">#{varietyNew},</if>
<if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateScChangeVariety" parameterType="ScChangeVariety">
update sc_change_variety
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="varietyOld != null and varietyOld != ''">variety_old = #{varietyOld},</if>
<if test="varietyNew != null and varietyNew != ''">variety_new = #{varietyNew},</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="deleteScChangeVarietyById" parameterType="Integer">
delete
from sc_change_variety
where id = #{id}
</delete>
<delete id="deleteScChangeVarietyByIds" parameterType="String">
delete from sc_change_variety where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -4,10 +4,11 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScTransGroupMapper">
<resultMap type="ScTransGroup" id="ScTransGroupResult">
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScTransGroup" id="ScTransGroupResult">
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manageTags"/>
<result property="sheepTypeId" column="type_id"/>
<result property="foldTo" column="fold_to"/>
<result property="foldFrom" column="fold_from"/>
<result property="reason" column="reason"/>
@@ -23,7 +24,7 @@
<sql id="selectScTransGroupVo">
SELECT tg.id,
tg.sheep_id,
s.manage_tags AS manageTags,
s.manage_tags AS manageTags,
tg.fold_to,
tg.fold_from,
tg.reason,
@@ -35,9 +36,12 @@
tg.create_by,
tg.create_time,
sf_from.sheepfold_name AS foldFromName,
sf_to.sheepfold_name AS foldToName
sf_to.sheepfold_name AS foldToName,
st.id AS sheepTypeId,
st.name AS sheepTypeName
FROM sc_trans_group tg
LEFT JOIN bas_sheep s ON tg.sheep_id = s.id
LEFT JOIN bas_sheep_type st ON s.type_id = st.id
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
LEFT JOIN bas_sheep_variety bv ON tg.variety_id = bv.id
@@ -55,7 +59,7 @@
<if test="status != null">and status = #{status}</if>
<if test="varietyId != null">and tg.variety_id = #{varietyId}</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}
and tg.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
</select>

View File

@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.produce.manage_sheep.mapper.ScTransitionInfoMapper">
<resultMap type="ScTransitionInfo" id="ScTransitionInfoResult">
<resultMap type="com.zhyc.module.produce.manage_sheep.domain.ScTransitionInfo" id="ScTransitionInfoResult">
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="varietyId" column="variety_id"/>
@@ -11,7 +11,7 @@
<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="transTypeText" column="transTypeText"/>
<result property="technician" column="technician"/>
<result property="status" column="status"/>
<result property="comment" column="comment"/>
@@ -20,27 +20,39 @@
</resultMap>
<sql id="selectScTransitionInfoVo">
SELECT t.*, bv.variety AS varietyName,
SELECT t.*,
bv.variety AS varietyName,
bs.manage_tags AS manageTags,
CASE t.trans_type
WHEN 0 THEN '内部转场'
WHEN 1 THEN '跨场转场'
WHEN 2 THEN '销售转场'
WHEN 0 THEN '内部调拨'
WHEN 1 THEN '内部销售'
WHEN 2 THEN '育肥调拨'
ELSE '未知'
END AS trans_type_text
END AS transTypeText,
CASE t.status
WHEN 0 THEN '待审批'
WHEN 1 THEN '已通过'
WHEN 2 THEN '已驳回'
ELSE '未知状态'
END AS statusText
FROM sc_transition_info t
LEFT JOIN bas_sheep_variety bv ON t.variety_id = bv.id
LEFT JOIN bas_sheep bs ON t.sheep_id = bs.id
</sql>
<select id="selectScTransitionInfoList" parameterType="ScTransitionInfo" resultMap="ScTransitionInfoResult">
<include refid="selectScTransitionInfoVo"/>
<where>
<if test="sheepId != null ">and sheep_id = #{sheepId}</if>
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%')
</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}
and t.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
</select>
@@ -78,6 +90,21 @@
</trim>
</insert>
<insert id="insertScTransitionInfoBatch">
INSERT INTO sc_transition_info (
sheep_id, variety_id, trans_to, trans_from,
trans_type, technician, status, comment,
create_by, create_time
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.sheepId}, #{item.varietyId}, #{item.transTo}, #{item.transFrom},
#{item.transType}, #{item.technician}, #{item.status}, #{item.comment},
#{item.createBy}, now()
)
</foreach>
</insert>
<update id="updateScTransitionInfo" parameterType="ScTransitionInfo">
update sc_transition_info
<trim prefix="SET" suffixOverrides=",">

View File

@@ -7,7 +7,7 @@
<resultMap type="ScCastrate" id="ScCastrateResult">
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manageTags"/> <!-- 新增耳号映射 -->
<result property="manageTags" column="manageTags"/>
<result property="sheepfold" column="sheepfold"/>
<result property="sheepfoldName" column="sheepfoldName"/>
<result property="varietyId" column="variety_id"/>
@@ -21,17 +21,17 @@
<sql id="selectScCastrateVo">
select sc.id,
sc.sheep_id,
bs.manage_tags as manageTags, -- 关联羊只表的耳号
bs.manage_tags as manageTags,
sc.sheepfold,
sf.sheepfold_name as sheepfoldName,
sc.variety_id,
bv.variety as varietyName,
bv.variety as varietyName,
sc.comment,
sc.technician,
sc.create_by,
sc.create_time
from sc_castrate sc
left join bas_sheep bs on sc.sheep_id = bs.id -- 关联羊只表获取耳号
left join bas_sheep bs on sc.sheep_id = bs.id
left join da_sheepfold sf on sc.sheepfold = sf.id
left join bas_sheep_variety bv on sc.variety_id = bv.id
</sql>
@@ -39,13 +39,13 @@
<select id="selectScCastrateList" parameterType="ScCastrate" resultMap="ScCastrateResult">
<include refid="selectScCastrateVo"/>
<where>
<!-- 替换原sheepId条件为耳号条件 -->
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
<if test="sheepfold != null ">and sc.sheepfold = #{sheepfold}</if>
<if test="varietyId != null">and sc.variety_id = #{varietyId}</if>
<if test="technician != null and technician != ''">and sc.technician like concat('%', #{technician}, '%')</if>
<if test="technician != null and technician != ''">and sc.technician like concat('%', #{technician}, '%')
</if>
<if test="params.beginCreateTime != null and params.endCreateTime != null">
and sc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>

View File

@@ -42,7 +42,7 @@
and fh.variety_id = #{varietyId}
</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}
and fh.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')