Merge remote-tracking branch 'origin/main'

# Conflicts:
#	zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/impl/ScSheepDeathServiceImpl.java
This commit is contained in:
zyk
2025-08-24 00:37:48 +08:00
73 changed files with 1701 additions and 386 deletions

View File

@@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
m.id,
m.sheep_id,
m.group_id,
bsg.group_name,
s.id AS bs_sheep_id,
s.bs_manage_tags,
s.variety,
@@ -47,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
s.family
FROM bas_sheep_group_mapping m
JOIN sheep_file s ON s.id = m.sheep_id
JOIN bas_sheep_group bsg ON m.group_id = bsg.group_id
<where>
<if test="sheepId != null"> AND m.sheep_id = #{sheepId}</if>
<if test="groupId != null"> AND m.group_id = #{groupId}</if>
@@ -125,4 +127,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM bas_sheep_group_mapping
WHERE group_id = #{groupId}
</select>
<!-- 树形分组 -->
<select id="selectGroupTree"
resultType="com.zhyc.module.base.domain.BasGroupTreeVo">
SELECT group_id AS groupId,
group_name AS groupName,
parent_id AS parentId
FROM bas_sheep_group
ORDER BY parent_id, group_id
</select>
</mapper>

View File

@@ -328,7 +328,7 @@
SELECT COUNT(*)
FROM bas_sheep
WHERE manage_tags = #{tag}
AND s.is_delete = 0
AND is_delete = 0
</select>
<select id="existsByElectronicTag" resultType="int">

View File

@@ -25,6 +25,7 @@
columns,
comment
from da_sheepfold
</sql>
<select id="selectDaSheepfoldList" parameterType="DaSheepfold" resultMap="DaSheepfoldResult">
@@ -33,6 +34,10 @@
<if test="ranchId != null ">and ranch_id = #{ranchId}</if>
<if test="sheepfoldTypeId != null ">and sheepfold_type_id = #{sheepfoldTypeId}</if>
</where>
order by
SUBSTRING_INDEX(row_no, '-', 1),
CAST(columns AS UNSIGNED)
</select>
<select id="selectDaSheepfoldById" parameterType="Long" resultMap="DaSheepfoldResult">

View File

@@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
<if test="technical != null and technical != ''"> and technical = #{technical}</if>
</where>
ORDER BY datetime DESC
</select>
<select id="selectDewormById" parameterType="Long" resultMap="DewormResult">

View File

@@ -52,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="treatDay != null "> and treat_day = #{treatDay}</if>
<if test="sheepfoldId != null "> and sd.sheepfold_id = #{sheepfoldId}</if>
</where>
ORDER BY datetime DESC
</select>
<select id="selectDiagnosisById" parameterType="Long" resultMap="DiagnosisResult">

View File

@@ -28,16 +28,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectDisinfectList" parameterType="Disinfect" resultMap="DisinfectResult">
<include refid="selectDisinfectVo"/>
<where>
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
<if test="datetime != null "> and datetime = #{datetime}</if>
<if test="technician != null and technician != ''"> and technician = #{technician}</if>
<if test="way != null and way != ''"> and way = #{way}</if>
<if test="usageId != null "> and usage_id = #{usageId}</if>
<if test="ratio != null and ratio != ''"> and ratio = #{ratio}</if>
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
</where>
SELECT sd.id,
sd.sheepfold_id,
sd.datetime,
sd.technician,
sd.way,
sd.usage_id,
sd.ratio,
sd.comment,
sd.update_by,
sd.update_time,
sd.create_by,
sd.create_time,
ds.sheepfold_name
FROM sw_disinfect sd
LEFT JOIN da_sheepfold ds ON ds.id = sd.sheepfold_id
WHERE 1 = 1
<if test="sheepfoldId != null"> AND sd.sheepfold_id = #{sheepfoldId}</if>
<if test="datetime != null"> AND sd.datetime = #{datetime}</if>
<if test="technician != null and technician != ''"> AND sd.technician = #{technician}</if>
<if test="way != null and way != ''"> AND sd.way = #{way}</if>
<if test="usageId != null"> AND sd.usage_id = #{usageId}</if>
<if test="ratio != null and ratio != ''"> AND sd.ratio = #{ratio}</if>
<if test="comment != null and comment != ''"> AND sd.comment = #{comment}</if>
<!-- 子表过滤条件:仅保留满足药品名称的记录 -->
<if test="mediName != null and mediName != ''">
AND EXISTS (
SELECT 1
FROM sw_medicine_usage_details mud
JOIN sw_medicine sm ON sm.id = mud.medi_id
WHERE mud.medi_usage = sd.usage_id
AND sm.name like concat('%',#{mediName},'%')
)
</if>
ORDER BY datetime DESC
</select>
<select id="selectDisinfectById" parameterType="Long" resultMap="DisinfectResult">
@@ -71,7 +96,7 @@ 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 sd.id = #{id}
where id = #{id}
</update>
<delete id="deleteDisinfectById" parameterType="Long">

View File

@@ -39,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="datetime != null "> and datetime = #{datetime}</if>
<if test="technical != null and technical != ''"> and technical = #{technical}</if>
</where>
ORDER BY datetime DESC
</select>
<select id="selectHealthById" parameterType="Long" resultMap="HealthResult">

View File

@@ -39,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
<if test="technical != null and technical != ''"> and technical = #{technical}</if>
</where>
ORDER BY datetime DESC
</select>
<select id="selectImmunityById" parameterType="Long" resultMap="ImmunityResult">

View File

@@ -30,11 +30,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectQuarantineReportVo">
select sqr.id, sheep_type,sheep_id, datetime, quar_item, sample_type, sampler, quar_officer, result, status,
select sqr.id, sheep_type,sqr.gender,sqr.parity,sqr.breed,sqr.month_age,sheep_id, datetime, quar_item, sample_type, sampler, quar_officer, result, status,
sqr.update_by, sqr.update_time, sqr.create_by, sqr.create_time,
sqi.name as item_name,
sqs.name as sample,
sf.bs_manage_tags sheep_no,sf.gender,sf.parity,sf.breed,sf.month_age
sf.bs_manage_tags sheep_no
from sw_quarantine_report sqr
left join sw_quarantine_items sqi on sqr.quar_item = sqi.id
left join sw_quarantine_sample sqs on sqr.sample_type = sqs.id
@@ -48,10 +48,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
<if test="quarItem != null "> and quar_item = #{quarItem}</if>
<if test="sampleType != null "> and sample_type = #{sampleType}</if>
<if test="sampler != null and sampler != ''"> and sampler = #{sampler}</if>
<if test="quarOfficer != null and quarOfficer != ''"> and quar_officer = #{quarOfficer}</if>
<if test="sampler != null and sampler != ''"> and sampler like concat('%',#{sampler},'%') </if>
<if test="quarOfficer != null and quarOfficer != ''"> and quar_officer like concat('%',#{quarOfficer},'%')</if>
<if test="result != null "> and result = #{result}</if>
<if test="status != null "> and status = #{status}</if>
<if test="sheepType != null and sheepType!= ''"> and sqr.sheep_type=#{sheepType}</if>
</where>
</select>
@@ -67,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sw_quarantine_sample sqs on sqr.sample_type = sqs.id
left join sheep_file sf on sqr.sheep_id = sf.id
where sqr.id = #{id}
ORDER BY datetime DESC
</select>
<insert id="insertQuarantineReport" parameterType="java.util.List">

View File

@@ -7,6 +7,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="SwMedicineUsage" id="SwMedicineUsageResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="sheepfoldId" column="sheepfold_id"/>
<result property="sheepfoldName" column="sheepfold_name"/>
<result property="sheepId" column="sheep_id"/>
<result property="sheepNo" column="sheep_no"/>
<result property="datetime" column="datetime"/>
<result property="useType" column="use_type" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
@@ -31,7 +36,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectSwMedicineUsageVo">
select id, name, use_type, update_by, update_time, create_by, create_time from sw_medicine_usage
select smu.id, sheepfold as sheepfold_id,sheep sheep_id,name, datetime,use_type, smu.update_by, smu.update_time, smu.create_by, smu.create_time,
ds.sheepfold_name,
bs.manage_tags sheep_no
from sw_medicine_usage smu
left join da_sheepfold ds on ds.id = smu.sheepfold
left join bas_sheep bs on bs.id = smu.sheep
</sql>
<select id="selectSwMedicineUsageList" parameterType="SwMedicineUsage" resultMap="SwMedicineUsageResult">
@@ -39,8 +49,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="useType != null and useType != ''"> and use_type = #{useType}</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="sheepNo != null and sheepNo != ''"> and bs.manage_tags like concat('%', #{sheepNo}, '%')</if>
<if test="params.beginUseTime != null and params.beginUseTime != '' and params.endUseTime != null and params.endUseTime != ''"> and smu.datetime between #{params.beginUseTime} and #{params.endUseTime}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and smu.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if> <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and smu.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where>
ORDER BY datetime DESC
</select>
<select id="selectSwMedicineUsageById" parameterType="Integer" resultMap="SwMedicineUsageSwMedicineUsageDetailsResult">
@@ -55,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from sw_medicine_usage_details smud
join sw_medicine sm on smud.medi_id = sm.id
where medi_usage = #{medi_usage}
</select>
<insert id="insertSwMedicineUsage" parameterType="SwMedicineUsage" useGeneratedKeys="true" keyProperty="id">
@@ -62,6 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="useType != null">use_type,</if>
<if test="sheepfoldId != null">sheepfold,</if>
<if test="sheepId != null">sheep,</if>
<if test="datetime != null">datetime,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
@@ -70,6 +87,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="useType != null">#{useType},</if>
<if test="sheepfoldId != null">#{sheepfoldId},</if>
<if test="sheepId != null">#{sheepId},</if>
<if test="datetime != null">#{datetime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>

View File

@@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="diseaseId != null "> and disease_id = #{diseaseId}</if>
<if test="veterinary != null and veterinary != ''"> and veterinary = #{veterinary}</if>
</where>
ORDER BY datetime DESC
</select>
<select id="selectTreatmentById" parameterType="Long" resultMap="TreatmentResult">

View File

@@ -0,0 +1,70 @@
<?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.feed.mapper.SgFeedListMapper">
<resultMap type="SgFeedList" id="SgFeedListResult">
<result property="id" column="id" />
<result property="formulaId" column="formula_id" />
<result property="formulaBatchId" column="formula_batch_id" />
<result property="zookeeper" column="zookeeper" />
<result property="deployDate" column="deploy_date" />
</resultMap>
<sql id="selectSgFeedListVo">
select id, formula_id, formula_batch_id, zookeeper, deploy_date from sg_feed_list
</sql>
<select id="selectSgFeedListList" parameterType="SgFeedList" resultMap="SgFeedListResult">
<include refid="selectSgFeedListVo"/>
<where>
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if>
<if test="zookeeper != null and zookeeper != ''"> and zookeeper = #{zookeeper}</if>
<if test="deployDate != null "> and deploy_date = #{deployDate}</if>
</where>
</select>
<select id="selectSgFeedListById" parameterType="Long" resultMap="SgFeedListResult">
<include refid="selectSgFeedListVo"/>
where id = #{id}
</select>
<insert id="insertSgFeedList" parameterType="SgFeedList" useGeneratedKeys="true" keyProperty="id">
insert into sg_feed_list
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="formulaId != null">formula_id,</if>
<if test="formulaBatchId != null">formula_batch_id,</if>
<if test="zookeeper != null">zookeeper,</if>
<if test="deployDate != null">deploy_date,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="formulaId != null">#{formulaId},</if>
<if test="formulaBatchId != null">#{formulaBatchId},</if>
<if test="zookeeper != null">#{zookeeper},</if>
<if test="deployDate != null">#{deployDate},</if>
</trim>
</insert>
<update id="updateSgFeedList" parameterType="SgFeedList">
update sg_feed_list
<trim prefix="SET" suffixOverrides=",">
<if test="formulaId != null">formula_id = #{formulaId},</if>
<if test="formulaBatchId != null">formula_batch_id = #{formulaBatchId},</if>
<if test="zookeeper != null">zookeeper = #{zookeeper},</if>
<if test="deployDate != null">deploy_date = #{deployDate},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSgFeedListById" parameterType="Long">
delete from sg_feed_list where id = #{id}
</delete>
<delete id="deleteSgFeedListByIds" parameterType="String">
delete from sg_feed_list where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -102,6 +102,7 @@
and sm.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
ORDER BY sm.create_time DESC
</select>
<select id="selectScBodyMeasureById" parameterType="Long" resultMap="ScBodyMeasureResult">

View File

@@ -58,6 +58,7 @@
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
</where>
ORDER BY sbs.create_time DESC
</select>
<select id="selectScBodyScoreById" parameterType="Long" resultMap="ScBodyScoreResult">

View File

@@ -56,6 +56,7 @@
and sbr.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
ORDER BY sbr.create_time DESC
</select>
<select id="selectScBreastRatingById" parameterType="Long" resultMap="ScBreastRatingResult">

View File

@@ -18,6 +18,8 @@
<result property="parity" column="parity"/>
<result property="varietyId" column="variety_id"/>
<result property="varietyName" column="varietyName"/>
<result property="typeId" column="type_id"/>
<result property="typeName" column="type_name"/>
<result property="joinDate" column="join_date"/>
<result property="comment" column="comment"/>
<result property="technician" column="technician"/>
@@ -29,10 +31,12 @@
SELECT
sas.*,
sf.sheepfold_name AS sheepfoldName,
bv.variety AS varietyName
bv.variety AS varietyName,
st.type_name AS typeName
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 bas_sheep_type st ON sas.type_id = st.id
<where>
<if test="earNumber != null and earNumber != ''">
AND sas.ear_number LIKE CONCAT('%', #{earNumber}, '%')
@@ -43,6 +47,9 @@
<if test="varietyId != null">
AND sas.variety_id = #{varietyId}
</if>
<if test="typeId != null">
AND sas.type_id = #{typeId}
</if>
</where>
</select>
@@ -54,18 +61,19 @@
<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})
(ear_number, sheepfold, ranch_id, father, mother, born_weight, birthday,
gender, parity, variety_id, type_id, join_date, comment, technician,
create_by, create_time)
VALUES (#{earNumber}, #{sheepfold}, #{ranchId}, #{father}, #{mother}, #{bornWeight},
#{birthday}, #{gender}, #{parity}, #{varietyId}, #{typeId}, #{joinDate},
#{comment}, #{technician}, #{createBy}, #{createTime})
</insert>
<update id="updateScAddSheep" parameterType="ScAddSheep">
UPDATE sc_add_sheep
<set>
ear_number = #{earNumber},
ranch_id = #{ranchId},
sheepfold = #{sheepfold},
father = #{father},
mother = #{mother},
@@ -74,6 +82,7 @@
gender = #{gender},
parity = #{parity},
variety_id = #{varietyId},
type_id = #{typeId},
join_date = #{joinDate},
comment = #{comment},
technician = #{technician},

View File

@@ -8,6 +8,8 @@
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manage_tags"/>
<result property="sheepfoldName" column="sheepfold_name"/>
<result property="eventType" column="event_type"/>
<result property="newComment" column="new_comment"/>
<result property="oldComment" column="old_comment"/>
<result property="createBy" column="create_by"/>
@@ -17,13 +19,16 @@
<sql id="selectScChangeCommentVo">
select scc.id,
scc.sheep_id,
bs.manage_tags as manage_tags,
bs.manage_tags as manage_tags,
sf.sheepfold_name as sheepfold_name,
'改备注' as event_type,
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
left join da_sheepfold sf on bs.sheepfold_id = sf.id
</sql>
<select id="selectScChangeCommentList" parameterType="ScChangeComment" resultMap="ScChangeCommentResult">
@@ -32,6 +37,7 @@
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
<if test="sheepfoldId != null">and bs.sheepfold_id = #{sheepfoldId}</if>
<if test="newComment != null and newComment != ''">
and scc.new_comment like concat('%', #{newComment}, '%')
</if>
@@ -43,6 +49,7 @@
and scc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
ORDER BY scc.create_time DESC
</select>
<select id="selectScChangeCommentById" parameterType="Long" resultMap="ScChangeCommentResult">

View File

@@ -8,6 +8,8 @@
<result property="id" column="sce_id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manage_tags"/>
<result property="sheepfoldName" column="sheepfold_name"/>
<result property="eventType" column="event_type"/>
<result property="earType" column="ear_type"/>
<result property="newTag" column="newTag"/>
<result property="oldTag" column="oldTag"/>
@@ -20,6 +22,12 @@
select sce.id as sce_id,
sce.sheep_id,
bs.manage_tags as manage_tags,
sf.sheepfold_name as sheepfold_name,
case
when sce.ear_type = 0 then '改电子耳号'
when sce.ear_type = 1 then '改管理耳号'
else ''
end as event_type,
sce.ear_type,
sce.newTag,
sce.oldTag as oldTag,
@@ -28,6 +36,7 @@
sce.create_time
from sc_change_ear sce
LEFT JOIN bas_sheep bs ON sce.sheep_id = bs.id
LEFT JOIN da_sheepfold sf ON bs.sheepfold_id = sf.id
</sql>
<select id="selectScChangeEarList" parameterType="ScChangeEar" resultMap="ScChangeEarResult">
@@ -37,6 +46,10 @@
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%')
</if>
<if test="sheepfoldId != null">and bs.sheepfold_id = #{sheepfoldId}</if>
<if test="sheepfoldName != null and sheepfoldName != ''">
and sf.sheepfold_name LIKE CONCAT('%', #{sheepfoldName}, '%')
</if>
<if test="earType != null ">and sce.ear_type = #{earType}</if>
<if test="newTag != null and newTag != ''">
and sce.newTag LIKE CONCAT('%', #{newTag}, '%')
@@ -48,6 +61,7 @@
and sce.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
ORDER BY sce.create_time DESC
</select>
<select id="selectScChangeEarById" parameterType="Integer" resultMap="ScChangeEarResult">

View File

@@ -8,6 +8,8 @@
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manage_tags"/>
<result property="sheepfoldName" column="sheepfold_name"/>
<result property="eventType" column="event_type"/>
<result property="varietyOld" column="variety_old"/>
<result property="varietyNew" column="variety_new"/>
<result property="comment" column="comment"/>
@@ -18,7 +20,9 @@
<sql id="selectScChangeVarietyVo">
select scv.id,
scv.sheep_id,
bs.manage_tags as manage_tags,
bs.manage_tags as manage_tags,
sf.sheepfold_name as sheepfold_name,
'改品种' as event_type,
scv.variety_old,
scv.variety_new,
scv.comment,
@@ -26,6 +30,7 @@
scv.create_time
from sc_change_variety scv
left join bas_sheep bs on scv.sheep_id = bs.id
left join da_sheepfold sf on bs.sheepfold_id = sf.id
</sql>
<select id="selectScChangeVarietyList" parameterType="ScChangeVariety" resultMap="ScChangeVarietyResult">
@@ -35,6 +40,7 @@
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
<if test="sheepfoldId != null">and bs.sheepfold_id = #{sheepfoldId}</if>
<if test="varietyOld != null and varietyOld != ''">
and scv.variety_old like concat('%', #{varietyOld}, '%')
</if>
@@ -46,6 +52,7 @@
and scv.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
ORDER BY scv.create_time DESC
</select>
<select id="selectScChangeVarietyById" parameterType="Integer" resultMap="ScChangeVarietyResult">

View File

@@ -25,18 +25,22 @@
SELECT tg.id,
tg.sheep_id,
s.manage_tags AS manageTags,
tg.event_type AS eventType,
tg.trans_date AS transDate,
tg.fold_to,
tg.fold_from,
tg.reason,
tg.variety_id,
bv.variety AS varietyName,
tg.technician,
st.id AS sheepTypeId,
st.name AS sheepTypeName,
tg.status,
tg.comment,
tg.create_by,
tg.create_time,
sf_from.sheepfold_name AS foldFromName,
sf_to.sheepfold_name AS foldToName,
tg.technician,
st.id AS sheepTypeId,
st.name AS sheepTypeName
FROM sc_trans_group tg
@@ -54,14 +58,20 @@
<if test="manageTags != null and manageTags != ''">
and s.manage_tags like concat('%', #{manageTags}, '%')
</if>
<if test="eventType != null">and tg.event_type = #{eventType}</if>
<if test="params.beginTransDate != null and params.beginTransDate != '' and params.endTransDate != null and params.endTransDate != ''">
and tg.trans_date between #{params.beginTransDate} and #{params.endTransDate}
</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="varietyId != null">and tg.variety_id = #{varietyId}</if>
<if test="sheepTypeId != null">and st.id = #{sheepTypeId}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and tg.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
ORDER BY tg.create_time DESC
</select>
@@ -75,6 +85,8 @@
insert into sc_trans_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sheepId != null">sheep_id,</if>
<if test="eventType != null">event_type,</if>
<if test="transDate != null and transDate != ''">trans_date,</if>
<if test="foldTo != null and foldTo != ''">fold_to,</if>
<if test="foldFrom != null and foldFrom != ''">fold_from,</if>
<if test="varietyId != null">variety_id,</if>
@@ -87,6 +99,8 @@
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if>
<if test="eventType != null">#{eventType},</if>
<if test="transDate != null and transDate != ''">#{transDate},</if>
<if test="foldTo != null and foldTo != ''">#{foldTo},</if>
<if test="foldFrom != null and foldFrom != ''">#{foldFrom},</if>
<if test="varietyId != null">#{varietyId},</if>
@@ -103,6 +117,8 @@
update sc_trans_group
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="eventType != null">event_type = #{eventType},</if>
<if test="transDate != null and transDate != ''">trans_date = #{transDate},</if>
<if test="foldTo != null and foldTo != ''">fold_to = #{foldTo},</if>
<if test="foldFrom != null and foldFrom != ''">fold_from = #{foldFrom},</if>
<if test="varietyId != null">variety_id = #{varietyId},</if>

View File

@@ -6,12 +6,14 @@
<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="eventType" column="event_type"/>
<result property="varietyId" column="variety_id"/>
<result property="varietyName" column="varietyName"/>
<result property="transTo" column="trans_to"/>
<result property="transFrom" column="trans_from"/>
<result property="transType" column="trans_type"/>
<result property="transTypeText" column="transTypeText"/>
<result property="transitionDate" column="transition_date"/>
<result property="technician" column="technician"/>
<result property="status" column="status"/>
<result property="comment" column="comment"/>
@@ -21,20 +23,22 @@
<sql id="selectScTransitionInfoVo">
SELECT t.*,
bv.variety AS varietyName,
bs.manage_tags AS manageTags,
bv.variety AS varietyName,
bs.manage_tags AS manageTags,
t.event_type AS eventType,
t.transition_date AS transitionDate,
CASE t.trans_type
WHEN 0 THEN '内部调拨'
WHEN 1 THEN '内部销售'
WHEN 2 THEN '育肥调拨'
ELSE '未知'
END AS transTypeText,
END AS transTypeText,
CASE t.status
WHEN 0 THEN '待审批'
WHEN 1 THEN '已通过'
WHEN 2 THEN '已驳回'
ELSE '未知状态'
END AS statusText
END AS statusText
FROM sc_transition_info t
LEFT JOIN bas_sheep bs ON t.sheep_id = bs.id
LEFT JOIN bas_sheep_variety bv ON bs.variety_id = bv.id
@@ -47,6 +51,14 @@
<if test="manageTags != null and manageTags != ''">
and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%')
</if>
<if test="eventType != null and eventType != ''">
and t.event_type = #{eventType}
</if>
<if test="transType != null">and t.trans_type = #{transType}</if>
<if test="params.beginTransitionDate != null and params.beginTransitionDate != ''
and params.endTransitionDate != null and params.endTransitionDate != ''">
and t.transition_date between #{params.beginTransitionDate} and #{params.endTransitionDate}
</if>
<if test="varietyId != null">and bs.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>
@@ -55,6 +67,7 @@
and t.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
ORDER BY t.create_time DESC
</select>
<select id="selectScTransitionInfoById" parameterType="Integer" resultMap="ScTransitionInfoResult">
@@ -69,7 +82,9 @@
<if test="varietyId != null">variety_id,</if>
<if test="transTo != null and transTo != ''">trans_to,</if>
<if test="transFrom != null and transFrom != ''">trans_from,</if>
<if test="eventType != null and eventType != ''">event_type,</if>
<if test="transType != null">trans_type,</if>
<if test="transitionDate != null">transition_date,</if>
<if test="technician != null and technician != ''">technician,</if>
<if test="status != null">status,</if>
<if test="comment != null">comment,</if>
@@ -81,7 +96,9 @@
<if test="varietyId != null">#{varietyId},</if>
<if test="transTo != null and transTo != ''">#{transTo},</if>
<if test="transFrom != null and transFrom != ''">#{transFrom},</if>
<if test="eventType != null and eventType != ''">#{eventType},</if>
<if test="transType != null">#{transType},</if>
<if test="transitionDate != null">#{transitionDate},</if>
<if test="technician != null and technician != ''">#{technician},</if>
<if test="status != null">#{status},</if>
<if test="comment != null">#{comment},</if>
@@ -93,13 +110,13 @@
<insert id="insertScTransitionInfoBatch">
INSERT INTO sc_transition_info (
sheep_id, variety_id, trans_to, trans_from,
trans_type, technician, status, comment,
event_type,trans_type, transition_date, 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.sheepId}, #{item.varietyId}, #{item.transTo}, #{item.transFrom}, #{item.eventType},
#{item.transType},#{item.transitionDate}, #{item.technician}, #{item.status}, #{item.comment},
#{item.createBy}, now()
)
</foreach>
@@ -110,9 +127,12 @@
<trim prefix="SET" suffixOverrides=",">
<if test="sheepId != null">sheep_id = #{sheepId},</if>
<if test="varietyId != null">variety_id = #{varietyId},</if>
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
<if test="transTo != null and transTo != ''">trans_to = #{transTo},</if>
<if test="transFrom != null and transFrom != ''">trans_from = #{transFrom},</if>
<if test="eventType != null and eventType != ''">event_type = #{eventType},</if>
<if test="transType != null">trans_type = #{transType},</if>
<if test="transitionDate != null">transition_date = #{transitionDate},</if>
<if test="technician != null and technician != ''">technician = #{technician},</if>
<if test="status != null">status = #{status},</if>
<if test="comment != null">comment = #{comment},</if>

View File

@@ -4,10 +4,11 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.produce.other.mapper.ScCastrateMapper">
<resultMap type="ScCastrate" id="ScCastrateResult">
<resultMap type="com.zhyc.module.produce.other.domain.ScCastrate" id="ScCastrateResult">
<result property="id" column="id"/>
<result property="sheepId" column="sheep_id"/>
<result property="manageTags" column="manageTags"/>
<result property="eventType" column="event_type"/>
<result property="sheepfold" column="sheepfold"/>
<result property="sheepfoldName" column="sheepfoldName"/>
<result property="varietyId" column="variety_id"/>
@@ -22,6 +23,7 @@
select sc.id,
sc.sheep_id,
bs.manage_tags as manageTags,
'去势' as event_type,
bs.sheepfold_id as sheepfold,
sf.sheepfold_name as sheepfoldName,
bs.variety_id as varietyId,
@@ -50,6 +52,7 @@
and sc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if>
</where>
ORDER BY sc.create_time DESC
</select>
<select id="selectScCastrateById" parameterType="Long" resultMap="ScCastrateResult">

View File

@@ -4,9 +4,10 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.produce.other.mapper.ScFixHoofMapper">
<resultMap type="ScFixHoof" id="ScFixHoofResult">
<resultMap type="com.zhyc.module.produce.other.domain.ScFixHoof" id="ScFixHoofResult">
<result property="id" column="id"/>
<result property="manageTags" column="manageTags"/>
<result property="eventType" column="event_type"/>
<result property="sheepfold" column="sheepfold"/>
<result property="varietyId" column="variety_id"/>
<result property="sheepfoldName" column="sheepfoldName"/>
@@ -19,6 +20,7 @@
<sql id="selectScFixHoofVo">
select fh.id,
bs.manage_tags as manageTags,
'修蹄' as event_type,
bs.sheepfold_id as sheepfold,
sf.sheepfold_name as sheepfoldName,
bs.variety_id as varietyId,
@@ -46,6 +48,7 @@
and bs.manage_tags like concat('%', #{manageTags}, '%')
</if>
</where>
ORDER BY fh.create_time DESC
</select>
<select id="selectScFixHoofById" parameterType="java.lang.Integer" resultMap="ScFixHoofResult">