Merge remote-tracking branch 'main/main'

# Conflicts:
#	zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScPregnancyRecordMapper.java
#	zhyc-module/src/main/java/com/zhyc/module/produce/other/mapper/ScFixHoofMapper.java
This commit is contained in:
2025-07-23 10:24:40 +08:00
28 changed files with 1158 additions and 185 deletions

View File

@@ -92,7 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="selectBasSheepById" parameterType="java.lang.Long" resultType="BasSheep">
<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,
@@ -119,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<insert id="insertBasSheep" parameterType="BasSheep" useGeneratedKeys="true" keyProperty="id">
insert into bas_sheep
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@@ -0,0 +1,56 @@
<?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.BasSheepTypeMapper">
<resultMap type="BasSheepType" id="BasSheepTypeResult">
<result property="id" column="id" />
<result property="name" column="name" />
</resultMap>
<sql id="selectBasSheepTypeVo">
select id, name from bas_sheep_type
</sql>
<select id="selectBasSheepTypeList" parameterType="BasSheepType" resultMap="BasSheepTypeResult">
<include refid="selectBasSheepTypeVo"/>
<where>
<if test="name != null and name != ''"> and name = #{name}</if>
</where>
</select>
<select id="selectBasSheepTypeById" parameterType="Integer" resultMap="BasSheepTypeResult">
<include refid="selectBasSheepTypeVo"/>
where id = #{id}
</select>
<insert id="insertBasSheepType" parameterType="BasSheepType" useGeneratedKeys="true" keyProperty="id">
insert into bas_sheep_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
</trim>
</insert>
<update id="updateBasSheepType" parameterType="BasSheepType">
update bas_sheep_type
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBasSheepTypeById" parameterType="Integer">
delete from bas_sheep_type where id = #{id}
</delete>
<delete id="deleteBasSheepTypeByIds" parameterType="String">
delete from bas_sheep_type where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -53,4 +53,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="selectIdByName" parameterType="string" resultType="java.lang.Long">
SELECT id
FROM bas_sheep_variety
WHERE variety = #{varietyName}
LIMIT 1
</select>
</mapper>

View File

@@ -1,60 +1,147 @@
<?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.breed.mapper.ScPregnancyRecordMapper">
<resultMap type="ScPregnancyRecord" id="ScPregnancyRecordResult">
<result property="id" column="id" />
<result property="sheepId" column="sheep_id" />
<result property="manageTags" column="manage_tags" />
<result property="datetime" column="datetime" />
<result property="result" column="result" />
<result property="number" column="number" />
<result property="fetusCount" column="fetus_count" />
<result property="technician" column="technician" />
<result property="way" column="way" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="create_by" />
<result property="updateTime" column="create_time" />
<!-- 关联羊只信息字段 -->
<result property="variety" column="variety" />
<result property="monthAge" column="month_age" />
<result property="parity" column="parity" />
<result property="matingCounts" column="mating_counts" />
<result property="sheepfoldName" column="sheepfold_name" />
<result property="breedStatus" column="breed" />
<result property="fatherManageTags" column="father_manage_tags" />
<result property="fatherVariety" column="father_variety" />
<result property="matingTypeName" column="mating_type_name" />
<result property="matingDate" column="mating_date" />
<result property="expectedDate" column="expected_date" />
<result property="lastEventDate" column="last_event_date" />
<result property="ranchName" column="ranch" />
</resultMap>
<sql id="selectScPregnancyRecordVo">
select id, datetime, result, number, technician, way, create_by, create_time from sc_pregnancy_record
select
pr.id,
pr.sheep_id,
pr.datetime,
pr.result,
pr.fetus_count,
pr.technician,
pr.way,
pr.remark,
pr.create_by,
pr.create_time,
pr.create_by,
pr.create_time,
sf.bs_manage_tags as manage_tags,
sf.variety,
sf.month_age,
sf.parity,
sf.mating_counts,
sf.sheepfold_name,
sf.breed,
sf.father_manage_tags,
father_sf.variety as father_variety,
mating_type.dict_label as mating_type_name,
sf.mating_date,
sf.expected_date,
sf.lambing_date as last_event_date,
r.ranch as ranch
from sc_pregnancy_record pr
left join sheep_file sf on pr.sheep_id = sf.id
left join sys_dict_data mating_type on sf.mating_type_id = mating_type.dict_value and mating_type.dict_type = 'breed_type' and mating_type.status = '0'
left join da_ranch r on sf.ranch_id = r.id
left join sheep_file father_sf on sf.bs_father_id = father_sf.id
</sql>
<select id="selectScPregnancyRecordList" parameterType="ScPregnancyRecord" resultMap="ScPregnancyRecordResult">
<include refid="selectScPregnancyRecordVo"/>
<where>
<if test="datetime != null "> and datetime = #{datetime}</if>
<if test="result != null and result != ''"> and result = #{result}</if>
<if test="number != null "> and number = #{number}</if>
<if test="technician != null and technician != ''"> and technician = #{technician}</if>
<if test="way != null "> and way = #{way}</if>
<where>
pr.is_delete = 0
<if test="manageTags != null and manageTags != ''">
<choose>
<when test="manageTags.contains(',')">
and sf.bs_manage_tags in
<foreach item="tag" collection="manageTags.split(',')" open="(" separator="," close=")">
#{tag}
</foreach>
</when>
<otherwise>
and sf.bs_manage_tags like concat('%', #{manageTags}, '%')
</otherwise>
</choose>
</if>
<if test="datetime != null "> and pr.datetime = #{datetime}</if>
<if test="result != null and result != ''"> and pr.result = #{result}</if>
<if test="technician != null and technician != ''"> and pr.technician like concat('%', #{technician}, '%')</if>
<if test="way != null and way != ''"> and pr.way = #{way}</if>
</where>
order by pr.create_time desc
</select>
<select id="selectScPregnancyRecordById" parameterType="Long" resultMap="ScPregnancyRecordResult">
<include refid="selectScPregnancyRecordVo"/>
where id = #{id}
where pr.id = #{id} and pr.is_delete = 0
</select>
<!-- 根据耳号查询羊只信息 -->
<select id="selectSheepByManageTags" parameterType="String" resultType="map">
select
id,
bs_manage_tags as manageTags,
variety,
month_age as monthAge,
parity,
mating_counts as matingCounts,
sheepfold_name as sheepfoldName,
breed as breedStatus
from sheep_file
where bs_manage_tags = #{manageTags}
and is_delete = 0
limit 1
</select>
<insert id="insertScPregnancyRecord" parameterType="ScPregnancyRecord" useGeneratedKeys="true" keyProperty="id">
insert into sc_pregnancy_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="datetime != null">datetime,</if>
<if test="result != null">result,</if>
<if test="number != null">number,</if>
<if test="fetusCount != null">fetus_count,</if>
<if test="technician != null">technician,</if>
<if test="way != null">way,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
is_delete
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="datetime != null">#{datetime},</if>
<if test="result != null">#{result},</if>
<if test="number != null">#{number},</if>
<if test="fetusCount != null">#{fetusCount},</if>
<if test="technician != null">#{technician},</if>
<if test="way != null">#{way},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
0
</trim>
</insert>
<update id="updateScPregnancyRecord" parameterType="ScPregnancyRecord">
@@ -62,23 +149,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="datetime != null">datetime = #{datetime},</if>
<if test="result != null">result = #{result},</if>
<if test="number != null">number = #{number},</if>
<if test="fetusCount != null">fetus_count = #{fetusCount},</if>
<if test="technician != null">technician = #{technician},</if>
<if test="way != null">way = #{way},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null">create_by = #{updateBy},</if>
<if test="updateTime != null">create_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteScPregnancyRecordById" parameterType="Long">
delete from sc_pregnancy_record where id = #{id}
</delete>
<update id="deleteScPregnancyRecordById" parameterType="Long">
update sc_pregnancy_record set is_delete = 1 where id = #{id}
</update>
<delete id="deleteScPregnancyRecordByIds" parameterType="String">
delete from sc_pregnancy_record where id in
<update id="deleteScPregnancyRecordByIds" parameterType="String">
update sc_pregnancy_record set is_delete = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</update>
<!-- 更新羊只基础表中的孕检相关字段 -->
<update id="updateSheepPregnancyInfo" parameterType="map">
update bas_sheep
<set>
<if test="pregDate != null">preg_date = #{pregDate},</if>
<if test="breedStatusId != null">breed_status_id = #{breedStatusId},</if>
<if test="expectedDate != null">expected_date = #{expectedDate},</if>
<if test="gestationDay != null">gestation_day = #{gestationDay},</if>
create_time = now()
</set>
where id = #{sheepId}
</update>
</mapper>

View File

@@ -7,6 +7,7 @@
<resultMap type="ScTransGroup" id="ScTransGroupResult">
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manageTags"/>
<result property="foldTo" column="fold_to"/>
<result property="foldFrom" column="fold_from"/>
<result property="reason" column="reason"/>
@@ -22,6 +23,7 @@
<sql id="selectScTransGroupVo">
SELECT tg.id,
tg.sheep_id,
s.manage_tags AS manageTags,
tg.fold_to,
tg.fold_from,
tg.reason,
@@ -35,6 +37,7 @@
sf_from.sheepfold_name AS foldFromName,
sf_to.sheepfold_name AS foldToName
FROM sc_trans_group tg
LEFT JOIN bas_sheep s ON tg.sheep_id = s.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
@@ -44,6 +47,9 @@
<include refid="selectScTransGroupVo"/>
<where>
<if test="sheepId != null">and sheep_id = #{sheepId}</if>
<if test="manageTags != null and manageTags != ''">
and s.manage_tags like concat('%', #{manageTags}, '%')
</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>

View File

@@ -7,9 +7,12 @@
<resultMap type="ScCastrate" id="ScCastrateResult">
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manageTags"/> <!-- 新增耳号映射 -->
<result property="sheepfold" column="sheepfold"/>
<result property="comment" column="comment"/>
<result property="sheepfoldName" column="sheepfoldName"/>
<result property="varietyId" column="variety_id"/>
<result property="varietyName" column="varietyName"/>
<result property="comment" column="comment"/>
<result property="technician" column="technician"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
@@ -18,15 +21,17 @@
<sql id="selectScCastrateVo">
select sc.id,
sc.sheep_id,
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 da_sheepfold sf on sc.sheepfold = sf.id
left join bas_sheep_variety bv on sc.variety_id = bv.id
</sql>
@@ -34,16 +39,16 @@
<select id="selectScCastrateList" parameterType="ScCastrate" resultMap="ScCastrateResult">
<include refid="selectScCastrateVo"/>
<where>
<if test="sheepId != null and sheepId != ''">and sheep_id like concat('%', #{sheepId}, '%')</if>
<if test="sheepfold != null ">and sheepfold like concat('%', #{sheepfold}, '%')</if>
<if test="varietyId != null">
and sc.variety_id = #{varietyId}
<!-- 替换原sheepId条件为耳号条件 -->
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
<if test="technician != null and technician != ''">and technician like concat('%', #{technician}, '%')</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 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="params.beginCreateTime != null and params.endCreateTime != null">
and sc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
</select>

View File

@@ -6,8 +6,9 @@
<resultMap type="ScFixHoof" id="ScFixHoofResult">
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manageTags"/>
<result property="sheepfold" column="sheepfold"/>
<result property="varietyId" column="variety_id"/>
<result property="sheepfoldName" column="sheepfoldName"/>
<result property="comment" column="comment"/>
<result property="technician" column="technician"/>
@@ -17,15 +18,19 @@
<sql id="selectScFixHoofVo">
select fh.id,
fh.sheep_id,
bs.manage_tags AS manageTags,
fh.sheepfold,
sf.sheepfold_name as sheepfoldName,
sf.sheepfold_name AS sheepfoldName,
fh.variety_id,
bv.variety AS varietyName,
fh.comment,
fh.technician,
fh.create_by,
fh.create_time
from sc_fix_hoof fh
left join bas_sheep bs on fh.sheep_id = bs.id
left join da_sheepfold sf on fh.sheepfold = sf.id
left join bas_sheep_variety bv on fh.variety_id = bv.id
</sql>
<select id="selectScFixHoofList" parameterType="ScFixHoof" resultMap="ScFixHoofResult">
@@ -33,9 +38,15 @@
<where>
<if test="sheepId != null ">and sheep_id = #{sheepId}</if>
<if test="sheepfold != null ">and sheepfold = #{sheepfold}</if>
<if test="varietyId != null">
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}
</if>
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
</where>
</select>
@@ -44,24 +55,24 @@
where fh.id = #{id}
</select>
<insert id="insertScFixHoof" parameterType="ScFixHoof" useGeneratedKeys="true" keyProperty="id">
insert into sc_fix_hoof
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null and sheepId != ''">and fh.sheep_id like concat('%', #{sheepId}, '%')</if>
<if test="sheepfold != null">and fh.sheepfold = #{sheepfold}</if>
<if test="comment != null">comment,</if>
<if test="technician != null and technician != ''">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="sheepfold != null">#{sheepfold},</if>
<if test="comment != null">#{comment},</if>
<if test="technician != null and technician != ''">#{technician},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
<insert id="insertScFixHoof" parameterType="ScFixHoof"
useGeneratedKeys="true" keyProperty="id">
INSERT INTO sc_fix_hoof
(sheep_id,
sheepfold,
variety_id,
<if test="comment != null">comment,</if>
<if test="technician != null and technician != ''">technician,</if>
create_by,
create_time)
VALUES
(#{sheepId},
#{sheepfold},
<if test="varietyId != null">#{varietyId},</if>
<if test="comment != null">#{comment},</if>
<if test="technician != null and technician != ''">#{technician},</if>
#{createBy},
#{createTime})
</insert>
<update id="updateScFixHoof" parameterType="ScFixHoof">
@@ -69,6 +80,7 @@
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="sheepfold != null">sheepfold = #{sheepfold},</if>
<if test="varietyId != null">variety_id=#{varietyId},</if>
<if test="comment != null">comment = #{comment},</if>
<if test="technician != null and technician != ''">technician = #{technician},</if>
<if test="createBy != null">create_by = #{createBy},</if>
@@ -89,4 +101,6 @@
#{id}
</foreach>
</delete>
</mapper>