Merge remote-tracking branch 'origin/main'
# Conflicts: # zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzParityCorrection.java
This commit is contained in:
@@ -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>
|
||||
@@ -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">
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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" />
|
||||
@@ -26,12 +31,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="dosage" column="dosage" />
|
||||
<result property="unit" column="unit" />
|
||||
<result property="usageId" column="usageId" />
|
||||
<result property="usetime" column="usetime" />
|
||||
<result property="manufacturer" column="manufacturer" />
|
||||
<result property="batchNumber" column="batch_number" />
|
||||
</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 +50,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">
|
||||
@@ -50,11 +64,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectSwMedicineUsageDetailsList" resultMap="SwMedicineUsageDetailsResult">
|
||||
select smud.id, medi_usage, medi_id, dosage, unit, usageId, manufacturer, batch_number,
|
||||
select smud.id, medi_usage, medi_id, dosage, unit, usageId,usetime, manufacturer, batch_number,
|
||||
sm.name
|
||||
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 +77,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 +88,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>
|
||||
@@ -113,9 +134,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<insert id="batchSwMedicineUsageDetails">
|
||||
insert into sw_medicine_usage_details( id, medi_usage, medi_id, dosage, unit, usageId, manufacturer, batch_number) values
|
||||
insert into sw_medicine_usage_details( id, medi_usage, medi_id, dosage, unit, usageId,usetime, manufacturer, batch_number) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.mediUsage}, #{item.mediId}, #{item.dosage}, #{item.unit}, #{item.usageId}, #{item.manufacturer}, #{item.batchNumber})
|
||||
( #{item.id}, #{item.mediUsage}, #{item.mediId}, #{item.dosage}, #{item.unit}, #{item.usageId}, #{item.usetime},#{item.manufacturer}, #{item.batchNumber})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="diseasePName" column="disease_pname"/>
|
||||
<result property="veterinary" column="veterinary" />
|
||||
<result property="usageId" column="usage_id" />
|
||||
<result property="status" column="status"/>
|
||||
<result property="comment" column="comment" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
@@ -32,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTreatmentVo">
|
||||
select t.id, diag_id, sheep_id, variety, sheep_type, month_age, t.gender, t.parity, breed, lact_day, gest_day, datetime, disease_id, disease_pid, veterinary, usage_id, t.comment, t.update_by, t.update_time, t.create_by, t.create_time,
|
||||
select t.id, diag_id, sheep_id, variety, sheep_type, month_age, t.gender, t.parity, breed, lact_day, gest_day, datetime, disease_id, disease_pid, veterinary, usage_id,status, t.comment, t.update_by, t.update_time, t.create_by, t.create_time,
|
||||
bs.manage_tags,
|
||||
sd.name disease_name,
|
||||
sd2.name disease_pname
|
||||
@@ -48,14 +49,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
|
||||
<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="diseaseId != null "> and disease_id = #{diseaseId}</if>
|
||||
<if test="status != null and status !=''"> and status = #{status}</if>
|
||||
<if test="veterinary != null and veterinary != ''"> and veterinary = #{veterinary}</if>
|
||||
</where>
|
||||
ORDER BY datetime DESC
|
||||
</select>
|
||||
|
||||
<select id="selectTreatmentById" parameterType="Long" resultMap="TreatmentResult">
|
||||
<include refid="selectTreatmentVo"/>
|
||||
where t.id = #{id}
|
||||
</select>
|
||||
<select id="selectTreatmentStatus" resultMap="TreatmentResult">
|
||||
select * from sw_treatment where sheep_id = #{sheepId} and status in (0, 1)
|
||||
</select>
|
||||
|
||||
<insert id="insertTreatment" parameterType="Treatment" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sw_treatment
|
||||
@@ -75,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="diseasePid != null">disease_pid,</if>
|
||||
<if test="veterinary != null">veterinary,</if>
|
||||
<if test="usageId != null">usage_id,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
@@ -97,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="diseasePid != null">#{diseasePid},</if>
|
||||
<if test="veterinary != null">#{veterinary},</if>
|
||||
<if test="usageId != null">#{usageId},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
@@ -109,14 +117,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
insert into sw_treatment
|
||||
(diag_id, sheep_id, variety, sheep_type, month_age, gender,
|
||||
parity, breed, lact_day, gest_day, datetime,
|
||||
disease_id, disease_pid, veterinary, usage_id,
|
||||
disease_id, disease_pid, veterinary, usage_id,status ,
|
||||
comment, update_by, update_time, create_by, create_time)
|
||||
values
|
||||
<foreach collection="list" item="t" separator=",">
|
||||
(#{t.diagId}, #{t.sheepId}, #{t.variety}, #{t.sheepType},
|
||||
#{t.monthAge}, #{t.gender}, #{t.parity}, #{t.breed},
|
||||
#{t.lactDay}, #{t.gestDay}, #{t.datetime}, #{t.diseaseId},
|
||||
#{t.diseasePid}, #{t.veterinary},#{t.usageId}, #{t.comment},
|
||||
#{t.diseasePid}, #{t.veterinary},#{t.usageId}, #{t.status}, #{t.comment},
|
||||
#{t.updateBy}, #{t.updateTime},#{t.createBy}, #{t.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
@@ -139,6 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="diseasePid != null">disease_pid = #{diseasePid},</if>
|
||||
<if test="veterinary != null">veterinary = #{veterinary},</if>
|
||||
<if test="usageId != null">usage_id = #{usageId},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?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.common.mapper.UserPostMapper">
|
||||
|
||||
<resultMap type="UserPost" id="UserPostResult">
|
||||
|
||||
<result property="nickName" column="nick_name" />
|
||||
<result property="postName" column="post_name"/>
|
||||
<result property="postCode" column="post_code" />
|
||||
</resultMap>
|
||||
|
||||
<select id="getUserPostListByCode" resultMap="UserPostResult">
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,66 +0,0 @@
|
||||
<?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.SgFeedDetailsMapper">
|
||||
|
||||
<resultMap type="SgFeedDetails" id="SgFeedDetailsResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="fodder" column="fodder" />
|
||||
<result property="number" column="number" />
|
||||
<result property="nuit" column="nuit" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFeedDetailsVo">
|
||||
select id, fodder, number, nuit from sg_feed_details
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFeedDetailsList" parameterType="SgFeedDetails" resultMap="SgFeedDetailsResult">
|
||||
<include refid="selectSgFeedDetailsVo"/>
|
||||
<where>
|
||||
<if test="fodder != null and fodder != ''"> and fodder = #{fodder}</if>
|
||||
<if test="number != null "> and number = #{number}</if>
|
||||
<if test="nuit != null and nuit != ''"> and nuit = #{nuit}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSgFeedDetailsById" parameterType="Long" resultMap="SgFeedDetailsResult">
|
||||
<include refid="selectSgFeedDetailsVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSgFeedDetails" parameterType="SgFeedDetails" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sg_feed_details
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="fodder != null">fodder,</if>
|
||||
<if test="number != null">number,</if>
|
||||
<if test="nuit != null">nuit,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="fodder != null">#{fodder},</if>
|
||||
<if test="number != null">#{number},</if>
|
||||
<if test="nuit != null">#{nuit},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgFeedDetails" parameterType="SgFeedDetails">
|
||||
update sg_feed_details
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="fodder != null">fodder = #{fodder},</if>
|
||||
<if test="number != null">number = #{number},</if>
|
||||
<if test="nuit != null">nuit = #{nuit},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSgFeedDetailsById" parameterType="Long">
|
||||
delete from sg_feed_details where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFeedDetailsByIds" parameterType="String">
|
||||
delete from sg_feed_details where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -1,129 +0,0 @@
|
||||
<?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.SgFeedInfoMapper">
|
||||
|
||||
<resultMap type="SgFeedInfo" id="SgFeedInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="formulaId" column="formula_id" />
|
||||
<result property="sheepfoldId" column="sheepfold_id" />
|
||||
<result property="average" column="average" />
|
||||
<result property="planMonring" column="plan_monring" />
|
||||
<result property="actualMonring" column="actual_monring" />
|
||||
<result property="planNoon" column="plan_noon" />
|
||||
<result property="actualNoon" column="actual_noon" />
|
||||
<result property="planEvenig" column="plan_evenig" />
|
||||
<result property="actualEvening" column="actual_evening" />
|
||||
<result property="particle" column="particle" />
|
||||
<result property="other" column="other" />
|
||||
<result property="replenish" column="replenish" />
|
||||
<result property="planDate" column="plan_date" />
|
||||
<result property="comment" column="comment" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFeedInfoVo">
|
||||
select id, formula_id, sheepfold_id, average, plan_monring, actual_monring, plan_noon, actual_noon, plan_evenig, actual_evening, particle, other, replenish, plan_date, comment, create_by, create_time from sg_feed_info
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFeedInfoList" parameterType="SgFeedInfo" resultMap="SgFeedInfoResult">
|
||||
<include refid="selectSgFeedInfoVo"/>
|
||||
<where>
|
||||
<if test="formulaId != null "> and formula_id = #{formulaId}</if>
|
||||
<if test="sheepfoldId != null and sheepfoldId != ''"> and sheepfold_id = #{sheepfoldId}</if>
|
||||
<if test="average != null "> and average = #{average}</if>
|
||||
<if test="planMonring != null "> and plan_monring = #{planMonring}</if>
|
||||
<if test="actualMonring != null "> and actual_monring = #{actualMonring}</if>
|
||||
<if test="planNoon != null "> and plan_noon = #{planNoon}</if>
|
||||
<if test="actualNoon != null "> and actual_noon = #{actualNoon}</if>
|
||||
<if test="planEvenig != null "> and plan_evenig = #{planEvenig}</if>
|
||||
<if test="actualEvening != null "> and actual_evening = #{actualEvening}</if>
|
||||
<if test="particle != null "> and particle = #{particle}</if>
|
||||
<if test="other != null "> and other = #{other}</if>
|
||||
<if test="replenish != null "> and replenish = #{replenish}</if>
|
||||
<if test="planDate != null "> and plan_date = #{planDate}</if>
|
||||
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSgFeedInfoById" parameterType="Long" resultMap="SgFeedInfoResult">
|
||||
<include refid="selectSgFeedInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSgFeedInfo" parameterType="SgFeedInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sg_feed_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="formulaId != null">formula_id,</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id,</if>
|
||||
<if test="average != null">average,</if>
|
||||
<if test="planMonring != null">plan_monring,</if>
|
||||
<if test="actualMonring != null">actual_monring,</if>
|
||||
<if test="planNoon != null">plan_noon,</if>
|
||||
<if test="actualNoon != null">actual_noon,</if>
|
||||
<if test="planEvenig != null">plan_evenig,</if>
|
||||
<if test="actualEvening != null">actual_evening,</if>
|
||||
<if test="particle != null">particle,</if>
|
||||
<if test="other != null">other,</if>
|
||||
<if test="replenish != null">replenish,</if>
|
||||
<if test="planDate != null">plan_date,</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="formulaId != null">#{formulaId},</if>
|
||||
<if test="sheepfoldId != null">#{sheepfoldId},</if>
|
||||
<if test="average != null">#{average},</if>
|
||||
<if test="planMonring != null">#{planMonring},</if>
|
||||
<if test="actualMonring != null">#{actualMonring},</if>
|
||||
<if test="planNoon != null">#{planNoon},</if>
|
||||
<if test="actualNoon != null">#{actualNoon},</if>
|
||||
<if test="planEvenig != null">#{planEvenig},</if>
|
||||
<if test="actualEvening != null">#{actualEvening},</if>
|
||||
<if test="particle != null">#{particle},</if>
|
||||
<if test="other != null">#{other},</if>
|
||||
<if test="replenish != null">#{replenish},</if>
|
||||
<if test="planDate != null">#{planDate},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgFeedInfo" parameterType="SgFeedInfo">
|
||||
update sg_feed_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="formulaId != null">formula_id = #{formulaId},</if>
|
||||
<if test="sheepfoldId != null">sheepfold_id = #{sheepfoldId},</if>
|
||||
<if test="average != null">average = #{average},</if>
|
||||
<if test="planMonring != null">plan_monring = #{planMonring},</if>
|
||||
<if test="actualMonring != null">actual_monring = #{actualMonring},</if>
|
||||
<if test="planNoon != null">plan_noon = #{planNoon},</if>
|
||||
<if test="actualNoon != null">actual_noon = #{actualNoon},</if>
|
||||
<if test="planEvenig != null">plan_evenig = #{planEvenig},</if>
|
||||
<if test="actualEvening != null">actual_evening = #{actualEvening},</if>
|
||||
<if test="particle != null">particle = #{particle},</if>
|
||||
<if test="other != null">other = #{other},</if>
|
||||
<if test="replenish != null">replenish = #{replenish},</if>
|
||||
<if test="planDate != null">plan_date = #{planDate},</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="deleteSgFeedInfoById" parameterType="Long">
|
||||
delete from sg_feed_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFeedInfoByIds" parameterType="String">
|
||||
delete from sg_feed_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?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="formulaBatchId != null and formulaBatchId != ''"> and formula_batch_id = #{formulaBatchId}</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>
|
||||
@@ -7,21 +7,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="SgFeedPlan" id="SgFeedPlanResult">
|
||||
<result property="createDate" column="create_date" />
|
||||
<result property="formulaId" column="formula_id" />
|
||||
<result property="batchId" column="batch_id" />
|
||||
<result property="sheepHouseId" column="sheep_house_id" />
|
||||
<result property="sheepCount" column="sheep_count" />
|
||||
<result property="planDailySize" column="plan_daily_size" />
|
||||
<result property="ratioMorning" column="ratio_morning" />
|
||||
<result property="ratioNoon" column="ratio_noon" />
|
||||
<result property="ratioAfternoon" column="ratio_afternoon" />
|
||||
<result property="planMorningSize" column="plan_morning_size" />
|
||||
<result property="planMorningTotal" column="plan_morning_total" />
|
||||
<result property="ratioMorning" column="ratio_morning" />
|
||||
<result property="actualMorningSize" column="actual_morning_size" />
|
||||
<result property="planNoonSize" column="plan_noon_size" />
|
||||
<result property="planNoonTotal" column="plan_noon_total" />
|
||||
<result property="actualNoonSize" column="actual_noon_size" />
|
||||
<result property="ratioNoon" column="ratio_noon" />
|
||||
<result property="planAfternoonSize" column="plan_afternoon_size" />
|
||||
<result property="planAfternoonTotal" column="plan_afternoon_total" />
|
||||
<result property="actualAfternoonSize" column="actual_afternoon_size" />
|
||||
<result property="ratioAfternoon" column="ratio_afternoon" />
|
||||
<result property="planFeedTotal" column="plan_feed_total" />
|
||||
<result property="zookeeper" column="zookeeper" />
|
||||
<result property="planDate" column="plan_date" />
|
||||
@@ -29,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFeedPlanVo">
|
||||
select create_date, formula_id, sheep_house_id, sheep_count, plan_daily_size, plan_morning_size, plan_morning_total, ratio_morning, actual_morning_size, plan_noon_size, plan_noon_total, actual_noon_size, ratio_noon, plan_afternoon_size, plan_afternoon_total, actual_afternoon_size, ratio_afternoon, plan_feed_total, zookeeper, plan_date, remark from sg_feed_plan
|
||||
select create_date, formula_id, batch_id, sheep_house_id, sheep_count, plan_daily_size, ratio_morning, ratio_noon, ratio_afternoon, plan_morning_size, plan_morning_total, actual_morning_size, plan_noon_size, plan_noon_total, actual_noon_size, plan_afternoon_size, plan_afternoon_total, actual_afternoon_size, plan_feed_total, zookeeper, plan_date, remark from sg_feed_plan
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFeedPlanList" parameterType="SgFeedPlan" resultMap="SgFeedPlanResult">
|
||||
@@ -37,9 +38,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<where>
|
||||
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if>
|
||||
<if test="sheepHouseId != null "> and sheep_house_id = #{sheepHouseId}</if>
|
||||
<if test="zookeeper != null and zookeeper != ''"> and zookeeper = #{zookeeper}</if>
|
||||
<if test="planDate != null "> and plan_date = #{planDate}</if>
|
||||
</where>
|
||||
ORDER BY formula_id ASC, plan_date ASC
|
||||
</select>
|
||||
|
||||
<select id="selectSgFeedPlanByCreateDate" parameterType="Date" resultMap="SgFeedPlanResult">
|
||||
@@ -52,21 +52,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="createDate != null">create_date,</if>
|
||||
<if test="formulaId != null and formulaId != ''">formula_id,</if>
|
||||
<if test="batchId != null and batchId != ''">batch_id,</if>
|
||||
<if test="sheepHouseId != null">sheep_house_id,</if>
|
||||
<if test="sheepCount != null">sheep_count,</if>
|
||||
<if test="planDailySize != null">plan_daily_size,</if>
|
||||
<if test="ratioMorning != null">ratio_morning,</if>
|
||||
<if test="ratioNoon != null">ratio_noon,</if>
|
||||
<if test="ratioAfternoon != null">ratio_afternoon,</if>
|
||||
<if test="planMorningSize != null">plan_morning_size,</if>
|
||||
<if test="planMorningTotal != null">plan_morning_total,</if>
|
||||
<if test="ratioMorning != null">ratio_morning,</if>
|
||||
<if test="actualMorningSize != null">actual_morning_size,</if>
|
||||
<if test="planNoonSize != null">plan_noon_size,</if>
|
||||
<if test="planNoonTotal != null">plan_noon_total,</if>
|
||||
<if test="actualNoonSize != null">actual_noon_size,</if>
|
||||
<if test="ratioNoon != null">ratio_noon,</if>
|
||||
<if test="planAfternoonSize != null">plan_afternoon_size,</if>
|
||||
<if test="planAfternoonTotal != null">plan_afternoon_total,</if>
|
||||
<if test="actualAfternoonSize != null">actual_afternoon_size,</if>
|
||||
<if test="ratioAfternoon != null">ratio_afternoon,</if>
|
||||
<if test="planFeedTotal != null">plan_feed_total,</if>
|
||||
<if test="zookeeper != null">zookeeper,</if>
|
||||
<if test="planDate != null">plan_date,</if>
|
||||
@@ -75,21 +76,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="createDate != null">#{createDate},</if>
|
||||
<if test="formulaId != null and formulaId != ''">#{formulaId},</if>
|
||||
<if test="batchId != null and batchId != ''">#{batchId},</if>
|
||||
<if test="sheepHouseId != null">#{sheepHouseId},</if>
|
||||
<if test="sheepCount != null">#{sheepCount},</if>
|
||||
<if test="planDailySize != null">#{planDailySize},</if>
|
||||
<if test="ratioMorning != null">#{ratioMorning},</if>
|
||||
<if test="ratioNoon != null">#{ratioNoon},</if>
|
||||
<if test="ratioAfternoon != null">#{ratioAfternoon},</if>
|
||||
<if test="planMorningSize != null">#{planMorningSize},</if>
|
||||
<if test="planMorningTotal != null">#{planMorningTotal},</if>
|
||||
<if test="ratioMorning != null">#{ratioMorning},</if>
|
||||
<if test="actualMorningSize != null">#{actualMorningSize},</if>
|
||||
<if test="planNoonSize != null">#{planNoonSize},</if>
|
||||
<if test="planNoonTotal != null">#{planNoonTotal},</if>
|
||||
<if test="actualNoonSize != null">#{actualNoonSize},</if>
|
||||
<if test="ratioNoon != null">#{ratioNoon},</if>
|
||||
<if test="planAfternoonSize != null">#{planAfternoonSize},</if>
|
||||
<if test="planAfternoonTotal != null">#{planAfternoonTotal},</if>
|
||||
<if test="actualAfternoonSize != null">#{actualAfternoonSize},</if>
|
||||
<if test="ratioAfternoon != null">#{ratioAfternoon},</if>
|
||||
<if test="planFeedTotal != null">#{planFeedTotal},</if>
|
||||
<if test="zookeeper != null">#{zookeeper},</if>
|
||||
<if test="planDate != null">#{planDate},</if>
|
||||
@@ -101,21 +103,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update sg_feed_plan
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="formulaId != null and formulaId != ''">formula_id = #{formulaId},</if>
|
||||
<if test="batchId != null and batchId != ''">batch_id = #{batchId},</if>
|
||||
<if test="sheepHouseId != null">sheep_house_id = #{sheepHouseId},</if>
|
||||
<if test="sheepCount != null">sheep_count = #{sheepCount},</if>
|
||||
<if test="planDailySize != null">plan_daily_size = #{planDailySize},</if>
|
||||
<if test="ratioMorning != null">ratio_morning = #{ratioMorning},</if>
|
||||
<if test="ratioNoon != null">ratio_noon = #{ratioNoon},</if>
|
||||
<if test="ratioAfternoon != null">ratio_afternoon = #{ratioAfternoon},</if>
|
||||
<if test="planMorningSize != null">plan_morning_size = #{planMorningSize},</if>
|
||||
<if test="planMorningTotal != null">plan_morning_total = #{planMorningTotal},</if>
|
||||
<if test="ratioMorning != null">ratio_morning = #{ratioMorning},</if>
|
||||
<if test="actualMorningSize != null">actual_morning_size = #{actualMorningSize},</if>
|
||||
<if test="planNoonSize != null">plan_noon_size = #{planNoonSize},</if>
|
||||
<if test="planNoonTotal != null">plan_noon_total = #{planNoonTotal},</if>
|
||||
<if test="actualNoonSize != null">actual_noon_size = #{actualNoonSize},</if>
|
||||
<if test="ratioNoon != null">ratio_noon = #{ratioNoon},</if>
|
||||
<if test="planAfternoonSize != null">plan_afternoon_size = #{planAfternoonSize},</if>
|
||||
<if test="planAfternoonTotal != null">plan_afternoon_total = #{planAfternoonTotal},</if>
|
||||
<if test="actualAfternoonSize != null">actual_afternoon_size = #{actualAfternoonSize},</if>
|
||||
<if test="ratioAfternoon != null">ratio_afternoon = #{ratioAfternoon},</if>
|
||||
<if test="planFeedTotal != null">plan_feed_total = #{planFeedTotal},</if>
|
||||
<if test="zookeeper != null">zookeeper = #{zookeeper},</if>
|
||||
<if test="planDate != null">plan_date = #{planDate},</if>
|
||||
@@ -134,4 +137,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{createDate}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectSheepCountByFoldId" parameterType="Integer">
|
||||
SELECT COUNT(*)
|
||||
FROM bas_sheep
|
||||
WHERE sheepfold_id = #{foldId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,66 +0,0 @@
|
||||
<?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.SgFeedRatioMapper">
|
||||
|
||||
<resultMap type="SgFeedRatio" id="SgFeedRatioResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="morning" column="morning" />
|
||||
<result property="noon" column="noon" />
|
||||
<result property="evening" column="evening" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFeedRatioVo">
|
||||
select id, morning, noon, evening from sg_feed_ratio
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFeedRatioList" parameterType="SgFeedRatio" resultMap="SgFeedRatioResult">
|
||||
<include refid="selectSgFeedRatioVo"/>
|
||||
<where>
|
||||
<if test="morning != null and morning != ''"> and morning = #{morning}</if>
|
||||
<if test="noon != null and noon != ''"> and noon = #{noon}</if>
|
||||
<if test="evening != null and evening != ''"> and evening = #{evening}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSgFeedRatioById" parameterType="Long" resultMap="SgFeedRatioResult">
|
||||
<include refid="selectSgFeedRatioVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSgFeedRatio" parameterType="SgFeedRatio" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sg_feed_ratio
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="morning != null">morning,</if>
|
||||
<if test="noon != null">noon,</if>
|
||||
<if test="evening != null">evening,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="morning != null">#{morning},</if>
|
||||
<if test="noon != null">#{noon},</if>
|
||||
<if test="evening != null">#{evening},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgFeedRatio" parameterType="SgFeedRatio">
|
||||
update sg_feed_ratio
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="morning != null">morning = #{morning},</if>
|
||||
<if test="noon != null">noon = #{noon},</if>
|
||||
<if test="evening != null">evening = #{evening},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSgFeedRatioById" parameterType="Long">
|
||||
delete from sg_feed_ratio where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFeedRatioByIds" parameterType="String">
|
||||
delete from sg_feed_ratio where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,100 @@
|
||||
<?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.SgFeedStatisticMapper">
|
||||
|
||||
<resultMap type="SgFeedStatistic" id="SgFeedStatisticResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="formulaId" column="formula_id" />
|
||||
<result property="formulaBatchId" column="formula_batch_id" />
|
||||
<result property="sheepFoldCount" column="sheep_fold_count" />
|
||||
<result property="silageLossRate" column="silage_loss_rate" />
|
||||
<result property="feedTotalSize" column="feed_total_size" />
|
||||
<result property="feedDailySize" column="feed_daily_size" />
|
||||
<!--
|
||||
适配泛型TypeHandler
|
||||
弃用: XML中无法使用"<>"
|
||||
-->
|
||||
<!-- <result property="materialList" column="material_list"-->
|
||||
<!-- typeHandler="com.zhyc.module.feed.mapper.TypeHandler.JsonTypeHandler<java.util.List<com.zhyc.module.feed.domain.SgFormulaList>>" />-->
|
||||
<!-- 分别使用两个TypeHandler完成实体类List<T> 到 数据库 JSON串的映射转换 -->
|
||||
<result property="materialList" column="material_list" typeHandler="com.zhyc.module.feed.mapper.TypeHandler.SgFormulaListHandler"/>
|
||||
<result property="sheepFoldList" column="sheep_fold_list" typeHandler="com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler"/>
|
||||
<result property="feedDate" column="feed_date" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFeedStatisticVo">
|
||||
select id, formula_id, formula_batch_id, sheep_fold_count, silage_loss_rate, feed_total_size, feed_daily_size, material_list, sheep_fold_list,feed_date from sg_feed_statistic
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFeedStatisticList" parameterType="SgFeedStatistic" resultMap="SgFeedStatisticResult">
|
||||
<include refid="selectSgFeedStatisticVo"/>
|
||||
<where>
|
||||
<if test="formulaId != null and formulaId != ''"> and formula_id = #{formulaId}</if>
|
||||
<if test="formulaBatchId != null and formulaBatchId != ''"> and formula_batch_id = #{formulaBatchId}</if>
|
||||
<if test="silageLossRate != null and silageLossRate != ''"> and silage_loss_rate = #{silageLossRate}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSgFeedStatisticById" parameterType="String" resultMap="SgFeedStatisticResult">
|
||||
<include refid="selectSgFeedStatisticVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSgFeedStatistic" parameterType="SgFeedStatistic">
|
||||
insert into sg_feed_statistic
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="formulaId != null and formulaId != ''">formula_id,</if>
|
||||
<if test="formulaBatchId != null and formulaBatchId != ''">formula_batch_id,</if>
|
||||
<if test="sheepFoldCount != null">sheep_fold_count,</if>
|
||||
<if test="silageLossRate != null">silage_loss_rate,</if>
|
||||
<if test="feedTotalSize != null">feed_total_size,</if>
|
||||
<if test="feedDailySize != null">feed_daily_size,</if>
|
||||
<if test="materialList != null">material_list,</if>
|
||||
<if test="sheepFoldList != null">sheep_fold_list,</if>
|
||||
<if test="feedDate != null">feed_date,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="formulaId != null and formulaId != ''">#{formulaId},</if>
|
||||
<if test="formulaBatchId != null and formulaBatchId != ''">#{formulaBatchId},</if>
|
||||
<if test="sheepFoldCount != null">#{sheepFoldCount},</if>
|
||||
<if test="silageLossRate != null">#{silageLossRate},</if>
|
||||
<if test="feedTotalSize != null">#{feedTotalSize},</if>
|
||||
<if test="feedDailySize != null">#{feedDailySize},</if>
|
||||
# 写入操作需要手动指定 TypeHandler 参数
|
||||
<if test="materialList != null">#{materialList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.SgFormulaListHandler},</if>
|
||||
<if test="sheepFoldList != null">#{sheepFoldList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler},</if>
|
||||
<if test="feedDate != null">#{feedDate},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgFeedStatistic" parameterType="SgFeedStatistic">
|
||||
update sg_feed_statistic
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="formulaId != null and formulaId != ''">formula_id = #{formulaId},</if>
|
||||
<if test="formulaBatchId != null and formulaBatchId != ''">formula_batch_id = #{formulaBatchId},</if>
|
||||
<if test="sheepFoldCount != null">sheep_fold_count = #{sheepFoldCount},</if>
|
||||
<if test="silageLossRate != null">silage_loss_rate = #{silageLossRate},</if>
|
||||
<if test="feedTotalSize != null">feed_total_size = #{feedTotalSize},</if>
|
||||
<if test="feedDailySize != null">feed_daily_size = #{feedDailySize},</if>
|
||||
<if test="materialList != null">material_list = #{materialList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.SgFormulaListHandler},</if>
|
||||
<if test="sheepFoldList != null">sheep_fold_list = #{sheepFoldList, typeHandler=com.zhyc.module.feed.mapper.TypeHandler.DaSheepfoldHandler},</if>
|
||||
<if test="feedDate != null">feed_date = #{feedDate},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSgFeedStatisticById" parameterType="String">
|
||||
delete from sg_feed_statistic where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFeedStatisticByIds" parameterType="String">
|
||||
delete from sg_feed_statistic where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -1,61 +0,0 @@
|
||||
<?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.SgFodderMapper">
|
||||
|
||||
<resultMap type="SgFodder" id="SgFodderResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="fodderType" column="fodder_type" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSgFodderVo">
|
||||
select id, name, fodder_type from sg_fodder
|
||||
</sql>
|
||||
|
||||
<select id="selectSgFodderList" parameterType="SgFodder" resultMap="SgFodderResult">
|
||||
<include refid="selectSgFodderVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="fodderType != null "> and fodder_type = #{fodderType}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSgFodderById" parameterType="Long" resultMap="SgFodderResult">
|
||||
<include refid="selectSgFodderVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSgFodder" parameterType="SgFodder" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sg_fodder
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
<if test="fodderType != null">fodder_type,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="fodderType != null">#{fodderType},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSgFodder" parameterType="SgFodder">
|
||||
update sg_fodder
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="fodderType != null">fodder_type = #{fodderType},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSgFodderById" parameterType="Long">
|
||||
delete from sg_fodder where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSgFodderByIds" parameterType="String">
|
||||
delete from sg_fodder where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,155 @@
|
||||
<?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.breed.mapper.ScMiscarriageRecordMapper">
|
||||
|
||||
<resultMap type="ScMiscarriageRecord" id="ScMiscarriageRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="datetime" column="datetime" />
|
||||
<result property="comment" column="comment" />
|
||||
<result property="technician" column="technician" />
|
||||
<result property="reason" column="reason" />
|
||||
<result property="exposeType" column="expose_type" />
|
||||
<result property="status" column="status" />
|
||||
<result property="miscaLamb" column="misca_lamb" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<!-- 关联查询字段 -->
|
||||
<result property="bsManageTags" column="bs_manage_tags" />
|
||||
<result property="variety" column="variety" />
|
||||
<result property="matingTypeId" column="mating_type_id" />
|
||||
<result property="matingTypeName" column="mating_type_name" />
|
||||
<result property="matingDate" column="mating_date" />
|
||||
<result property="parity" column="parity" />
|
||||
<result property="ramVariety" column="ram_variety" />
|
||||
<result property="monthAge" column="month_age" />
|
||||
<result property="pregnantDays" column="pregnant_days" />
|
||||
<result property="sheepfoldName" column="sheepfold_name" />
|
||||
<result property="drRanch" column="dr_ranch" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScMiscarriageRecordVo">
|
||||
select
|
||||
smr.id,
|
||||
smr.sheep_id,
|
||||
smr.datetime,
|
||||
smr.comment,
|
||||
smr.technician,
|
||||
smr.reason,
|
||||
smr.expose_type,
|
||||
smr.status,
|
||||
smr.misca_lamb,
|
||||
smr.create_by,
|
||||
smr.create_time,
|
||||
sf.bs_manage_tags,
|
||||
sf.variety,
|
||||
sf.mating_type_id,
|
||||
CASE sf.mating_type_id
|
||||
WHEN 1 THEN '人工授精'
|
||||
WHEN 2 THEN '自然配种'
|
||||
WHEN 3 THEN '胚胎移植'
|
||||
ELSE '未知'
|
||||
END as mating_type_name,
|
||||
sf.mating_date,
|
||||
sf.parity,
|
||||
sf.variety as ram_variety, -- 这里需要根据实际配种公羊信息调整
|
||||
sf.month_age,
|
||||
CASE
|
||||
WHEN sf.mating_date IS NOT NULL AND smr.datetime IS NOT NULL
|
||||
THEN DATEDIFF(smr.datetime, sf.mating_date)
|
||||
ELSE NULL
|
||||
END as pregnant_days,
|
||||
sf.sheepfold_name,
|
||||
sf.dr_ranch
|
||||
from sc_miscarriage_record smr
|
||||
left join sheep_file sf on smr.sheep_id = sf.bs_manage_tags
|
||||
</sql>
|
||||
|
||||
<select id="selectScMiscarriageRecordList" parameterType="ScMiscarriageRecord" resultMap="ScMiscarriageRecordResult">
|
||||
<include refid="selectScMiscarriageRecordVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null and sheepId != ''"> and smr.sheep_id = #{sheepId}</if>
|
||||
<if test="bsManageTags != null and bsManageTags != ''"> and sf.bs_manage_tags like concat('%', #{bsManageTags}, '%')</if>
|
||||
<if test="datetime != null"> and smr.datetime = #{datetime}</if>
|
||||
<if test="comment != null and comment != ''"> and smr.comment like concat('%', #{comment}, '%')</if>
|
||||
<if test="technician != null and technician != ''"> and smr.technician like concat('%', #{technician}, '%')</if>
|
||||
<if test="reason != null and reason != ''"> and smr.reason = #{reason}</if>
|
||||
<if test="exposeType != null"> and smr.expose_type = #{exposeType}</if>
|
||||
<if test="status != null"> and smr.status = #{status}</if>
|
||||
<if test="miscaLamb != null"> and smr.misca_lamb = #{miscaLamb}</if>
|
||||
<if test="variety != null and variety != ''"> and sf.variety like concat('%', #{variety}, '%')</if>
|
||||
</where>
|
||||
order by smr.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectScMiscarriageRecordById" parameterType="Long" resultMap="ScMiscarriageRecordResult">
|
||||
<include refid="selectScMiscarriageRecordVo"/>
|
||||
where smr.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScMiscarriageRecord" parameterType="ScMiscarriageRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_miscarriage_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="datetime != null">datetime,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="reason != null">reason,</if>
|
||||
<if test="exposeType != null">expose_type,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="miscaLamb != null">misca_lamb,</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="comment != null">#{comment},</if>
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="reason != null">#{reason},</if>
|
||||
<if test="exposeType != null">#{exposeType},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="miscaLamb != null">#{miscaLamb},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScMiscarriageRecord" parameterType="ScMiscarriageRecord">
|
||||
update sc_miscarriage_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="datetime != null">datetime = #{datetime},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="reason != null">reason = #{reason},</if>
|
||||
<if test="exposeType != null">expose_type = #{exposeType},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="miscaLamb != null">misca_lamb = #{miscaLamb},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScMiscarriageRecordById" parameterType="Long">
|
||||
delete from sc_miscarriage_record where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScMiscarriageRecordByIds" parameterType="String">
|
||||
delete from sc_miscarriage_record where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据耳号查询羊只信息 -->
|
||||
<select id="selectSheepByManageTags" parameterType="String" resultType="map">
|
||||
select bs_manage_tags, variety, parity, month_age, sheepfold_name, dr_ranch
|
||||
from sheep_file
|
||||
where bs_manage_tags = #{manageTags}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -8,6 +8,18 @@
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="sheepfoldId" column="sheepfold_id"/>
|
||||
<result property="sheepfoldName" column="sheepfold_name"/>
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
<result property="varietyName" column="variety_name"/>
|
||||
<result property="eventType" column="event_type"/>
|
||||
<result property="sheepTypeName" column="sheep_type_name"/>
|
||||
<result property="measureDate" column="measure_date"/>
|
||||
<result property="gender" column="gender"/>
|
||||
<result property="parity" column="parity"/>
|
||||
<result property="birthWeight" column="birth_weight"/>
|
||||
<result property="weaningWeight" column="weaning_weight"/>
|
||||
<result property="currentWeight" column="current_weight"/>
|
||||
<result property="height" column="height"/>
|
||||
<result property="bust" column="bust"/>
|
||||
<result property="bodyLength" column="body_length"/>
|
||||
@@ -18,6 +30,10 @@
|
||||
<result property="rumpHeignt" column="rump_heignt"/>
|
||||
<result property="hipWidth" column="hip_width"/>
|
||||
<result property="hipCrossHeight" column="hip_cross_height"/>
|
||||
<result property="breedStatusName" column="breed_status_name"/>
|
||||
<result property="lactationDay" column="lactation_day"/>
|
||||
<result property="gestationDay" column="gestation_day"/>
|
||||
<result property="postMatingDay" column="post_mating_day"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
@@ -28,6 +44,18 @@
|
||||
select sm.id,
|
||||
sm.sheep_id,
|
||||
bs.manage_tags,
|
||||
ds.id as sheepfold_id,
|
||||
ds.sheepfold_name,
|
||||
bsv.id as variety_id,
|
||||
bsv.variety as variety_name,
|
||||
'体尺测量' as event_type,
|
||||
bst.name as sheep_type_name,
|
||||
sm.measure_date,
|
||||
bs.gender,
|
||||
bs.parity,
|
||||
bs.birth_weight as birth_weight,
|
||||
bs.weaning_weight as weaning_weight,
|
||||
bs.current_weight as current_weight,
|
||||
sm.height,
|
||||
sm.bust,
|
||||
sm.body_length,
|
||||
@@ -38,25 +66,43 @@
|
||||
sm.rump_heignt,
|
||||
sm.hip_width,
|
||||
sm.hip_cross_height,
|
||||
bbs.breed as breed_status_name,
|
||||
bs.lactation_day as lactation_day,
|
||||
bs.gestation_day as gestation_day,
|
||||
case when bs.mating_date is not null
|
||||
then DATEDIFF(NOW(), bs.mating_date)
|
||||
else null
|
||||
end as post_mating_day,
|
||||
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
|
||||
LEFT JOIN bas_sheep bs ON sm.sheep_id = bs.id
|
||||
LEFT JOIN bas_breed_status bbs ON bs.breed_status_id = bbs.id
|
||||
LEFT JOIN da_sheepfold ds ON bs.sheepfold_id = ds.id
|
||||
LEFT JOIN bas_sheep_type bst ON bs.type_id = bst.id
|
||||
LEFT JOIN bas_sheep_variety bsv ON bs.variety_id = bsv.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="params.beginMeasureDate != null and params.endMeasureDate != null">
|
||||
and sm.measure_date between #{params.beginMeasureDate} and #{params.endMeasureDate}
|
||||
</if>
|
||||
<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="varietyId != null">AND bsv.id = #{varietyId}</if>
|
||||
<if test="sheepTypeId != null">and bs.type_id = #{sheepTypeId}</if>
|
||||
<if test="params.beginCreateTime != null and params.endCreateTime != null">
|
||||
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">
|
||||
@@ -68,6 +114,7 @@
|
||||
insert into sc_body_measure
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="measureDate != null">measure_date,</if>
|
||||
<if test="height != null">height,</if>
|
||||
<if test="bust != null">bust,</if>
|
||||
<if test="bodyLength != null">body_length,</if>
|
||||
@@ -85,6 +132,7 @@
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="measureDate != null">#{measureDate},</if>
|
||||
<if test="height != null">#{height},</if>
|
||||
<if test="bust != null">#{bust},</if>
|
||||
<if test="bodyLength != null">#{bodyLength},</if>
|
||||
@@ -106,6 +154,7 @@
|
||||
update sc_body_measure
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="measureDate != null">measure_date = #{measureDate},</if>
|
||||
<if test="height != null">height = #{height},</if>
|
||||
<if test="bust != null">bust = #{bust},</if>
|
||||
<if test="bodyLength != null">body_length = #{bodyLength},</if>
|
||||
|
||||
@@ -8,9 +8,13 @@
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manage_tags"/>
|
||||
<result property="varietyId" column="varietyId"/>
|
||||
<result property="varietyName" column="varietyName"/>
|
||||
<result property="eventType" column="event_type"/>
|
||||
<result property="datetime" column="datetime"/>
|
||||
<result property="score" column="score"/>
|
||||
<result property="sheepfold" column="sheepfold"/>
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
@@ -21,9 +25,11 @@
|
||||
select sbs.id,
|
||||
sbs.sheep_id,
|
||||
bs.manage_tags,
|
||||
bsv.id as varietyId,
|
||||
bsv.variety as varietyName,
|
||||
'体况评分' as event_type,
|
||||
sbs.datetime,
|
||||
sbs.score,
|
||||
sbs.sheepfold,
|
||||
ds.sheepfold_name as sheepfoldName,
|
||||
sbs.comment,
|
||||
sbs.technician,
|
||||
@@ -31,18 +37,20 @@
|
||||
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
|
||||
left join da_sheepfold ds on bs.sheepfold_id = ds.id
|
||||
left join bas_sheep_variety bsv on bs.variety_id = bsv.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="varietyId != null">and bsv.id = #{varietyId}</if>
|
||||
<if test="sheepfold != null">and bs.sheepfold_id = #{sheepfold}</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>
|
||||
@@ -50,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">
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
<result property="id" column="id"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="manageTags" column="manageTags"/>
|
||||
<result property="varietyId" column="varietyId"/>
|
||||
<result property="varietyName" column="varietyName"/>
|
||||
<result property="eventType" column="event_type"/>
|
||||
<result property="eventDate" column="event_date"/>
|
||||
<result property="sheepfoldId" column="sheepfoldId"/>
|
||||
<result property="sheepfoldName" column="sheepfoldName"/>
|
||||
<result property="depth" column="depth"/>
|
||||
<result property="length" column="length"/>
|
||||
<result property="position" column="position"/>
|
||||
@@ -22,9 +28,17 @@
|
||||
|
||||
<sql id="selectScBreastRatingVo">
|
||||
select sbr.*,
|
||||
bs.manage_tags as manageTags
|
||||
bs.manage_tags as manageTags,
|
||||
bsv.id as varietyId,
|
||||
bsv.variety as varietyName,
|
||||
'乳房评分' as event_type,
|
||||
sf.id as sheepfoldId,
|
||||
sf.sheepfold_name as sheepfoldName,
|
||||
sbr.event_date
|
||||
from sc_breast_rating sbr
|
||||
left join bas_sheep bs on sbr.sheep_id = bs.id
|
||||
left join bas_sheep_variety bsv on bs.variety_id = bsv.id
|
||||
left join da_sheepfold sf on bs.sheepfold_id = sf.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScBreastRatingList" parameterType="ScBreastRating" resultMap="ScBreastRatingResult">
|
||||
@@ -33,10 +47,16 @@
|
||||
<if test="manageTags != null and manageTags != ''">
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
<if test="varietyId != null">and bsv.id = #{varietyId}</if>
|
||||
<if test="sheepfoldId != null">and sf.id = #{sheepfoldId}</if>
|
||||
<if test="params.beginEventDate != null and params.endEventDate != null">
|
||||
and sbr.event_date between #{params.beginEventDate} and #{params.endEventDate}
|
||||
</if>
|
||||
<if test="params.beginCreateTime != null and params.endCreateTime != null">
|
||||
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">
|
||||
@@ -48,6 +68,7 @@
|
||||
insert into sc_breast_rating
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="eventDate != null">event_date,</if>
|
||||
<if test="depth != null">depth,</if>
|
||||
<if test="length != null">length,</if>
|
||||
<if test="position != null">position,</if>
|
||||
@@ -61,6 +82,7 @@
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="eventDate != null">#{eventDate},</if>
|
||||
<if test="depth != null">#{depth},</if>
|
||||
<if test="length != null">#{length},</if>
|
||||
<if test="position != null">#{position},</if>
|
||||
@@ -78,6 +100,7 @@
|
||||
update sc_breast_rating
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="eventDate != null">event_date = #{eventDate},</if>
|
||||
<if test="depth != null">depth = #{depth},</if>
|
||||
<if test="length != null">length = #{length},</if>
|
||||
<if test="position != null">position = #{position},</if>
|
||||
|
||||
@@ -34,8 +34,14 @@
|
||||
<where>
|
||||
<if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
|
||||
<if test="planType != null"> and plan_type = #{planType}</if>
|
||||
<if test="planDate != null"> and plan_date = #{planDate}</if>
|
||||
<if test="planDate != null"> and DATE(plan_date) = DATE(#{planDate})</if>
|
||||
<if test="status != null"> and status = #{status}</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''">
|
||||
and DATE(plan_date) >= DATE(#{params.beginTime})
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''">
|
||||
and DATE(plan_date) <= DATE(#{params.endTime})
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
@@ -48,63 +54,72 @@
|
||||
<!-- 筛选符合条件的母羊 -->
|
||||
<select id="selectEligibleEwe" resultType="Map">
|
||||
select
|
||||
sf.id,
|
||||
sf.bs_manage_tags,
|
||||
sf.variety,
|
||||
sf.name as sheep_type,
|
||||
sf.gender,
|
||||
sf.month_age,
|
||||
sf.current_weight,
|
||||
sf.post_lambing_day,
|
||||
sf.breed
|
||||
from sheep_file sf
|
||||
where sf.gender = 1
|
||||
and sf.is_delete = 0
|
||||
and (sf.status_id = 1 or sf.status_id is null)
|
||||
bs.id,
|
||||
bs.manage_tags as bs_manage_tags,
|
||||
bv.variety as variety,
|
||||
bs.family,
|
||||
bst.name as sheep_type,
|
||||
bs.gender,
|
||||
TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) as month_age,
|
||||
bs.current_weight,
|
||||
bs.post_lambing_day,
|
||||
bbs.breed as breed,
|
||||
bs.parity,
|
||||
dsf.sheepfold_name,
|
||||
bs.comment,
|
||||
CASE WHEN bs.is_core = 1 THEN '是' ELSE '否' END as is_core,
|
||||
CASE WHEN bs.is_breeding = 1 THEN '是' ELSE '否' END as is_breeding,
|
||||
CONCAT('胎次:', IFNULL(bs.parity, 0), ' 配种次数:', IFNULL(bs.mating_counts, 0)) as reproduction_info
|
||||
from bas_sheep bs
|
||||
left join bas_sheep_variety bv on bs.variety_id = bv.id
|
||||
left join bas_sheep_type bst on bs.type_id = bst.id
|
||||
left join bas_breed_status bbs on bs.breed_status_id = bbs.id
|
||||
left join da_sheepfold dsf on bs.sheepfold_id = dsf.id
|
||||
where bs.gender = 1
|
||||
and bs.is_delete = 0
|
||||
and (bs.status_id = 1 or bs.status_id is null)
|
||||
and (
|
||||
-- 青年羊或超龄羊的配种条件
|
||||
(sf.name in ('青年羊', '超龄羊') and (
|
||||
(sf.variety = '湖羊' and sf.month_age >= 7.5 and sf.current_weight >= 33) or
|
||||
(sf.variety = '东佛里生' and sf.month_age >= 9 and sf.current_weight >= 50) or
|
||||
(sf.variety not in ('湖羊', '东佛里生') and sf.month_age >= 9 and sf.current_weight >= 50)
|
||||
(bst.name in ('青年羊', '超龄羊') and (
|
||||
(bv.variety = '湖羊' and TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) >= 7.5 and bs.current_weight >= 33) or
|
||||
(bv.variety = '东佛里生' and TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) >= 9 and bs.current_weight >= 50) or
|
||||
(bv.variety not in ('湖羊', '东佛里生') and TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) >= 9 and bs.current_weight >= 50)
|
||||
))
|
||||
or
|
||||
-- 泌乳羊或种母羊的配种条件
|
||||
(sf.name in ('泌乳羊', '种母羊') and sf.post_lambing_day > 45 and sf.current_weight > 0)
|
||||
(bst.name in ('泌乳羊', '种母羊') and bs.post_lambing_day > 45 and bs.current_weight > 0)
|
||||
)
|
||||
order by sf.variety, sf.month_age desc
|
||||
order by bv.variety, TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) desc
|
||||
</select>
|
||||
|
||||
<!-- 筛选符合条件的公羊 -->
|
||||
<select id="selectEligibleRam" resultType="Map">
|
||||
select
|
||||
sf.id,
|
||||
sf.manage_tags as bs_manage_tags,
|
||||
bs.id,
|
||||
bs.manage_tags as bs_manage_tags,
|
||||
bv.variety as variety,
|
||||
bs.family,
|
||||
bst.name as sheep_type,
|
||||
sf.gender,
|
||||
TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) as month_age,
|
||||
sf.current_weight,
|
||||
bs.gender,
|
||||
bs.birthday,
|
||||
TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) as month_age,
|
||||
bs.current_weight,
|
||||
bbs.breed as breed
|
||||
from bas_sheep sf
|
||||
left join bas_sheep_variety bv on sf.variety_id = bv.id
|
||||
left join bas_sheep_type bst on sf.type_id = bst.id
|
||||
left join bas_breed_status bbs on sf.breed_status_id = bbs.id
|
||||
where sf.gender = 2
|
||||
and sf.is_delete = 0
|
||||
and sf.status_id = 1
|
||||
from bas_sheep bs
|
||||
left join bas_sheep_variety bv on bs.variety_id = bv.id
|
||||
left join bas_sheep_type bst on bs.type_id = bst.id
|
||||
left join bas_breed_status bbs on bs.breed_status_id = bbs.id
|
||||
where bs.gender = 2
|
||||
and bs.is_delete = 0
|
||||
and bs.status_id = 1
|
||||
and (
|
||||
-- 青年羊或超龄羊的参配条件
|
||||
(bst.name in ('青年羊', '超龄羊') and (
|
||||
(bv.variety = '湖羊' and TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) >= 7.5 and sf.current_weight >= 33) or
|
||||
(bv.variety = '东佛里生' and TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) >= 9 and sf.current_weight >= 50) or
|
||||
(bv.variety not in ('湖羊', '东佛里生') and TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) >= 9 and sf.current_weight >= 50)
|
||||
(bv.variety = '湖羊' and TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) >= 7.5 and bs.current_weight >= 33) or
|
||||
(bv.variety = '东佛里生' and TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) >= 9 and bs.current_weight >= 50) or
|
||||
(bv.variety not in ('湖羊', '东佛里生') and TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) >= 9 and bs.current_weight >= 50)
|
||||
))
|
||||
or
|
||||
-- 其他类型公羊
|
||||
bst.name not in ('青年羊', '超龄羊')
|
||||
)
|
||||
order by bv.variety, TIMESTAMPDIFF(MONTH, sf.birthday, NOW()) desc
|
||||
order by bv.variety, TIMESTAMPDIFF(MONTH, bs.birthday, NOW()) desc
|
||||
</select>
|
||||
|
||||
<insert id="insertScBreedPlanGenerate" parameterType="ScBreedPlanGenerate" useGeneratedKeys="true" keyProperty="id">
|
||||
@@ -176,25 +191,110 @@
|
||||
where plan_generate_id = #{planGenerateId}
|
||||
</insert>
|
||||
|
||||
<!-- 获取配种计划详情 -->
|
||||
<!-- 获取配种计划详情 - 显示完整字段信息 -->
|
||||
<select id="selectBreedPlanDetails" parameterType="Long" resultType="Map">
|
||||
select
|
||||
temp.id,
|
||||
temp.ram_id,
|
||||
temp.ewe_id,
|
||||
temp.breed_type,
|
||||
ram.bs_manage_tags as ram_manage_tags,
|
||||
ram.variety as ram_variety,
|
||||
ewe.bs_manage_tags as ewe_manage_tags,
|
||||
ewe.variety as ewe_variety,
|
||||
ewe.current_weight as ewe_weight
|
||||
-- 母羊完整信息
|
||||
ewe.manage_tags as ewe_manage_tags,
|
||||
ewe_variety.variety as ewe_variety,
|
||||
ewe.family as ewe_family,
|
||||
ewe_type.name as ewe_sheep_type,
|
||||
ewe_breed.breed as ewe_breed_status,
|
||||
ewe.parity as ewe_parity,
|
||||
TIMESTAMPDIFF(MONTH, ewe.birthday, NOW()) as ewe_month_age,
|
||||
ewe.current_weight as ewe_current_weight,
|
||||
CASE WHEN ewe.is_core = 1 THEN 1 ELSE 0 END as ewe_is_core,
|
||||
CASE WHEN ewe.is_breeding = 1 THEN 1 ELSE 0 END as ewe_is_breeding,
|
||||
ewe_sheepfold.sheepfold_name as ewe_sheepfold_name,
|
||||
ewe.comment as ewe_comment,
|
||||
CONCAT('胎次:', IFNULL(ewe.parity, 0), ' 配种次数:', IFNULL(ewe.mating_counts, 0)) as ewe_reproduction_info,
|
||||
-- 公羊完整信息 - 直接关联查询耳号
|
||||
ram.manage_tags as ram_manage_tags,
|
||||
ram_variety.variety as ram_variety,
|
||||
ram.family as ram_family,
|
||||
ram_type.name as ram_sheep_type,
|
||||
ram.birthday as ram_birthday,
|
||||
TIMESTAMPDIFF(MONTH, ram.birthday, NOW()) as ram_month_age,
|
||||
ram.current_weight as ram_current_weight
|
||||
from sc_breed_plan_temp temp
|
||||
left join sheep_file ram on temp.ram_id = ram.id
|
||||
left join sheep_file ewe on temp.ewe_id = ewe.id
|
||||
left join bas_sheep ewe on ewe.id = CAST(temp.ewe_id AS UNSIGNED)
|
||||
left join bas_sheep_variety ewe_variety on ewe.variety_id = ewe_variety.id
|
||||
left join bas_sheep_type ewe_type on ewe.type_id = ewe_type.id
|
||||
left join bas_breed_status ewe_breed on ewe.breed_status_id = ewe_breed.id
|
||||
left join da_sheepfold ewe_sheepfold on ewe.sheepfold_id = ewe_sheepfold.id
|
||||
left join bas_sheep ram on ram.id = CAST(temp.ram_id AS UNSIGNED)
|
||||
left join bas_sheep_variety ram_variety on ram.variety_id = ram_variety.id
|
||||
left join bas_sheep_type ram_type on ram.type_id = ram_type.id
|
||||
where temp.plan_generate_id = #{planGenerateId}
|
||||
order by temp.ram_id, temp.ewe_id
|
||||
order by temp.ewe_id, temp.ram_id
|
||||
</select>
|
||||
|
||||
<!-- 获取审批详情 - 包含完整的母羊和公羊信息 -->
|
||||
<select id="selectApproveBreedPlanDetails" parameterType="Long" resultType="Map">
|
||||
select
|
||||
temp.id,
|
||||
temp.ram_id,
|
||||
temp.ewe_id,
|
||||
temp.breed_type,
|
||||
-- 母羊信息
|
||||
ewe.manage_tags as ewe_manage_tags,
|
||||
ewe_variety.variety as ewe_variety,
|
||||
ewe.family as ewe_family,
|
||||
ewe_type.name as ewe_sheep_type,
|
||||
ewe_breed.breed as ewe_breed_status,
|
||||
ewe.parity as ewe_parity,
|
||||
TIMESTAMPDIFF(MONTH, ewe.birthday, NOW()) as ewe_month_age,
|
||||
ewe.current_weight as ewe_current_weight,
|
||||
CASE WHEN ewe.is_core = 1 THEN 1 ELSE 0 END as ewe_is_core,
|
||||
CASE WHEN ewe.is_breeding = 1 THEN 1 ELSE 0 END as ewe_is_breeding,
|
||||
ewe_sheepfold.sheepfold_name as ewe_sheepfold_name,
|
||||
ewe.comment as ewe_comment,
|
||||
CONCAT('胎次:', IFNULL(ewe.parity, 0), ' 配种次数:', IFNULL(ewe.mating_counts, 0)) as ewe_reproduction_info,
|
||||
-- 公羊信息 - 直接关联查询耳号
|
||||
ram.manage_tags as ram_manage_tags,
|
||||
ram_variety.variety as ram_variety,
|
||||
ram.family as ram_family,
|
||||
ram_type.name as ram_sheep_type,
|
||||
ram.birthday as ram_birthday,
|
||||
TIMESTAMPDIFF(MONTH, ram.birthday, NOW()) as ram_month_age,
|
||||
ram.current_weight as ram_current_weight
|
||||
from sc_breed_plan_temp temp
|
||||
left join bas_sheep ewe on ewe.id = CAST(temp.ewe_id AS UNSIGNED)
|
||||
left join bas_sheep_variety ewe_variety on ewe.variety_id = ewe_variety.id
|
||||
left join bas_sheep_type ewe_type on ewe.type_id = ewe_type.id
|
||||
left join bas_breed_status ewe_breed on ewe.breed_status_id = ewe_breed.id
|
||||
left join da_sheepfold ewe_sheepfold on ewe.sheepfold_id = ewe_sheepfold.id
|
||||
left join bas_sheep ram on ram.id = CAST(temp.ram_id AS UNSIGNED)
|
||||
left join bas_sheep_variety ram_variety on ram.variety_id = ram_variety.id
|
||||
left join bas_sheep_type ram_type on ram.type_id = ram_type.id
|
||||
where temp.plan_generate_id = #{planGenerateId}
|
||||
order by temp.ewe_id, temp.ram_id
|
||||
</select>
|
||||
|
||||
<!-- 更新临时配种计划 -->
|
||||
<update id="updateTempBreedPlan">
|
||||
update sc_breed_plan_temp
|
||||
<set>
|
||||
<if test="ramId != null">
|
||||
ram_id = #{ramId},
|
||||
</if>
|
||||
<if test="ramId == null">
|
||||
ram_id = null,
|
||||
</if>
|
||||
<if test="breedType != null">
|
||||
breed_type = #{breedType},
|
||||
</if>
|
||||
<if test="breedType == null">
|
||||
breed_type = null,
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScBreedPlanGenerateById" parameterType="Long">
|
||||
delete from sc_breed_plan_generate where id = #{id}
|
||||
</delete>
|
||||
@@ -205,4 +305,9 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 删除临时配种计划 -->
|
||||
<delete id="deleteTempBreedPlanByPlanId" parameterType="Long">
|
||||
delete from sc_breed_plan_temp where plan_generate_id = #{planGenerateId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -11,9 +11,10 @@
|
||||
<result property="eweId" column="ewe_id" />
|
||||
<result property="technician" column="technician" />
|
||||
<result property="breedDrugs" column="breed_drugs" />
|
||||
<result property="breedType" column="breed_type" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<!-- 新增显示字段 -->
|
||||
<!-- 显示字段 -->
|
||||
<result property="eweManageTags" column="ewe_manage_tags" />
|
||||
<result property="eweVariety" column="ewe_variety" />
|
||||
<result property="ramManageTags" column="ram_manage_tags" />
|
||||
@@ -29,6 +30,16 @@
|
||||
<result property="sheepType" column="sheep_type" />
|
||||
<result property="matingCount" column="mating_count" />
|
||||
<result property="timeSincePlanning" column="time_since_planning" />
|
||||
<!-- 孕检相关字段 -->
|
||||
<result property="pregnancyCheckDate" column="pregnancy_check_date" />
|
||||
<result property="pregnancyResult" column="pregnancy_result" />
|
||||
<result property="pregnancyWay" column="pregnancy_way" />
|
||||
<result property="fetusCount" column="fetus_count" />
|
||||
<result property="pregnancyTechnician" column="pregnancy_technician" />
|
||||
<result property="pregnancyRemark" column="pregnancy_remark" />
|
||||
<result property="pregnancyRecordId" column="pregnancy_record_id" />
|
||||
<result property="daysToPregnancyCheck" column="days_to_pregnancy_check" />
|
||||
<result property="isPregnancyChecked" column="is_pregnancy_checked" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScBreedRecordVo">
|
||||
@@ -39,6 +50,7 @@
|
||||
br.ewe_id,
|
||||
br.technician,
|
||||
br.breed_drugs,
|
||||
br.breed_type,
|
||||
br.create_by,
|
||||
br.create_time,
|
||||
-- 母羊信息(从视图获取)
|
||||
@@ -56,13 +68,45 @@
|
||||
-- 公羊信息(从视图获取)
|
||||
ram_view.bs_manage_tags as ram_manage_tags,
|
||||
ram_view.variety as ram_variety,
|
||||
-- 配种方式(如果视图中没有,设为空或从其他地方获取)
|
||||
'' as mating_type,
|
||||
-- 配种方式显示
|
||||
CASE br.breed_type
|
||||
WHEN 1 THEN '同期发情'
|
||||
WHEN 2 THEN '本交'
|
||||
ELSE '未知'
|
||||
END as mating_type,
|
||||
-- 发情后配种时间(小时数)
|
||||
TIMESTAMPDIFF(HOUR, br.create_time, NOW()) as time_since_planning
|
||||
TIMESTAMPDIFF(HOUR, br.create_time, NOW()) as time_since_planning,
|
||||
-- 孕检相关信息
|
||||
pr.datetime as pregnancy_check_date,
|
||||
pr.result as pregnancy_result,
|
||||
pr.way as pregnancy_way,
|
||||
pr.fetus_count,
|
||||
pr.technician as pregnancy_technician,
|
||||
pr.remark as pregnancy_remark,
|
||||
pr.id as pregnancy_record_id,
|
||||
-- 配种到孕检间隔天数
|
||||
CASE
|
||||
WHEN pr.datetime IS NOT NULL THEN DATEDIFF(pr.datetime, br.create_time)
|
||||
ELSE NULL
|
||||
END as days_to_pregnancy_check,
|
||||
-- 是否已孕检
|
||||
CASE
|
||||
WHEN pr.id IS NOT NULL THEN 1
|
||||
ELSE 0
|
||||
END as is_pregnancy_checked
|
||||
from sc_breed_record br
|
||||
left join sheep_file ewe_view on br.ewe_id = ewe_view.id
|
||||
left join sheep_file ram_view on br.ram_id = ram_view.id
|
||||
left join sc_pregnancy_record pr on pr.sheep_id = br.ewe_id
|
||||
and pr.is_delete = 0
|
||||
and pr.datetime >= br.create_time
|
||||
and pr.datetime = (
|
||||
select min(pr2.datetime)
|
||||
from sc_pregnancy_record pr2
|
||||
where pr2.sheep_id = br.ewe_id
|
||||
and pr2.is_delete = 0
|
||||
and pr2.datetime >= br.create_time
|
||||
)
|
||||
</sql>
|
||||
|
||||
<select id="selectScBreedRecordList" parameterType="ScBreedRecord" resultMap="ScBreedRecordResult">
|
||||
@@ -71,6 +115,7 @@
|
||||
<if test="sheepId != null "> and br.sheep_id = #{sheepId}</if>
|
||||
<if test="ramId != null and ramId != ''"> and br.ram_id = #{ramId}</if>
|
||||
<if test="eweId != null and eweId != ''"> and br.ewe_id = #{eweId}</if>
|
||||
<if test="breedType != null"> and br.breed_type = #{breedType}</if>
|
||||
<if test="technician != null and technician != ''"> and br.technician like concat('%', #{technician}, '%')</if>
|
||||
<if test="breedDrugs != null and breedDrugs != ''"> and br.breed_drugs like concat('%', #{breedDrugs}, '%')</if>
|
||||
<if test="createBy != null and createBy != ''"> and br.create_by like concat('%', #{createBy}, '%')</if>
|
||||
@@ -81,6 +126,12 @@
|
||||
<if test="eweVariety != null and eweVariety != ''"> and ewe_view.variety like concat('%', #{eweVariety}, '%')</if>
|
||||
<if test="ramVariety != null and ramVariety != ''"> and ram_view.variety like concat('%', #{ramVariety}, '%')</if>
|
||||
<if test="ranchId != null"> and ewe_view.ranch_id = #{ranchId}</if>
|
||||
<!-- 孕检相关查询条件 -->
|
||||
<if test="pregnancyResult != null and pregnancyResult != ''"> and pr.result like concat('%', #{pregnancyResult}, '%')</if>
|
||||
<if test="isPregnancyChecked != null">
|
||||
<if test="isPregnancyChecked == 1"> and pr.id IS NOT NULL</if>
|
||||
<if test="isPregnancyChecked == 0"> and pr.id IS NULL</if>
|
||||
</if>
|
||||
</where>
|
||||
order by br.create_time desc
|
||||
</select>
|
||||
@@ -170,19 +221,43 @@
|
||||
ewe_view.bs_manage_tags as ewe_manage_tags,
|
||||
bp.ram_id,
|
||||
ram_view.bs_manage_tags as ram_manage_tags,
|
||||
bp.plan_date,
|
||||
bp.breed_type,
|
||||
bp.technician,
|
||||
bp.status,
|
||||
bp.create_time as plan_create_time,
|
||||
TIMESTAMPDIFF(HOUR, bp.create_time, NOW()) as hours_since_plan
|
||||
CASE bp.breed_type
|
||||
WHEN 1 THEN '同期发情'
|
||||
WHEN 2 THEN '本交'
|
||||
ELSE '未知'
|
||||
END as breed_type_name,
|
||||
TIMESTAMPDIFF(HOUR, NOW(), NOW()) as hours_since_plan
|
||||
from sc_breed_plan bp
|
||||
left join sheep_file ewe_view on bp.ewe_id = ewe_view.id
|
||||
left join sheep_file ram_view on bp.ram_id = ram_view.id
|
||||
where ewe_view.bs_manage_tags = #{manageTags}
|
||||
and bp.status = '待配种'
|
||||
and bp.is_delete = 0
|
||||
order by bp.create_time desc
|
||||
order by bp.id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<!-- 根据母羊耳号获取最新的配种计划信息(从配种计划生成表) -->
|
||||
<select id="getLatestBreedPlanByEweTags" parameterType="String" resultType="map">
|
||||
select
|
||||
bpg.id as plan_generate_id,
|
||||
bpt.ewe_id,
|
||||
ewe_view.bs_manage_tags as ewe_manage_tags,
|
||||
bpt.ram_id,
|
||||
ram_view.bs_manage_tags as ram_manage_tags,
|
||||
bpt.breed_type,
|
||||
CASE bpt.breed_type
|
||||
WHEN 1 THEN '同期发情'
|
||||
WHEN 2 THEN '本交'
|
||||
ELSE '未知'
|
||||
END as breed_type_name,
|
||||
bpg.create_time as plan_create_time
|
||||
from sc_breed_plan_generate bpg
|
||||
inner join sc_breed_plan_temp bpt on bpg.id = bpt.plan_generate_id
|
||||
left join sheep_file ewe_view on bpt.ewe_id = ewe_view.id
|
||||
left join sheep_file ram_view on bpt.ram_id = ram_view.id
|
||||
where ewe_view.bs_manage_tags = #{manageTags}
|
||||
and bpg.status = 1 -- 已审批的计划
|
||||
order by bpg.create_time desc, bpt.id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
@@ -194,6 +269,7 @@
|
||||
<if test="eweId != null">ewe_id,</if>
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="breedDrugs != null">breed_drugs,</if>
|
||||
<if test="breedType != null">breed_type,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
@@ -203,6 +279,7 @@
|
||||
<if test="eweId != null">#{eweId},</if>
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="breedDrugs != null">#{breedDrugs},</if>
|
||||
<if test="breedType != null">#{breedType},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
@@ -216,6 +293,7 @@
|
||||
<if test="eweId != null">ewe_id = #{eweId},</if>
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="breedDrugs != null">breed_drugs = #{breedDrugs},</if>
|
||||
<if test="breedType != null">breed_type = #{breedType},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
@@ -232,4 +310,26 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据羊只ID和配种时间查询配种记录 -->
|
||||
<select id="selectBreedRecordByMatingTime" resultMap="ScBreedRecordResult">
|
||||
<include refid="selectScBreedRecordVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null">and br.ewe_id = #{sheepId}</if>
|
||||
<if test="matingDateStart != null and matingDateStart != ''">
|
||||
and br.create_time >= #{matingDateStart}
|
||||
</if>
|
||||
<if test="matingDateEnd != null and matingDateEnd != ''">
|
||||
and br.create_time <= #{matingDateEnd}
|
||||
</if>
|
||||
</where>
|
||||
order by br.create_time desc
|
||||
</select>
|
||||
|
||||
<!-- 更新配种记录的孕检信息 -->
|
||||
<update id="updatePregnancyInfo">
|
||||
update sc_breed_record
|
||||
set pregnancy_record_id = #{pregnancyRecordId}
|
||||
where id = #{breedRecordId}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -15,6 +15,7 @@
|
||||
<result property="score" column="score" />
|
||||
<result property="comment" column="comment" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<!-- 修复:数据库字段是create_tme,不是create_time -->
|
||||
<result property="createTime" column="create_tme" />
|
||||
</resultMap>
|
||||
|
||||
@@ -66,42 +67,47 @@
|
||||
lr.id, lr.sheep_id, lr.parity, lr.lambs_born, lr.survival,
|
||||
lr.technician, lr.score, lr.comment, lr.create_by, lr.create_tme,
|
||||
|
||||
-- 从bas_sheep表获取母羊信息
|
||||
mother.manage_tags as female_ear_number,
|
||||
mother.variety_id as female_breed,
|
||||
TIMESTAMPDIFF(MONTH, mother.birthday, NOW()) as month_age,
|
||||
mother.sheepfold_id as current_shed,
|
||||
mother.ranch_id as farm,
|
||||
-- 从sheep_file视图获取母羊信息
|
||||
mother.bs_manage_tags as female_ear_number,
|
||||
mother.variety as female_breed,
|
||||
mother.month_age as month_age,
|
||||
mother.sheepfold_name as current_shed,
|
||||
mother.dr_ranch as farm,
|
||||
|
||||
-- 从sc_breed_record表获取配种信息
|
||||
br.create_time as breeding_date,
|
||||
DATEDIFF(lr.create_tme, br.create_time) as pregnancy_days,
|
||||
DATEDIFF(CURDATE(), br.create_time) as pregnancy_days,
|
||||
|
||||
-- 从bas_sheep表获取公羊信息
|
||||
father.manage_tags as male_ear_number,
|
||||
father.variety_id as male_breed,
|
||||
-- 从sheep_file视图获取公羊信息
|
||||
father.bs_manage_tags as male_ear_number,
|
||||
father.variety as male_breed,
|
||||
|
||||
-- 统计羔羊信息(从bas_sheep表统计,根据母羊ID)
|
||||
(SELECT COUNT(*) FROM bas_sheep lamb WHERE lamb.mother_id = lr.sheep_id AND lamb.gender = 1 AND lamb.is_delete = 0) as male_count,
|
||||
(SELECT COUNT(*) FROM bas_sheep lamb WHERE lamb.mother_id = lr.sheep_id AND lamb.gender = 0 AND lamb.is_delete = 0) as female_count,
|
||||
(SELECT COUNT(*) FROM bas_sheep lamb WHERE lamb.mother_id = lr.sheep_id AND lamb.gender = 1 AND lamb.status_id = 1 AND lamb.is_delete = 0) as retained_male_count,
|
||||
(SELECT COUNT(*) FROM bas_sheep lamb WHERE lamb.mother_id = lr.sheep_id AND lamb.gender = 0 AND lamb.status_id = 1 AND lamb.is_delete = 0) as retained_female_count,
|
||||
(SELECT COUNT(*) FROM bas_sheep lamb WHERE lamb.mother_id = lr.sheep_id AND lamb.gender = 1 AND lamb.status_id != 1 AND lamb.is_delete = 0) as unretained_male_count,
|
||||
(SELECT COUNT(*) FROM bas_sheep lamb WHERE lamb.mother_id = lr.sheep_id AND lamb.gender = 0 AND lamb.status_id != 1 AND lamb.is_delete = 0) as unretained_female_count
|
||||
-- 统计羔羊信息(从sc_lamb_detail表统计)
|
||||
(SELECT COUNT(*) FROM sc_lamb_detail sld WHERE sld.lambing_record_id = lr.id AND sld.gender = 1) as male_count,
|
||||
(SELECT COUNT(*) FROM sc_lamb_detail sld WHERE sld.lambing_record_id = lr.id AND sld.gender = 0) as female_count,
|
||||
(SELECT COUNT(*) FROM sc_lamb_detail sld WHERE sld.lambing_record_id = lr.id AND sld.gender = 1 AND sld.is_retained = 1) as retained_male_count,
|
||||
(SELECT COUNT(*) FROM sc_lamb_detail sld WHERE sld.lambing_record_id = lr.id AND sld.gender = 0 AND sld.is_retained = 1) as retained_female_count,
|
||||
(SELECT COUNT(*) FROM sc_lamb_detail sld WHERE sld.lambing_record_id = lr.id AND sld.gender = 1 AND sld.is_retained = 0) as unretained_male_count,
|
||||
(SELECT COUNT(*) FROM sc_lamb_detail sld WHERE sld.lambing_record_id = lr.id AND sld.gender = 0 AND sld.is_retained = 0) as unretained_female_count
|
||||
|
||||
FROM sc_lambing_record lr
|
||||
LEFT JOIN bas_sheep mother ON lr.sheep_id = mother.id
|
||||
LEFT JOIN sc_breed_record br ON lr.sheep_id = br.ewe_id AND lr.parity = mother.parity
|
||||
LEFT JOIN bas_sheep father ON br.ram_id = father.id
|
||||
LEFT JOIN sheep_file mother ON lr.sheep_id = mother.id
|
||||
LEFT JOIN sc_breed_record br ON lr.sheep_id = br.ewe_id AND br.create_time = (
|
||||
SELECT MAX(br2.create_time)
|
||||
FROM sc_breed_record br2
|
||||
WHERE br2.ewe_id = lr.sheep_id
|
||||
AND br2.create_time <= lr.create_tme
|
||||
)
|
||||
LEFT JOIN sheep_file father ON br.ram_id = father.id
|
||||
</sql>
|
||||
|
||||
<!-- 查询产羔记录列表(包含关联信息) -->
|
||||
<select id="selectScLambingRecordList" parameterType="ScLambingRecord" resultMap="ScLambingRecordDetailResult">
|
||||
<include refid="selectScLambingRecordDetailVo"/>
|
||||
<where>
|
||||
<if test="femaleEarNumber != null and femaleEarNumber != ''"> and mother.manage_tags LIKE CONCAT('%', #{femaleEarNumber}, '%')</if>
|
||||
<if test="femaleBreed != null and femaleBreed != ''"> and mother.variety_id = #{femaleBreed}</if>
|
||||
<if test="farm != null and farm != ''"> and mother.ranch_id = #{farm}</if>
|
||||
<if test="femaleEarNumber != null and femaleEarNumber != ''"> and mother.bs_manage_tags LIKE CONCAT('%', #{femaleEarNumber}, '%')</if>
|
||||
<if test="femaleBreed != null and femaleBreed != ''"> and mother.variety LIKE CONCAT('%', #{femaleBreed}, '%')</if>
|
||||
<if test="farm != null and farm != ''"> and mother.dr_ranch LIKE CONCAT('%', #{farm}, '%')</if>
|
||||
<if test="sheepId != null and sheepId != ''"> and lr.sheep_id = #{sheepId}</if>
|
||||
<if test="parity != null"> and lr.parity = #{parity}</if>
|
||||
<if test="lambsBorn != null"> and lr.lambs_born = #{lambsBorn}</if>
|
||||
@@ -134,23 +140,29 @@
|
||||
where lr.id = #{id} and mother.is_delete = 0
|
||||
</select>
|
||||
|
||||
<!-- 查询羔羊详情(从sc_lamb_detail表查询) -->
|
||||
<select id="selectLambDetailByLambingRecordId" parameterType="Long" resultType="ScLambDetail">
|
||||
<!-- 根据母羊耳号查询最新配种记录 -->
|
||||
<select id="getLatestBreedingByEarNumber" parameterType="String" resultType="java.util.Map">
|
||||
SELECT
|
||||
id,
|
||||
lambing_record_id as lambingRecordId,
|
||||
lamb_ear_number as lambEarNumber,
|
||||
lamb_breed as lambBreed,
|
||||
gender,
|
||||
birth_weight as birthWeight,
|
||||
is_retained as isRetained,
|
||||
lineage,
|
||||
birthday,
|
||||
create_by as createBy,
|
||||
create_time as createTime
|
||||
FROM sc_lamb_detail
|
||||
WHERE lambing_record_id = #{lambingRecordId}
|
||||
ORDER BY create_time ASC
|
||||
sf.id as sheep_id,
|
||||
sf.bs_manage_tags as female_ear_number,
|
||||
sf.variety as female_breed,
|
||||
sf.parity as parity,
|
||||
br.ram_id as ram_id,
|
||||
ram.bs_manage_tags as male_ear_number,
|
||||
ram.variety as male_breed,
|
||||
br.create_time as breeding_date,
|
||||
DATEDIFF(CURDATE(), br.create_time) as pregnancy_days,
|
||||
br.technician as technician
|
||||
FROM sheep_file sf
|
||||
LEFT JOIN sc_breed_record br ON sf.id = br.ewe_id
|
||||
LEFT JOIN sheep_file ram ON br.ram_id = ram.id
|
||||
WHERE sf.bs_manage_tags = #{earNumber}
|
||||
AND sf.is_delete = 0
|
||||
AND br.create_time = (
|
||||
SELECT MAX(br2.create_time)
|
||||
FROM sc_breed_record br2
|
||||
WHERE br2.ewe_id = sf.id
|
||||
)
|
||||
</select>
|
||||
|
||||
<!-- 新增产羔记录 -->
|
||||
@@ -191,8 +203,8 @@
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="score != null">score = #{score},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_tme = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
<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" />
|
||||
@@ -32,6 +30,7 @@
|
||||
<result property="expectedDate" column="expected_date" />
|
||||
<result property="lastEventDate" column="last_event_date" />
|
||||
<result property="ranchName" column="ranch" />
|
||||
<result property="daysAfterMating" column="days_after_mating" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScPregnancyRecordVo">
|
||||
@@ -46,8 +45,6 @@
|
||||
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,
|
||||
@@ -55,18 +52,37 @@
|
||||
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
|
||||
sf.dr_ranch as ranch,
|
||||
-- 关联配种信息
|
||||
ram_sf.bs_manage_tags as father_manage_tags,
|
||||
ram_sf.variety as father_variety,
|
||||
mating_type.dict_label as mating_type_name,
|
||||
COALESCE(br.create_time, sf.mating_date) as mating_date,
|
||||
-- 计算配后天数:孕检日期 - 配种日期
|
||||
CASE
|
||||
WHEN COALESCE(br.create_time, sf.mating_date) IS NOT NULL
|
||||
THEN DATEDIFF(pr.datetime, COALESCE(br.create_time, sf.mating_date))
|
||||
ELSE NULL
|
||||
END as days_after_mating
|
||||
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
|
||||
-- 关联配种记录表,获取最新的配种记录
|
||||
left join (
|
||||
select br1.*
|
||||
from sc_breed_record br1
|
||||
inner join (
|
||||
select ewe_id, max(create_time) as max_time
|
||||
from sc_breed_record
|
||||
group by ewe_id
|
||||
) br2 on br1.ewe_id = br2.ewe_id and br1.create_time = br2.max_time
|
||||
) br on sf.id = br.ewe_id
|
||||
-- 关联公羊信息
|
||||
left join sheep_file ram_sf on br.ram_id = ram_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'
|
||||
</sql>
|
||||
|
||||
<select id="selectScPregnancyRecordList" parameterType="ScPregnancyRecord" resultMap="ScPregnancyRecordResult">
|
||||
@@ -86,7 +102,7 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="datetime != null "> and pr.datetime = #{datetime}</if>
|
||||
<if test="datetime != null "> and DATE(pr.datetime) = DATE(#{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>
|
||||
@@ -116,6 +132,28 @@
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<!-- 根据耳号获取配种信息 -->
|
||||
<select id="selectBreedInfoByManageTags" parameterType="String" resultType="map">
|
||||
SELECT
|
||||
sf.bs_manage_tags as manageTags,
|
||||
-- 从配种记录表获取公羊耳号
|
||||
ram_sf.bs_manage_tags as fatherManageTags,
|
||||
ram_sf.variety as fatherVariety,
|
||||
br.create_time as matingDate,
|
||||
mating_type.dict_label as matingTypeName,
|
||||
br.technician as breedTechnician,
|
||||
br.create_time as breedCreateTime
|
||||
FROM sheep_file sf
|
||||
LEFT JOIN sc_breed_record br ON sf.id = br.ewe_id
|
||||
LEFT JOIN sheep_file ram_sf ON br.ram_id = ram_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'
|
||||
WHERE sf.bs_manage_tags = #{manageTags}
|
||||
AND sf.is_delete = 0
|
||||
ORDER BY br.create_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insertScPregnancyRecord" parameterType="ScPregnancyRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_pregnancy_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@@ -153,8 +191,6 @@
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="way != null">way = #{way},</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>
|
||||
@@ -178,7 +214,6 @@
|
||||
<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>
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
|
||||
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectScSheepDeathById" parameterType="Long" resultMap="ScSheepDeathResult">
|
||||
@@ -53,9 +54,21 @@
|
||||
|
||||
<!-- 根据管理耳号查询sheep_file视图信息 -->
|
||||
<select id="selectSheepFileByManageTags" parameterType="String" resultType="java.util.Map">
|
||||
select id as sheepId, variety, name as sheepType, gender, day_age as dayAge, parity, sheepfold_name as sheepfoldName, breed as breedStatus, post_lambing_day as postLambingDay, lactation_day as lactationDay, gestation_day as gestationDay
|
||||
select
|
||||
id as sheepId,
|
||||
variety,
|
||||
name as sheepType,
|
||||
gender,
|
||||
day_age as dayAge,
|
||||
parity,
|
||||
sheepfold_name as sheepfoldName,
|
||||
breed as breedStatus,
|
||||
post_lambing_day as postLambingDay,
|
||||
lactation_day as lactationDay,
|
||||
gestation_day as gestationDay
|
||||
from sheep_file
|
||||
where bs_manage_tags = #{manageTags} and is_delete = 0
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertScSheepDeath" parameterType="ScSheepDeath" useGeneratedKeys="true" keyProperty="id">
|
||||
@@ -131,4 +144,23 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 更新羊只繁育状态 - 保留原有功能 -->
|
||||
<update id="updateSheepFileStatus">
|
||||
UPDATE sheep_file
|
||||
SET breed = #{status},
|
||||
update_time = NOW()
|
||||
WHERE id = #{sheepId}
|
||||
AND is_delete = 0
|
||||
</update>
|
||||
|
||||
<!-- 新增:更新羊只在群状态 -->
|
||||
<update id="updateSheepStatus">
|
||||
UPDATE sheep_file
|
||||
SET status = #{status},
|
||||
update_time = NOW()
|
||||
WHERE id = #{sheepId}
|
||||
AND is_delete = 0
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -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},
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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,23 +23,25 @@
|
||||
|
||||
<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_variety bv ON t.variety_id = bv.id
|
||||
LEFT JOIN bas_sheep bs ON t.sheep_id = bs.id
|
||||
LEFT JOIN bas_sheep_variety bv ON bs.variety_id = bv.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScTransitionInfoList" parameterType="ScTransitionInfo" resultMap="ScTransitionInfoResult">
|
||||
@@ -47,7 +51,15 @@
|
||||
<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="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>
|
||||
<if test="status != null ">and status = #{status}</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>
|
||||
|
||||
@@ -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"/>
|
||||
@@ -21,19 +22,20 @@
|
||||
<sql id="selectScCastrateVo">
|
||||
select sc.id,
|
||||
sc.sheep_id,
|
||||
bs.manage_tags as manageTags,
|
||||
sc.sheepfold,
|
||||
bs.manage_tags as manageTags,
|
||||
'去势' as event_type,
|
||||
bs.sheepfold_id as sheepfold,
|
||||
sf.sheepfold_name as sheepfoldName,
|
||||
sc.variety_id,
|
||||
bv.variety as varietyName,
|
||||
bs.variety_id as varietyId,
|
||||
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
|
||||
left join da_sheepfold sf on bs.sheepfold_id = sf.id
|
||||
left join bas_sheep_variety bv on bs.variety_id = bv.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScCastrateList" parameterType="ScCastrate" resultMap="ScCastrateResult">
|
||||
@@ -42,14 +44,15 @@
|
||||
<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="sheepfold != null ">and bs.sheepfold_id = #{sheepfold}</if>
|
||||
<if test="varietyId != null">and bs.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>
|
||||
ORDER BY sc.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectScCastrateById" parameterType="Long" resultMap="ScCastrateResult">
|
||||
|
||||
@@ -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"/>
|
||||
@@ -18,29 +19,28 @@
|
||||
|
||||
<sql id="selectScFixHoofVo">
|
||||
select fh.id,
|
||||
bs.manage_tags AS manageTags,
|
||||
fh.sheepfold,
|
||||
sf.sheepfold_name AS sheepfoldName,
|
||||
fh.variety_id,
|
||||
bv.variety AS varietyName,
|
||||
bs.manage_tags as manageTags,
|
||||
'修蹄' as event_type,
|
||||
bs.sheepfold_id as sheepfold,
|
||||
sf.sheepfold_name as sheepfoldName,
|
||||
bs.variety_id as varietyId,
|
||||
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
|
||||
left join da_sheepfold sf on bs.sheepfold_id = sf.id
|
||||
left join bas_sheep_variety bv on bs.variety_id = bv.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScFixHoofList" parameterType="ScFixHoof" resultMap="ScFixHoofResult">
|
||||
<include refid="selectScFixHoofVo"/>
|
||||
<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="sheepfold != null ">and bs.sheepfold_id = #{sheepfold}</if>
|
||||
<if test="varietyId != null">and bs.variety_id = #{varietyId}</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and fh.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
@@ -48,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">
|
||||
|
||||
Reference in New Issue
Block a user