配种记录和冲胚记录所有逻辑修改完成
This commit is contained in:
@@ -4,43 +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" />-->
|
||||
<!-- <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" />
|
||||
@@ -49,11 +49,12 @@
|
||||
<result property="technician" column="technician" />
|
||||
<result property="breedDrugs" column="breed_drugs" />
|
||||
<result property="breedType" column="breed_type" />
|
||||
<result property="frozenSemenNo" column="frozen_semen_no" /> <result property="createBy" column="create_by" />
|
||||
<result property="frozenSemenNo" column="frozen_sperm_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="embryoSubType" column="embryoSubType" />
|
||||
<result property="donorEweNo" column="donor_ewe" />
|
||||
<result property="donorRamNo" column="donor_ram" />
|
||||
|
||||
@@ -86,75 +87,75 @@
|
||||
<result property="daysToPregnancyCheck" column="days_to_pregnancy_check" />
|
||||
|
||||
</resultMap>
|
||||
<!-- <sql id="selectScBreedRecordVo">-->
|
||||
<!-- select DISTINCT-->
|
||||
<!-- br.id,-->
|
||||
<!-- br.sheep_id,-->
|
||||
<!-- br.ram_id,-->
|
||||
<!-- br.ewe_id,-->
|
||||
<!-- br.technician,-->
|
||||
<!-- br.breed_drugs,-->
|
||||
<!-- br.breed_type,-->
|
||||
<!-- br.create_by,-->
|
||||
<!-- br.create_time,-->
|
||||
<!-- -- 母羊信息(从视图获取)-->
|
||||
<!-- ewe_view.bs_manage_tags as ewe_manage_tags,-->
|
||||
<!-- ewe_view.variety as ewe_variety,-->
|
||||
<!-- ewe_view.parity as ewe_parity,-->
|
||||
<!-- ewe_view.month_age as ewe_month_age,-->
|
||||
<!-- ewe_view.sheepfold_name as ewe_sheepfold_name,-->
|
||||
<!-- ewe_view.breed as ewe_breed_status,-->
|
||||
<!-- ewe_view.controlled as ewe_controlled,-->
|
||||
<!-- ewe_view.comment as ewe_comment,-->
|
||||
<!-- 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,-->
|
||||
<!-- <sql id="selectScBreedRecordVo">-->
|
||||
<!-- select DISTINCT-->
|
||||
<!-- br.id,-->
|
||||
<!-- br.sheep_id,-->
|
||||
<!-- br.ram_id,-->
|
||||
<!-- br.ewe_id,-->
|
||||
<!-- br.technician,-->
|
||||
<!-- br.breed_drugs,-->
|
||||
<!-- br.breed_type,-->
|
||||
<!-- br.create_by,-->
|
||||
<!-- br.create_time,-->
|
||||
<!-- -- 母羊信息(从视图获取)-->
|
||||
<!-- ewe_view.bs_manage_tags as ewe_manage_tags,-->
|
||||
<!-- ewe_view.variety as ewe_variety,-->
|
||||
<!-- ewe_view.parity as ewe_parity,-->
|
||||
<!-- ewe_view.month_age as ewe_month_age,-->
|
||||
<!-- ewe_view.sheepfold_name as ewe_sheepfold_name,-->
|
||||
<!-- ewe_view.breed as ewe_breed_status,-->
|
||||
<!-- ewe_view.controlled as ewe_controlled,-->
|
||||
<!-- ewe_view.comment as ewe_comment,-->
|
||||
<!-- 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,-->
|
||||
<!-- -- 孕检相关信息-->
|
||||
<!-- 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.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>-->
|
||||
<!-- -- 配种方式显示-->
|
||||
<!-- 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,-->
|
||||
<!-- -- 孕检相关信息-->
|
||||
<!-- 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.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">
|
||||
select DISTINCT
|
||||
br.id,
|
||||
@@ -165,6 +166,7 @@
|
||||
br.breed_drugs,
|
||||
br.breed_type,
|
||||
br.frozen_sperm_no, -- 冻精号
|
||||
br.embryoSubType,
|
||||
br.comment,
|
||||
br.create_by,
|
||||
br.create_time,
|
||||
@@ -192,7 +194,8 @@
|
||||
-- 公羊信息
|
||||
ram_view.bs_manage_tags as ram_manage_tags,
|
||||
ram_view.variety as ram_variety,
|
||||
|
||||
(SELECT variety FROM sheep_file WHERE bs_manage_tags = br.donor_ewe LIMIT 1) as donorEweVariety,
|
||||
(SELECT variety FROM sheep_file WHERE bs_manage_tags = br.donor_ram LIMIT 1) as donorRamVariety,
|
||||
-- 发情后配种时间(小时数)
|
||||
TIMESTAMPDIFF(HOUR, br.create_time, NOW()) as time_since_planning,
|
||||
|
||||
@@ -265,32 +268,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>-->
|
||||
<!-- <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>
|
||||
@@ -321,6 +324,8 @@
|
||||
where br.id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!-- 根据母羊耳号查询羊只ID -->
|
||||
<select id="getSheepIdByManageTags" parameterType="String" resultType="Long">
|
||||
select id from sheep_file where bs_manage_tags = #{manageTags} and is_delete = 0
|
||||
@@ -445,29 +450,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=",">-->
|
||||
<!-- <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=",">
|
||||
@@ -477,13 +482,14 @@
|
||||
<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="frozenSemenNo != null">frozen_sperm_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>
|
||||
<if test="embryoSubType != null">embryoSubType,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
@@ -503,20 +509,20 @@
|
||||
</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=",">-->
|
||||
<!-- <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=",">
|
||||
@@ -526,13 +532,14 @@
|
||||
<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="frozenSemenNo != null">frozen_sperm_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>
|
||||
<if test="embryoSubType != null">embryoSubType = #{embryoSubType},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
@@ -548,8 +555,8 @@
|
||||
-- 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
|
||||
SELECT id FROM sc_embryo_flush WHERE donor_female_no LIKE concat('%', #{manageTags}, '%')
|
||||
ORDER BY flush_time 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`.
|
||||
|
||||
@@ -203,13 +203,9 @@
|
||||
<!-- ewe_id存的是数字ID,需要先根据耳号找到母羊ID,再查配种记录,再根据公羊ID找到公羊耳号 -->
|
||||
<select id="selectBreedRecordByEwe" resultType="java.util.Map">
|
||||
SELECT
|
||||
ram_sf.bs_manage_tags AS ramId,
|
||||
br.create_time AS matingDate
|
||||
FROM sc_breed_record br
|
||||
INNER JOIN sheep_file ewe_sf ON ewe_sf.id = br.ewe_id
|
||||
INNER JOIN sheep_file ram_sf ON ram_sf.id = br.ram_id
|
||||
WHERE ewe_sf.bs_manage_tags = #{eweManageTag}
|
||||
ORDER BY br.create_time DESC
|
||||
donor_ram AS donorMaleNo, create_time AS matingDate FROM sc_breed_record
|
||||
WHERE donor_ewe = #{eweManageTag} AND (is_delete = 0 OR is_delete IS NULL)
|
||||
ORDER BY create_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user