配种计划页面修复,功能加强
This commit is contained in:
@@ -4,6 +4,43 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.produce.breed.mapper.ScBreedRecordMapper">
|
||||
|
||||
<!-- <resultMap type="ScBreedRecord" id="ScBreedRecordResult">-->
|
||||
<!-- <result property="id" column="id" />-->
|
||||
<!-- <result property="sheepId" column="sheep_id" />-->
|
||||
<!-- <result property="ramId" column="ram_id" />-->
|
||||
<!-- <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" />-->
|
||||
<!-- <result property="ramVariety" column="ram_variety" />-->
|
||||
<!-- <result property="eweParity" column="ewe_parity" />-->
|
||||
<!-- <result property="eweMonthAge" column="ewe_month_age" />-->
|
||||
<!-- <result property="eweSheepfoldName" column="ewe_sheepfold_name" />-->
|
||||
<!-- <result property="eweBreedStatus" column="ewe_breed_status" />-->
|
||||
<!-- <result property="eweControlled" column="ewe_controlled" />-->
|
||||
<!-- <result property="eweComment" column="ewe_comment" />-->
|
||||
<!-- <result property="ranchName" column="ranch_name" />-->
|
||||
<!-- <result property="matingType" column="mating_type" />-->
|
||||
<!-- <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>-->
|
||||
<resultMap type="ScBreedRecord" id="ScBreedRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
@@ -12,9 +49,14 @@
|
||||
<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="frozenSemenNo" column="frozen_semen_no" /> <result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<!-- 显示字段 -->
|
||||
<result property="comment" column="comment" />
|
||||
|
||||
<result property="embryoCount" column="embryo_count" />
|
||||
<result property="donorEweNo" column="donor_ewe" />
|
||||
<result property="donorRamNo" column="donor_ram" />
|
||||
|
||||
<result property="eweManageTags" column="ewe_manage_tags" />
|
||||
<result property="eweVariety" column="ewe_variety" />
|
||||
<result property="ramManageTags" column="ram_manage_tags" />
|
||||
@@ -26,24 +68,26 @@
|
||||
<result property="eweControlled" column="ewe_controlled" />
|
||||
<result property="eweComment" column="ewe_comment" />
|
||||
<result property="ranchName" column="ranch_name" />
|
||||
<result property="matingType" column="mating_type" />
|
||||
<result property="sheepType" column="sheep_type" />
|
||||
<result property="matingCount" column="mating_count" />
|
||||
|
||||
<result property="timeSincePlanning" column="time_since_planning" />
|
||||
<!-- 孕检相关字段 -->
|
||||
<result property="daysPostLambing" column="days_post_lambing" />
|
||||
<result property="daysLactation" column="days_lactation" />
|
||||
<result property="daysPostMating" column="days_post_mating" />
|
||||
<result property="lastMatingDate" column="last_mating_date" />
|
||||
|
||||
<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="eweParity" column="eweParity" />
|
||||
|
||||
|
||||
<result property="pregnancyRecordId" column="pregnancy_record_id" />
|
||||
<result property="daysToPregnancyCheck" column="days_to_pregnancy_check" />
|
||||
<result property="isPregnancyChecked" column="is_pregnancy_checked" />
|
||||
</resultMap>
|
||||
|
||||
</resultMap>
|
||||
<!-- <sql id="selectScBreedRecordVo">-->
|
||||
<!-- select-->
|
||||
<!-- select DISTINCT-->
|
||||
<!-- br.id,-->
|
||||
<!-- br.sheep_id,-->
|
||||
<!-- br.ram_id,-->
|
||||
@@ -68,7 +112,8 @@
|
||||
<!-- -- 公羊信息(从视图获取)-->
|
||||
<!-- ram_view.bs_manage_tags as ram_manage_tags,-->
|
||||
<!-- ram_view.variety as ram_variety,-->
|
||||
<!-- -- 配种方式显示(修改:增加3-冲胚、4-自然发情人工授精)-->
|
||||
|
||||
<!-- -- 配种方式显示-->
|
||||
<!-- CASE br.breed_type-->
|
||||
<!-- WHEN 1 THEN '同期发情'-->
|
||||
<!-- WHEN 2 THEN '本交'-->
|
||||
@@ -99,15 +144,15 @@
|
||||
<!-- 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-->
|
||||
<!-- -- 修复:使用子查询确保只返回一条孕检记录-->
|
||||
<!-- left join sc_pregnancy_record pr on pr.id = (-->
|
||||
<!-- select pr2.id-->
|
||||
<!-- from sc_pregnancy_record pr2-->
|
||||
<!-- where pr2.sheep_id = br.ewe_id-->
|
||||
<!-- and pr2.is_delete = 0-->
|
||||
<!-- and pr2.datetime >= br.create_time-->
|
||||
<!-- order by pr2.datetime asc, pr2.id asc-->
|
||||
<!-- limit 1-->
|
||||
<!-- )-->
|
||||
<!-- </sql>-->
|
||||
<sql id="selectScBreedRecordVo">
|
||||
@@ -119,9 +164,19 @@
|
||||
br.technician,
|
||||
br.breed_drugs,
|
||||
br.breed_type,
|
||||
br.frozen_sperm_no, -- 冻精号
|
||||
br.comment,
|
||||
br.create_by,
|
||||
br.create_time,
|
||||
-- 母羊信息(从视图获取)
|
||||
|
||||
-- 胚胎移植相关字段 (如果不存表里,需要join sc_embryo_flush,这里假设存表或已有字段,如需Join请参考下方注释)
|
||||
-- 假设表里已有这些列,或者我们通过Join sheep_file 拿(但sheep_file没有donor信息)
|
||||
-- 这里按照最佳实践,应在插入时将Donor信息固化在breed_record表中
|
||||
br.donor_ewe,
|
||||
br.donor_ram,
|
||||
br.embryo_count,
|
||||
|
||||
-- 母羊信息
|
||||
ewe_view.bs_manage_tags as ewe_manage_tags,
|
||||
ewe_view.variety as ewe_variety,
|
||||
ewe_view.parity as ewe_parity,
|
||||
@@ -133,19 +188,51 @@
|
||||
ewe_view.dr_ranch as ranch_name,
|
||||
ewe_view.name as sheep_type,
|
||||
ewe_view.mating_total as mating_count,
|
||||
-- 公羊信息(从视图获取)
|
||||
|
||||
-- 公羊信息
|
||||
ram_view.bs_manage_tags as ram_manage_tags,
|
||||
ram_view.variety as ram_variety,
|
||||
-- 配种方式显示
|
||||
CASE br.breed_type
|
||||
WHEN 1 THEN '同期发情'
|
||||
WHEN 2 THEN '本交'
|
||||
WHEN 3 THEN '冲胚'
|
||||
WHEN 4 THEN '自然发情人工授精'
|
||||
ELSE '未知'
|
||||
END as mating_type,
|
||||
|
||||
-- 发情后配种时间(小时数)
|
||||
TIMESTAMPDIFF(HOUR, br.create_time, NOW()) as time_since_planning,
|
||||
|
||||
-- ================= 计算字段实现 =================
|
||||
|
||||
-- 1. 配种时产后天数 (距离上一次产羔: 找最近一次小于配种时间的产羔日期)
|
||||
DATEDIFF(br.create_time, (
|
||||
SELECT lambing_date
|
||||
FROM sheep_file
|
||||
WHERE id = br.ewe_id
|
||||
)) as days_post_lambing,
|
||||
|
||||
-- 2. 配种时泌乳天数 (距离上一次孕检且怀孕)
|
||||
DATEDIFF(br.create_time, (
|
||||
SELECT MAX(pr_sub.datetime)
|
||||
FROM sc_pregnancy_record pr_sub
|
||||
WHERE pr_sub.sheep_id = br.ewe_id
|
||||
AND pr_sub.result = '怀孕'
|
||||
AND pr_sub.is_delete = 0
|
||||
AND pr_sub.datetime < br.create_time
|
||||
)) as days_lactation,
|
||||
|
||||
-- 3. 配种时配后天数 (距离上一次配种)
|
||||
DATEDIFF(br.create_time, (
|
||||
SELECT MAX(br_sub.create_time)
|
||||
FROM sc_breed_record br_sub
|
||||
WHERE br_sub.ewe_id = br.ewe_id
|
||||
AND br_sub.create_time < br.create_time
|
||||
)) as days_post_mating,
|
||||
|
||||
-- 4. 上次配种日期
|
||||
(
|
||||
SELECT MAX(br_sub.create_time)
|
||||
FROM sc_breed_record br_sub
|
||||
WHERE br_sub.ewe_id = br.ewe_id
|
||||
AND br_sub.create_time < br.create_time
|
||||
) as last_mating_date,
|
||||
|
||||
-- ===============================================
|
||||
|
||||
-- 孕检相关信息
|
||||
pr.datetime as pregnancy_check_date,
|
||||
pr.result as pregnancy_result,
|
||||
@@ -164,10 +251,10 @@
|
||||
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.id = (
|
||||
select pr2.id
|
||||
from sc_pregnancy_record pr2
|
||||
@@ -178,6 +265,32 @@
|
||||
limit 1
|
||||
)
|
||||
</sql>
|
||||
<!-- <select id="selectScBreedRecordList" parameterType="ScBreedRecord" resultMap="ScBreedRecordResult">-->
|
||||
<!-- <include refid="selectScBreedRecordVo"/>-->
|
||||
<!-- <where>-->
|
||||
<!-- <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>-->
|
||||
<!-- <if test="createTime != null "> and date_format(br.create_time,'%y-%m-%d') = date_format(#{createTime},'%y-%m-%d')</if>-->
|
||||
<!-- <!– 新增耳号查询条件 –>-->
|
||||
<!-- <if test="eweManageTags != null and eweManageTags != ''"> and ewe_view.bs_manage_tags like concat('%', #{eweManageTags}, '%')</if>-->
|
||||
<!-- <if test="ramManageTags != null and ramManageTags != ''"> and ram_view.bs_manage_tags like concat('%', #{ramManageTags}, '%')</if>-->
|
||||
<!-- <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>-->
|
||||
<select id="selectScBreedRecordList" parameterType="ScBreedRecord" resultMap="ScBreedRecordResult">
|
||||
<include refid="selectScBreedRecordVo"/>
|
||||
<where>
|
||||
@@ -185,22 +298,20 @@
|
||||
<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>
|
||||
<if test="createTime != null "> and date_format(br.create_time,'%y-%m-%d') = date_format(#{createTime},'%y-%m-%d')</if>
|
||||
<!-- 新增耳号查询条件 -->
|
||||
<if test="eweManageTags != null and eweManageTags != ''"> and ewe_view.bs_manage_tags like concat('%', #{eweManageTags}, '%')</if>
|
||||
<if test="ramManageTags != null and ramManageTags != ''"> and ram_view.bs_manage_tags like concat('%', #{ramManageTags}, '%')</if>
|
||||
<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 test="eweManageTags != null and eweManageTags != ''">
|
||||
and (
|
||||
ewe_view.bs_manage_tags like concat('%', #{eweManageTags}, '%')
|
||||
OR br.donor_ewe_no like concat('%', #{eweManageTags}, '%') -- Also search donor
|
||||
)
|
||||
</if>
|
||||
<if test="ramManageTags != null and ramManageTags != ''">
|
||||
and (
|
||||
ram_view.bs_manage_tags like concat('%', #{ramManageTags}, '%')
|
||||
OR br.donor_ram like concat('%', #{ramManageTags}, '%') -- Also search donor
|
||||
)
|
||||
</if>
|
||||
<if test="frozenSemenNo != null and frozenSemenNo != ''"> and br.frozen_sperm_no like concat('%', #{frozenSemenNo}, '%')</if>
|
||||
</where>
|
||||
order by br.create_time desc
|
||||
</select>
|
||||
@@ -334,6 +445,29 @@
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<!-- <insert id="insertScBreedRecord" parameterType="ScBreedRecord" useGeneratedKeys="true" keyProperty="id">-->
|
||||
<!-- insert into sc_breed_record-->
|
||||
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
|
||||
<!-- <if test="sheepId != null">sheep_id,</if>-->
|
||||
<!-- <if test="ramId != null">ram_id,</if>-->
|
||||
<!-- <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>-->
|
||||
<!-- <trim prefix="values (" suffix=")" suffixOverrides=",">-->
|
||||
<!-- <if test="sheepId != null">#{sheepId},</if>-->
|
||||
<!-- <if test="ramId != null">#{ramId},</if>-->
|
||||
<!-- <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>-->
|
||||
<!-- </insert>-->
|
||||
<insert id="insertScBreedRecord" parameterType="ScBreedRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_breed_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@@ -343,8 +477,13 @@
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="breedDrugs != null">breed_drugs,</if>
|
||||
<if test="breedType != null">breed_type,</if>
|
||||
<if test="frozenSemenNo != null">frozen_semen_no,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="embryoCount != null">embryo_count,</if>
|
||||
<if test="donorEweNo != null">donor_ewe,</if>
|
||||
<if test="donorRamNo != null">donor_ram,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
@@ -353,11 +492,31 @@
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="breedDrugs != null">#{breedDrugs},</if>
|
||||
<if test="breedType != null">#{breedType},</if>
|
||||
<if test="frozenSemenNo != null">#{frozenSemenNo},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="embryoCount != null">#{embryoCount},</if>
|
||||
<if test="donorEweNo != null">#{donorEweNo},</if>
|
||||
<if test="donorRamNo != null">#{donorRamNo},</if>
|
||||
<if test="embryoSubType != null">#{embryoSubType},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- <update id="updateScBreedRecord" parameterType="ScBreedRecord">-->
|
||||
<!-- update sc_breed_record-->
|
||||
<!-- <trim prefix="SET" suffixOverrides=",">-->
|
||||
<!-- <if test="sheepId != null">sheep_id = #{sheepId},</if>-->
|
||||
<!-- <if test="ramId != null">ram_id = #{ramId},</if>-->
|
||||
<!-- <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>-->
|
||||
<!-- where id = #{id}-->
|
||||
<!-- </update>-->
|
||||
<update id="updateScBreedRecord" parameterType="ScBreedRecord">
|
||||
update sc_breed_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
@@ -367,12 +526,34 @@
|
||||
<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="frozenSemenNo != null">frozen_semen_no = #{frozenSemenNo},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="embryoCount != null">embryo_count = #{embryoCount},</if>
|
||||
<if test="donorEweNo != null">donor_ewe = #{donorEweNo},</if>
|
||||
<if test="donorRamNo != null">donor_ram = #{donorRamNo},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getFlushRecordByEweNo" parameterType="String" resultType="map">
|
||||
SELECT
|
||||
transferred,
|
||||
donor_female_no,
|
||||
donor_male_no,
|
||||
embryo_type,
|
||||
storage_method
|
||||
FROM sc_embryo_flush
|
||||
WHERE id = (
|
||||
-- Assuming linking via recipient tags is complicated,
|
||||
-- usually this is done by matching a recent flush record
|
||||
-- For now, this mimics the logic in your ServiceImpl
|
||||
SELECT id FROM sc_embryo_flush WHERE recipient_list LIKE concat('%', #{manageTags}, '%')
|
||||
ORDER BY created_at DESC LIMIT 1
|
||||
)
|
||||
-- Note: If your sc_embryo_flush structure is different (one row per recipient), adjust accordingly.
|
||||
-- Based on provided file, it has `recipient_cnt`.
|
||||
</select>
|
||||
<delete id="deleteScBreedRecordById" parameterType="Long">
|
||||
delete from sc_breed_record where id = #{id}
|
||||
</delete>
|
||||
|
||||
Reference in New Issue
Block a user