更新了配种计划和配种记录
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user