配种记录和冲胚记录所有逻辑修改完成
This commit is contained in:
@@ -143,8 +143,8 @@ public class ScBreedRecordController extends BaseController
|
|||||||
if (scBreedRecord.getBreedType() == null) {
|
if (scBreedRecord.getBreedType() == null) {
|
||||||
return error("配种方式不能为空");
|
return error("配种方式不能为空");
|
||||||
}
|
}
|
||||||
if (scBreedRecord.getBreedType() < 1 || scBreedRecord.getBreedType() > 4) {
|
if (scBreedRecord.getBreedType() < 1 || scBreedRecord.getBreedType() > 5) {
|
||||||
return error("配种方式只能是:1-同期发情、2-本交、3-冲胚、4-自然发情人工授精");
|
return error("配种方式只能是:1-供体母羊配种、2-同期发情人工授精、3-本交、4-自然发情人工授精、5-胚胎移植");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证技术员
|
// 验证技术员
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zhyc.module.produce.breed.domain;
|
package com.zhyc.module.produce.breed.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -37,6 +38,8 @@ public class ScBreedRecord extends BaseEntity
|
|||||||
@Excel(name = "事件类型")
|
@Excel(name = "事件类型")
|
||||||
private String eventType = "配种";
|
private String eventType = "配种";
|
||||||
|
|
||||||
|
// 核心注解:指定JSON解析/序列化的日期格式,时区指定为东八区(Asia/Shanghai)
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
|
||||||
@Excel(name = "配种日期", dateFormat = "yyyy-MM-dd")
|
@Excel(name = "配种日期", dateFormat = "yyyy-MM-dd")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
@@ -62,7 +65,7 @@ public class ScBreedRecord extends BaseEntity
|
|||||||
private Integer embryoCount;
|
private Integer embryoCount;
|
||||||
|
|
||||||
/** 1-同期发情, 2-本交, 3-自然发情, 4-胚胎移植 */
|
/** 1-同期发情, 2-本交, 3-自然发情, 4-胚胎移植 */
|
||||||
@Excel(name = "配种方式", readConverterExp = "1=同期发情,2=本交,3=自然发情,4=胚胎移植")
|
@Excel(name = "配种方式", readConverterExp = "1=供体母羊配种,2=同期发情人工授精,3=本交,4=胚胎移植,5=自然发情人工授精")
|
||||||
private Integer breedType;
|
private Integer breedType;
|
||||||
|
|
||||||
@Excel(name = "配种子类型")
|
@Excel(name = "配种子类型")
|
||||||
|
|||||||
@@ -217,58 +217,28 @@ public class ScBreedRecordServiceImpl implements IScBreedRecordService
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
/**
|
/**
|
||||||
* 根据母羊耳号获取最新的配种计划信息
|
* 简化后的获取配种计划方法:移除冲胚记录自动关联
|
||||||
* 修改逻辑:优先查配种计划 -> 其次查冲胚记录(作为受体)
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getLatestBreedPlanByEweTags(String manageTags)
|
public Map<String, Object> getLatestBreedPlanByEweTags(String manageTags) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
// 1. 优先从配种计划生成表获取最新计划 (同期发情/本交等)
|
// 1. 仅从配种计划生成表获取(本交、人工授精等普通计划)
|
||||||
Map<String, Object> latestPlan = scBreedRecordMapper.getLatestBreedPlanByEweTags(manageTags);
|
Map<String, Object> latestPlan = scBreedRecordMapper.getLatestBreedPlanByEweTags(manageTags);
|
||||||
if (latestPlan != null && !latestPlan.isEmpty()) {
|
if (latestPlan != null && !latestPlan.isEmpty()) {
|
||||||
log.info("从配种计划生成表获取到配种计划: {}", latestPlan);
|
|
||||||
return latestPlan;
|
return latestPlan;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 如果生成表中没有,从普通配种计划表获取
|
// 2. 从普通配种计划表获取
|
||||||
Map<String, Object> normalPlan = scBreedRecordMapper.getBreedPlanByEweTags(manageTags);
|
Map<String, Object> normalPlan = scBreedRecordMapper.getBreedPlanByEweTags(manageTags);
|
||||||
if (normalPlan != null && !normalPlan.isEmpty()) {
|
if (normalPlan != null && !normalPlan.isEmpty()) {
|
||||||
log.info("从配种计划表获取到配种计划: {}", normalPlan);
|
|
||||||
return normalPlan;
|
return normalPlan;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 【新增逻辑】如果都没有,尝试从冲胚记录中查找(该羊是否作为受体)
|
// 胚胎移植逻辑已移至前端手动输入,此处不再查询 sc_embryo_flush
|
||||||
// 这里的业务逻辑是:如果这只羊在冲胚记录的"受体列表"中,且是最近的操作,则认为它是去做胚胎移植
|
log.info("未找到母羊 {} 的普通配种计划", manageTags);
|
||||||
Map<String, Object> flushRecord = scBreedRecordMapper.getFlushRecordByEweNo(manageTags);
|
|
||||||
if (flushRecord != null && !flushRecord.isEmpty()) {
|
|
||||||
log.info("从冲胚记录获取到移植信息: {}", flushRecord);
|
|
||||||
|
|
||||||
// 构造一个符合前端预期的Map结构
|
|
||||||
Map<String, Object> etPlan = new HashMap<>();
|
|
||||||
etPlan.put("breed_type", 5); // 设定 5 为胚胎移植
|
|
||||||
etPlan.put("breedType", 5); // 驼峰兼容
|
|
||||||
etPlan.put("breed_type_name", "胚胎移植");
|
|
||||||
|
|
||||||
// 填充冲胚记录带来的数据
|
|
||||||
etPlan.put("donorEweNo", flushRecord.get("donor_female_no")); // 供体母羊
|
|
||||||
etPlan.put("donorRamNo", flushRecord.get("donor_male_no")); // 供体公羊
|
|
||||||
etPlan.put("embryoCount", flushRecord.get("transferred")); // 移胚数
|
|
||||||
|
|
||||||
// 拼接配种子类型 (例如: 体内供体 鲜胚)
|
|
||||||
String subType = "";
|
|
||||||
if (flushRecord.get("embryo_type") != null) subType += flushRecord.get("embryo_type");
|
|
||||||
if (flushRecord.get("storage_method") != null) subType += " " + flushRecord.get("storage_method");
|
|
||||||
etPlan.put("embryoSubType", subType.trim());
|
|
||||||
|
|
||||||
return etPlan;
|
|
||||||
}
|
|
||||||
|
|
||||||
log.warn("未找到母羊耳号 {} 的配种或移植计划信息", manageTags);
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取配种/移植计划信息时发生异常,母羊耳号: {}", manageTags, e);
|
log.error("获取配种计划异常", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ public class ScEmbryoFlushServiceImpl implements IScEmbryoFlushService
|
|||||||
VARIETY_NAME_MAP.put(4, "级杂一代");
|
VARIETY_NAME_MAP.put(4, "级杂一代");
|
||||||
VARIETY_NAME_MAP.put(5, "级杂二代");
|
VARIETY_NAME_MAP.put(5, "级杂二代");
|
||||||
VARIETY_NAME_MAP.put(6, "级杂三代");
|
VARIETY_NAME_MAP.put(6, "级杂三代");
|
||||||
VARIETY_NAME_MAP.put(7, "1世代");
|
VARIETY_NAME_MAP.put(7, "一世代");
|
||||||
VARIETY_NAME_MAP.put(8, "2世代");
|
VARIETY_NAME_MAP.put(8, "二世代");
|
||||||
VARIETY_NAME_MAP.put(9, "3世代");
|
VARIETY_NAME_MAP.put(9, "三世代");
|
||||||
VARIETY_NAME_MAP.put(10, "4世代");
|
VARIETY_NAME_MAP.put(10, "四世代");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -142,23 +142,24 @@ public class ScEmbryoFlushServiceImpl implements IScEmbryoFlushService
|
|||||||
// 2. 查询配种记录获取公羊信息
|
// 2. 查询配种记录获取公羊信息
|
||||||
Map<String, Object> breedRecord = scEmbryoFlushMapper.selectBreedRecordByEwe(donorFemaleNo);
|
Map<String, Object> breedRecord = scEmbryoFlushMapper.selectBreedRecordByEwe(donorFemaleNo);
|
||||||
if (breedRecord != null && !breedRecord.isEmpty()) {
|
if (breedRecord != null && !breedRecord.isEmpty()) {
|
||||||
String ramId = (String) breedRecord.get("ramId");
|
String maleNo = (String) breedRecord.get("donorMaleNo"); // 这里的 Key 必须对应 SQL 里的别名
|
||||||
result.put("donorMaleNo", ramId);
|
result.put("donorMaleNo", maleNo);
|
||||||
result.put("matingDate", breedRecord.get("matingDate"));
|
result.put("matingDate", breedRecord.get("matingDate"));
|
||||||
|
|
||||||
// 3. 查询公羊品种
|
// 3. 查询公羊品种
|
||||||
if (ramId != null && !ramId.trim().isEmpty()) {
|
if (maleNo != null && !maleNo.trim().isEmpty()) {
|
||||||
Map<String, Object> maleInfo = scEmbryoFlushMapper.selectSheepInfoByManageTag(ramId);
|
Map<String, Object> maleInfo = scEmbryoFlushMapper.selectSheepInfoByManageTag(maleNo);
|
||||||
if (maleInfo != null && !maleInfo.isEmpty()) {
|
if (maleInfo != null && !maleInfo.isEmpty()) {
|
||||||
String maleVariety = (String) maleInfo.get("variety");
|
String maleVariety = (String) maleInfo.get("variety");
|
||||||
Integer maleVarietyId = getIntValue(maleInfo.get("varietyId"));
|
|
||||||
|
|
||||||
result.put("donorMaleVariety", maleVariety);
|
result.put("donorMaleVariety", maleVariety);
|
||||||
result.put("donorMaleVarietyId", maleVarietyId);
|
|
||||||
|
|
||||||
// 4. 根据品种ID计算胚胎品种
|
// 4. 【关键修复】使用品种名称计算胚胎品种
|
||||||
if (maleVarietyId != null && femaleVarietyId != null) {
|
// 这样可以确保无论数据库ID是多少,只要名字是对的就能算出结果
|
||||||
String embryoVariety = calculateEmbryoVarietyById(maleVarietyId, femaleVarietyId);
|
Integer mId = getVarietyIdByName(maleVariety);
|
||||||
|
Integer fId = getVarietyIdByName(femaleVariety);
|
||||||
|
|
||||||
|
if (mId != null && fId != null) {
|
||||||
|
String embryoVariety = calculateEmbryoVarietyById(mId, fId);
|
||||||
result.put("embryoVariety", embryoVariety);
|
result.put("embryoVariety", embryoVariety);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,6 +169,7 @@ public class ScEmbryoFlushServiceImpl implements IScEmbryoFlushService
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 安全获取Integer值
|
* 安全获取Integer值
|
||||||
*/
|
*/
|
||||||
@@ -292,23 +294,22 @@ public class ScEmbryoFlushServiceImpl implements IScEmbryoFlushService
|
|||||||
// 级杂二代(BM)或n世代(SM) × 级杂一代/级杂二代/级杂三代/回交(公) → 世代
|
// 级杂二代(BM)或n世代(SM) × 级杂一代/级杂二代/级杂三代/回交(公) → 世代
|
||||||
|
|
||||||
// 判断公羊是否为可产生世代的品种(级杂一代/二代/三代/回交)
|
// 判断公羊是否为可产生世代的品种(级杂一代/二代/三代/回交)
|
||||||
boolean isMaleForShidai = (male == VARIETY_JIZA_1 || male == VARIETY_JIZA_2 ||
|
boolean isMaleCapableOfGeneration = (male >= 3 && male <= 10);
|
||||||
male == VARIETY_JIZA_3 || male == VARIETY_HUIJIAO);
|
|
||||||
|
|
||||||
if (isMaleForShidai) {
|
if (isMaleCapableOfGeneration) {
|
||||||
// 级杂二代(母) × 以上公羊 → 1世代
|
// 级杂二代(母) x 任意合格公羊 -> 一世代
|
||||||
if (female == VARIETY_JIZA_2) {
|
if (female == VARIETY_JIZA_2) {
|
||||||
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_1);
|
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_1);
|
||||||
}
|
}
|
||||||
// 1世代(母) × 以上公羊 → 2世代
|
// 一世代(母) x 任意合格公羊 -> 二世代
|
||||||
if (female == VARIETY_SHIDAI_1) {
|
if (female == VARIETY_SHIDAI_1) {
|
||||||
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_2);
|
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_2);
|
||||||
}
|
}
|
||||||
// 2世代(母) × 以上公羊 → 3世代
|
// 二世代(母) x 任意合格公羊 -> 三世代
|
||||||
if (female == VARIETY_SHIDAI_2) {
|
if (female == VARIETY_SHIDAI_2) {
|
||||||
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_3);
|
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_3);
|
||||||
}
|
}
|
||||||
// 3世代(母) × 以上公羊 → 4世代
|
// 三世代(母) x 任意合格公羊 -> 四世代
|
||||||
if (female == VARIETY_SHIDAI_3) {
|
if (female == VARIETY_SHIDAI_3) {
|
||||||
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_4);
|
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_4);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,43 +4,43 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.zhyc.module.produce.breed.mapper.ScBreedRecordMapper">
|
<mapper namespace="com.zhyc.module.produce.breed.mapper.ScBreedRecordMapper">
|
||||||
|
|
||||||
<!-- <resultMap type="ScBreedRecord" id="ScBreedRecordResult">-->
|
<!-- <resultMap type="ScBreedRecord" id="ScBreedRecordResult">-->
|
||||||
<!-- <result property="id" column="id" />-->
|
<!-- <result property="id" column="id" />-->
|
||||||
<!-- <result property="sheepId" column="sheep_id" />-->
|
<!-- <result property="sheepId" column="sheep_id" />-->
|
||||||
<!-- <result property="ramId" column="ram_id" />-->
|
<!-- <result property="ramId" column="ram_id" />-->
|
||||||
<!-- <result property="eweId" column="ewe_id" />-->
|
<!-- <result property="eweId" column="ewe_id" />-->
|
||||||
<!-- <result property="technician" column="technician" />-->
|
<!-- <result property="technician" column="technician" />-->
|
||||||
<!-- <result property="breedDrugs" column="breed_drugs" />-->
|
<!-- <result property="breedDrugs" column="breed_drugs" />-->
|
||||||
<!-- <result property="breedType" column="breed_type" />-->
|
<!-- <result property="breedType" column="breed_type" />-->
|
||||||
<!-- <result property="createBy" column="create_by" / >-->
|
<!-- <result property="createBy" column="create_by" / >-->
|
||||||
<!-- <result property="createTime" column="create_time" />-->
|
<!-- <result property="createTime" column="create_time" />-->
|
||||||
<!-- <!– 显示字段 –>-->
|
<!-- <!– 显示字段 –>-->
|
||||||
<!-- <result property="eweManageTags" column="ewe_manage_tags" />-->
|
<!-- <result property="eweManageTags" column="ewe_manage_tags" />-->
|
||||||
<!-- <result property="eweVariety" column="ewe_variety" />-->
|
<!-- <result property="eweVariety" column="ewe_variety" />-->
|
||||||
<!-- <result property="ramManageTags" column="ram_manage_tags" />-->
|
<!-- <result property="ramManageTags" column="ram_manage_tags" />-->
|
||||||
<!-- <result property="ramVariety" column="ram_variety" />-->
|
<!-- <result property="ramVariety" column="ram_variety" />-->
|
||||||
<!-- <result property="eweParity" column="ewe_parity" />-->
|
<!-- <result property="eweParity" column="ewe_parity" />-->
|
||||||
<!-- <result property="eweMonthAge" column="ewe_month_age" />-->
|
<!-- <result property="eweMonthAge" column="ewe_month_age" />-->
|
||||||
<!-- <result property="eweSheepfoldName" column="ewe_sheepfold_name" />-->
|
<!-- <result property="eweSheepfoldName" column="ewe_sheepfold_name" />-->
|
||||||
<!-- <result property="eweBreedStatus" column="ewe_breed_status" />-->
|
<!-- <result property="eweBreedStatus" column="ewe_breed_status" />-->
|
||||||
<!-- <result property="eweControlled" column="ewe_controlled" />-->
|
<!-- <result property="eweControlled" column="ewe_controlled" />-->
|
||||||
<!-- <result property="eweComment" column="ewe_comment" />-->
|
<!-- <result property="eweComment" column="ewe_comment" />-->
|
||||||
<!-- <result property="ranchName" column="ranch_name" />-->
|
<!-- <result property="ranchName" column="ranch_name" />-->
|
||||||
<!-- <result property="matingType" column="mating_type" />-->
|
<!-- <result property="matingType" column="mating_type" />-->
|
||||||
<!-- <result property="sheepType" column="sheep_type" />-->
|
<!-- <result property="sheepType" column="sheep_type" />-->
|
||||||
<!-- <result property="matingCount" column="mating_count" />-->
|
<!-- <result property="matingCount" column="mating_count" />-->
|
||||||
<!-- <result property="timeSincePlanning" column="time_since_planning" />-->
|
<!-- <result property="timeSincePlanning" column="time_since_planning" />-->
|
||||||
<!-- <!– 孕检相关字段 –>-->
|
<!-- <!– 孕检相关字段 –>-->
|
||||||
<!-- <result property="pregnancyCheckDate" column="pregnancy_check_date" />-->
|
<!-- <result property="pregnancyCheckDate" column="pregnancy_check_date" />-->
|
||||||
<!-- <result property="pregnancyResult" column="pregnancy_result" />-->
|
<!-- <result property="pregnancyResult" column="pregnancy_result" />-->
|
||||||
<!-- <result property="pregnancyWay" column="pregnancy_way" />-->
|
<!-- <result property="pregnancyWay" column="pregnancy_way" />-->
|
||||||
<!-- <result property="fetusCount" column="fetus_count" />-->
|
<!-- <result property="fetusCount" column="fetus_count" />-->
|
||||||
<!-- <result property="pregnancyTechnician" column="pregnancy_technician" />-->
|
<!-- <result property="pregnancyTechnician" column="pregnancy_technician" />-->
|
||||||
<!-- <result property="pregnancyRemark" column="pregnancy_remark" />-->
|
<!-- <result property="pregnancyRemark" column="pregnancy_remark" />-->
|
||||||
<!-- <result property="pregnancyRecordId" column="pregnancy_record_id" />-->
|
<!-- <result property="pregnancyRecordId" column="pregnancy_record_id" />-->
|
||||||
<!-- <result property="daysToPregnancyCheck" column="days_to_pregnancy_check" />-->
|
<!-- <result property="daysToPregnancyCheck" column="days_to_pregnancy_check" />-->
|
||||||
<!-- <result property="isPregnancyChecked" column="is_pregnancy_checked" />-->
|
<!-- <result property="isPregnancyChecked" column="is_pregnancy_checked" />-->
|
||||||
<!-- </resultMap>-->
|
<!-- </resultMap>-->
|
||||||
<resultMap type="ScBreedRecord" id="ScBreedRecordResult">
|
<resultMap type="ScBreedRecord" id="ScBreedRecordResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="sheepId" column="sheep_id" />
|
<result property="sheepId" column="sheep_id" />
|
||||||
@@ -49,11 +49,12 @@
|
|||||||
<result property="technician" column="technician" />
|
<result property="technician" column="technician" />
|
||||||
<result property="breedDrugs" column="breed_drugs" />
|
<result property="breedDrugs" column="breed_drugs" />
|
||||||
<result property="breedType" column="breed_type" />
|
<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="createTime" column="create_time" />
|
||||||
<result property="comment" column="comment" />
|
<result property="comment" column="comment" />
|
||||||
|
|
||||||
<result property="embryoCount" column="embryo_count" />
|
<result property="embryoCount" column="embryo_count" />
|
||||||
|
<result property="embryoSubType" column="embryoSubType" />
|
||||||
<result property="donorEweNo" column="donor_ewe" />
|
<result property="donorEweNo" column="donor_ewe" />
|
||||||
<result property="donorRamNo" column="donor_ram" />
|
<result property="donorRamNo" column="donor_ram" />
|
||||||
|
|
||||||
@@ -86,75 +87,75 @@
|
|||||||
<result property="daysToPregnancyCheck" column="days_to_pregnancy_check" />
|
<result property="daysToPregnancyCheck" column="days_to_pregnancy_check" />
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<!-- <sql id="selectScBreedRecordVo">-->
|
<!-- <sql id="selectScBreedRecordVo">-->
|
||||||
<!-- select DISTINCT-->
|
<!-- select DISTINCT-->
|
||||||
<!-- br.id,-->
|
<!-- br.id,-->
|
||||||
<!-- br.sheep_id,-->
|
<!-- br.sheep_id,-->
|
||||||
<!-- br.ram_id,-->
|
<!-- br.ram_id,-->
|
||||||
<!-- br.ewe_id,-->
|
<!-- br.ewe_id,-->
|
||||||
<!-- br.technician,-->
|
<!-- br.technician,-->
|
||||||
<!-- br.breed_drugs,-->
|
<!-- br.breed_drugs,-->
|
||||||
<!-- br.breed_type,-->
|
<!-- br.breed_type,-->
|
||||||
<!-- br.create_by,-->
|
<!-- br.create_by,-->
|
||||||
<!-- br.create_time,-->
|
<!-- br.create_time,-->
|
||||||
<!-- -- 母羊信息(从视图获取)-->
|
<!-- -- 母羊信息(从视图获取)-->
|
||||||
<!-- ewe_view.bs_manage_tags as ewe_manage_tags,-->
|
<!-- ewe_view.bs_manage_tags as ewe_manage_tags,-->
|
||||||
<!-- ewe_view.variety as ewe_variety,-->
|
<!-- ewe_view.variety as ewe_variety,-->
|
||||||
<!-- ewe_view.parity as ewe_parity,-->
|
<!-- ewe_view.parity as ewe_parity,-->
|
||||||
<!-- ewe_view.month_age as ewe_month_age,-->
|
<!-- ewe_view.month_age as ewe_month_age,-->
|
||||||
<!-- ewe_view.sheepfold_name as ewe_sheepfold_name,-->
|
<!-- ewe_view.sheepfold_name as ewe_sheepfold_name,-->
|
||||||
<!-- ewe_view.breed as ewe_breed_status,-->
|
<!-- ewe_view.breed as ewe_breed_status,-->
|
||||||
<!-- ewe_view.controlled as ewe_controlled,-->
|
<!-- ewe_view.controlled as ewe_controlled,-->
|
||||||
<!-- ewe_view.comment as ewe_comment,-->
|
<!-- ewe_view.comment as ewe_comment,-->
|
||||||
<!-- ewe_view.dr_ranch as ranch_name,-->
|
<!-- ewe_view.dr_ranch as ranch_name,-->
|
||||||
<!-- ewe_view.name as sheep_type,-->
|
<!-- ewe_view.name as sheep_type,-->
|
||||||
<!-- ewe_view.mating_total as mating_count,-->
|
<!-- ewe_view.mating_total as mating_count,-->
|
||||||
<!-- -- 公羊信息(从视图获取)-->
|
<!-- -- 公羊信息(从视图获取)-->
|
||||||
<!-- ram_view.bs_manage_tags as ram_manage_tags,-->
|
<!-- ram_view.bs_manage_tags as ram_manage_tags,-->
|
||||||
<!-- ram_view.variety as ram_variety,-->
|
<!-- ram_view.variety as ram_variety,-->
|
||||||
|
|
||||||
<!-- -- 配种方式显示-->
|
<!-- -- 配种方式显示-->
|
||||||
<!-- CASE br.breed_type-->
|
<!-- CASE br.breed_type-->
|
||||||
<!-- WHEN 1 THEN '同期发情'-->
|
<!-- WHEN 1 THEN '同期发情'-->
|
||||||
<!-- WHEN 2 THEN '本交'-->
|
<!-- WHEN 2 THEN '本交'-->
|
||||||
<!-- WHEN 3 THEN '冲胚'-->
|
<!-- WHEN 3 THEN '冲胚'-->
|
||||||
<!-- WHEN 4 THEN '自然发情人工授精'-->
|
<!-- WHEN 4 THEN '自然发情人工授精'-->
|
||||||
<!-- ELSE '未知'-->
|
<!-- ELSE '未知'-->
|
||||||
<!-- END as mating_type,-->
|
<!-- 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.datetime as pregnancy_check_date,-->
|
||||||
<!-- pr.result as pregnancy_result,-->
|
<!-- pr.result as pregnancy_result,-->
|
||||||
<!-- pr.way as pregnancy_way,-->
|
<!-- pr.way as pregnancy_way,-->
|
||||||
<!-- pr.fetus_count,-->
|
<!-- pr.fetus_count,-->
|
||||||
<!-- pr.technician as pregnancy_technician,-->
|
<!-- pr.technician as pregnancy_technician,-->
|
||||||
<!-- pr.remark as pregnancy_remark,-->
|
<!-- pr.remark as pregnancy_remark,-->
|
||||||
<!-- pr.id as pregnancy_record_id,-->
|
<!-- pr.id as pregnancy_record_id,-->
|
||||||
<!-- -- 配种到孕检间隔天数-->
|
<!-- -- 配种到孕检间隔天数-->
|
||||||
<!-- CASE-->
|
<!-- CASE-->
|
||||||
<!-- WHEN pr.datetime IS NOT NULL THEN DATEDIFF(pr.datetime, br.create_time)-->
|
<!-- WHEN pr.datetime IS NOT NULL THEN DATEDIFF(pr.datetime, br.create_time)-->
|
||||||
<!-- ELSE NULL-->
|
<!-- ELSE NULL-->
|
||||||
<!-- END as days_to_pregnancy_check,-->
|
<!-- END as days_to_pregnancy_check,-->
|
||||||
<!-- -- 是否已孕检-->
|
<!-- -- 是否已孕检-->
|
||||||
<!-- CASE-->
|
<!-- CASE-->
|
||||||
<!-- WHEN pr.id IS NOT NULL THEN 1-->
|
<!-- WHEN pr.id IS NOT NULL THEN 1-->
|
||||||
<!-- ELSE 0-->
|
<!-- ELSE 0-->
|
||||||
<!-- END as is_pregnancy_checked-->
|
<!-- END as is_pregnancy_checked-->
|
||||||
<!-- from sc_breed_record br-->
|
<!-- from sc_breed_record br-->
|
||||||
<!-- left join sheep_file ewe_view on br.ewe_id = ewe_view.id-->
|
<!-- 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 sheep_file ram_view on br.ram_id = ram_view.id-->
|
||||||
<!-- -- 修复:使用子查询确保只返回一条孕检记录-->
|
<!-- -- 修复:使用子查询确保只返回一条孕检记录-->
|
||||||
<!-- left join sc_pregnancy_record pr on pr.id = (-->
|
<!-- left join sc_pregnancy_record pr on pr.id = (-->
|
||||||
<!-- select pr2.id-->
|
<!-- select pr2.id-->
|
||||||
<!-- from sc_pregnancy_record pr2-->
|
<!-- from sc_pregnancy_record pr2-->
|
||||||
<!-- where pr2.sheep_id = br.ewe_id-->
|
<!-- where pr2.sheep_id = br.ewe_id-->
|
||||||
<!-- and pr2.is_delete = 0-->
|
<!-- and pr2.is_delete = 0-->
|
||||||
<!-- and pr2.datetime >= br.create_time-->
|
<!-- and pr2.datetime >= br.create_time-->
|
||||||
<!-- order by pr2.datetime asc, pr2.id asc-->
|
<!-- order by pr2.datetime asc, pr2.id asc-->
|
||||||
<!-- limit 1-->
|
<!-- limit 1-->
|
||||||
<!-- )-->
|
<!-- )-->
|
||||||
<!-- </sql>-->
|
<!-- </sql>-->
|
||||||
<sql id="selectScBreedRecordVo">
|
<sql id="selectScBreedRecordVo">
|
||||||
select DISTINCT
|
select DISTINCT
|
||||||
br.id,
|
br.id,
|
||||||
@@ -165,6 +166,7 @@
|
|||||||
br.breed_drugs,
|
br.breed_drugs,
|
||||||
br.breed_type,
|
br.breed_type,
|
||||||
br.frozen_sperm_no, -- 冻精号
|
br.frozen_sperm_no, -- 冻精号
|
||||||
|
br.embryoSubType,
|
||||||
br.comment,
|
br.comment,
|
||||||
br.create_by,
|
br.create_by,
|
||||||
br.create_time,
|
br.create_time,
|
||||||
@@ -192,7 +194,8 @@
|
|||||||
-- 公羊信息
|
-- 公羊信息
|
||||||
ram_view.bs_manage_tags as ram_manage_tags,
|
ram_view.bs_manage_tags as ram_manage_tags,
|
||||||
ram_view.variety as ram_variety,
|
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,
|
TIMESTAMPDIFF(HOUR, br.create_time, NOW()) as time_since_planning,
|
||||||
|
|
||||||
@@ -265,32 +268,32 @@
|
|||||||
limit 1
|
limit 1
|
||||||
)
|
)
|
||||||
</sql>
|
</sql>
|
||||||
<!-- <select id="selectScBreedRecordList" parameterType="ScBreedRecord" resultMap="ScBreedRecordResult">-->
|
<!-- <select id="selectScBreedRecordList" parameterType="ScBreedRecord" resultMap="ScBreedRecordResult">-->
|
||||||
<!-- <include refid="selectScBreedRecordVo"/>-->
|
<!-- <include refid="selectScBreedRecordVo"/>-->
|
||||||
<!-- <where>-->
|
<!-- <where>-->
|
||||||
<!-- <if test="sheepId != null "> and br.sheep_id = #{sheepId}</if>-->
|
<!-- <if test="sheepId != null "> and br.sheep_id = #{sheepId}</if>-->
|
||||||
<!-- <if test="ramId != null and ramId != ''"> and br.ram_id = #{ramId}</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="eweId != null and eweId != ''"> and br.ewe_id = #{eweId}</if>-->
|
||||||
<!-- <if test="breedType != null"> and br.breed_type = #{breedType}</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="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="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="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="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="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="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="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="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="ranchId != null"> and ewe_view.ranch_id = #{ranchId}</if>-->
|
||||||
<!-- <!– 孕检相关查询条件 –>-->
|
<!-- <!– 孕检相关查询条件 –>-->
|
||||||
<!-- <if test="pregnancyResult != null and pregnancyResult != ''"> and pr.result like concat('%', #{pregnancyResult}, '%')</if>-->
|
<!-- <if test="pregnancyResult != null and pregnancyResult != ''"> and pr.result like concat('%', #{pregnancyResult}, '%')</if>-->
|
||||||
<!-- <if test="isPregnancyChecked != null">-->
|
<!-- <if test="isPregnancyChecked != null">-->
|
||||||
<!-- <if test="isPregnancyChecked == 1"> and pr.id IS NOT NULL</if>-->
|
<!-- <if test="isPregnancyChecked == 1"> and pr.id IS NOT NULL</if>-->
|
||||||
<!-- <if test="isPregnancyChecked == 0"> and pr.id IS NULL</if>-->
|
<!-- <if test="isPregnancyChecked == 0"> and pr.id IS NULL</if>-->
|
||||||
<!-- </if>-->
|
<!-- </if>-->
|
||||||
<!-- </where>-->
|
<!-- </where>-->
|
||||||
<!-- order by br.create_time desc-->
|
<!-- order by br.create_time desc-->
|
||||||
<!-- </select>-->
|
<!-- </select>-->
|
||||||
<select id="selectScBreedRecordList" parameterType="ScBreedRecord" resultMap="ScBreedRecordResult">
|
<select id="selectScBreedRecordList" parameterType="ScBreedRecord" resultMap="ScBreedRecordResult">
|
||||||
<include refid="selectScBreedRecordVo"/>
|
<include refid="selectScBreedRecordVo"/>
|
||||||
<where>
|
<where>
|
||||||
@@ -321,6 +324,8 @@
|
|||||||
where br.id = #{id}
|
where br.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 根据母羊耳号查询羊只ID -->
|
<!-- 根据母羊耳号查询羊只ID -->
|
||||||
<select id="getSheepIdByManageTags" parameterType="String" resultType="Long">
|
<select id="getSheepIdByManageTags" parameterType="String" resultType="Long">
|
||||||
select id from sheep_file where bs_manage_tags = #{manageTags} and is_delete = 0
|
select id from sheep_file where bs_manage_tags = #{manageTags} and is_delete = 0
|
||||||
@@ -445,29 +450,29 @@
|
|||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- <insert id="insertScBreedRecord" parameterType="ScBreedRecord" useGeneratedKeys="true" keyProperty="id">-->
|
<!-- <insert id="insertScBreedRecord" parameterType="ScBreedRecord" useGeneratedKeys="true" keyProperty="id">-->
|
||||||
<!-- insert into sc_breed_record-->
|
<!-- insert into sc_breed_record-->
|
||||||
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
|
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
|
||||||
<!-- <if test="sheepId != null">sheep_id,</if>-->
|
<!-- <if test="sheepId != null">sheep_id,</if>-->
|
||||||
<!-- <if test="ramId != null">ram_id,</if>-->
|
<!-- <if test="ramId != null">ram_id,</if>-->
|
||||||
<!-- <if test="eweId != null">ewe_id,</if>-->
|
<!-- <if test="eweId != null">ewe_id,</if>-->
|
||||||
<!-- <if test="technician != null">technician,</if>-->
|
<!-- <if test="technician != null">technician,</if>-->
|
||||||
<!-- <if test="breedDrugs != null">breed_drugs,</if>-->
|
<!-- <if test="breedDrugs != null">breed_drugs,</if>-->
|
||||||
<!-- <if test="breedType != null">breed_type,</if>-->
|
<!-- <if test="breedType != null">breed_type,</if>-->
|
||||||
<!-- <if test="createBy != null">create_by,</if>-->
|
<!-- <if test="createBy != null">create_by,</if>-->
|
||||||
<!-- <if test="createTime != null">create_time,</if>-->
|
<!-- <if test="createTime != null">create_time,</if>-->
|
||||||
<!-- </trim>-->
|
<!-- </trim>-->
|
||||||
<!-- <trim prefix="values (" suffix=")" suffixOverrides=",">-->
|
<!-- <trim prefix="values (" suffix=")" suffixOverrides=",">-->
|
||||||
<!-- <if test="sheepId != null">#{sheepId},</if>-->
|
<!-- <if test="sheepId != null">#{sheepId},</if>-->
|
||||||
<!-- <if test="ramId != null">#{ramId},</if>-->
|
<!-- <if test="ramId != null">#{ramId},</if>-->
|
||||||
<!-- <if test="eweId != null">#{eweId},</if>-->
|
<!-- <if test="eweId != null">#{eweId},</if>-->
|
||||||
<!-- <if test="technician != null">#{technician},</if>-->
|
<!-- <if test="technician != null">#{technician},</if>-->
|
||||||
<!-- <if test="breedDrugs != null">#{breedDrugs},</if>-->
|
<!-- <if test="breedDrugs != null">#{breedDrugs},</if>-->
|
||||||
<!-- <if test="breedType != null">#{breedType},</if>-->
|
<!-- <if test="breedType != null">#{breedType},</if>-->
|
||||||
<!-- <if test="createBy != null">#{createBy},</if>-->
|
<!-- <if test="createBy != null">#{createBy},</if>-->
|
||||||
<!-- <if test="createTime != null">#{createTime},</if>-->
|
<!-- <if test="createTime != null">#{createTime},</if>-->
|
||||||
<!-- </trim>-->
|
<!-- </trim>-->
|
||||||
<!-- </insert>-->
|
<!-- </insert>-->
|
||||||
<insert id="insertScBreedRecord" parameterType="ScBreedRecord" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertScBreedRecord" parameterType="ScBreedRecord" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into sc_breed_record
|
insert into sc_breed_record
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
@@ -477,13 +482,14 @@
|
|||||||
<if test="technician != null">technician,</if>
|
<if test="technician != null">technician,</if>
|
||||||
<if test="breedDrugs != null">breed_drugs,</if>
|
<if test="breedDrugs != null">breed_drugs,</if>
|
||||||
<if test="breedType != null">breed_type,</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="createBy != null">create_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="comment != null">comment,</if>
|
<if test="comment != null">comment,</if>
|
||||||
<if test="embryoCount != null">embryo_count,</if>
|
<if test="embryoCount != null">embryo_count,</if>
|
||||||
<if test="donorEweNo != null">donor_ewe,</if>
|
<if test="donorEweNo != null">donor_ewe,</if>
|
||||||
<if test="donorRamNo != null">donor_ram,</if>
|
<if test="donorRamNo != null">donor_ram,</if>
|
||||||
|
<if test="embryoSubType != null">embryoSubType,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="sheepId != null">#{sheepId},</if>
|
<if test="sheepId != null">#{sheepId},</if>
|
||||||
@@ -503,20 +509,20 @@
|
|||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<!-- <update id="updateScBreedRecord" parameterType="ScBreedRecord">-->
|
<!-- <update id="updateScBreedRecord" parameterType="ScBreedRecord">-->
|
||||||
<!-- update sc_breed_record-->
|
<!-- update sc_breed_record-->
|
||||||
<!-- <trim prefix="SET" suffixOverrides=",">-->
|
<!-- <trim prefix="SET" suffixOverrides=",">-->
|
||||||
<!-- <if test="sheepId != null">sheep_id = #{sheepId},</if>-->
|
<!-- <if test="sheepId != null">sheep_id = #{sheepId},</if>-->
|
||||||
<!-- <if test="ramId != null">ram_id = #{ramId},</if>-->
|
<!-- <if test="ramId != null">ram_id = #{ramId},</if>-->
|
||||||
<!-- <if test="eweId != null">ewe_id = #{eweId},</if>-->
|
<!-- <if test="eweId != null">ewe_id = #{eweId},</if>-->
|
||||||
<!-- <if test="technician != null">technician = #{technician},</if>-->
|
<!-- <if test="technician != null">technician = #{technician},</if>-->
|
||||||
<!-- <if test="breedDrugs != null">breed_drugs = #{breedDrugs},</if>-->
|
<!-- <if test="breedDrugs != null">breed_drugs = #{breedDrugs},</if>-->
|
||||||
<!-- <if test="breedType != null">breed_type = #{breedType},</if>-->
|
<!-- <if test="breedType != null">breed_type = #{breedType},</if>-->
|
||||||
<!-- <if test="createBy != null">create_by = #{createBy},</if>-->
|
<!-- <if test="createBy != null">create_by = #{createBy},</if>-->
|
||||||
<!-- <if test="createTime != null">create_time = #{createTime},</if>-->
|
<!-- <if test="createTime != null">create_time = #{createTime},</if>-->
|
||||||
<!-- </trim>-->
|
<!-- </trim>-->
|
||||||
<!-- where id = #{id}-->
|
<!-- where id = #{id}-->
|
||||||
<!-- </update>-->
|
<!-- </update>-->
|
||||||
<update id="updateScBreedRecord" parameterType="ScBreedRecord">
|
<update id="updateScBreedRecord" parameterType="ScBreedRecord">
|
||||||
update sc_breed_record
|
update sc_breed_record
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
@@ -526,13 +532,14 @@
|
|||||||
<if test="technician != null">technician = #{technician},</if>
|
<if test="technician != null">technician = #{technician},</if>
|
||||||
<if test="breedDrugs != null">breed_drugs = #{breedDrugs},</if>
|
<if test="breedDrugs != null">breed_drugs = #{breedDrugs},</if>
|
||||||
<if test="breedType != null">breed_type = #{breedType},</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="createBy != null">create_by = #{createBy},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
<if test="comment != null">comment = #{comment},</if>
|
<if test="comment != null">comment = #{comment},</if>
|
||||||
<if test="embryoCount != null">embryo_count = #{embryoCount},</if>
|
<if test="embryoCount != null">embryo_count = #{embryoCount},</if>
|
||||||
<if test="donorEweNo != null">donor_ewe = #{donorEweNo},</if>
|
<if test="donorEweNo != null">donor_ewe = #{donorEweNo},</if>
|
||||||
<if test="donorRamNo != null">donor_ram = #{donorRamNo},</if>
|
<if test="donorRamNo != null">donor_ram = #{donorRamNo},</if>
|
||||||
|
<if test="embryoSubType != null">embryoSubType = #{embryoSubType},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
@@ -548,8 +555,8 @@
|
|||||||
-- Assuming linking via recipient tags is complicated,
|
-- Assuming linking via recipient tags is complicated,
|
||||||
-- usually this is done by matching a recent flush record
|
-- usually this is done by matching a recent flush record
|
||||||
-- For now, this mimics the logic in your ServiceImpl
|
-- For now, this mimics the logic in your ServiceImpl
|
||||||
SELECT id FROM sc_embryo_flush WHERE recipient_list LIKE concat('%', #{manageTags}, '%')
|
SELECT id FROM sc_embryo_flush WHERE donor_female_no LIKE concat('%', #{manageTags}, '%')
|
||||||
ORDER BY created_at DESC LIMIT 1
|
ORDER BY flush_time DESC LIMIT 1
|
||||||
)
|
)
|
||||||
-- Note: If your sc_embryo_flush structure is different (one row per recipient), adjust accordingly.
|
-- Note: If your sc_embryo_flush structure is different (one row per recipient), adjust accordingly.
|
||||||
-- Based on provided file, it has `recipient_cnt`.
|
-- Based on provided file, it has `recipient_cnt`.
|
||||||
|
|||||||
@@ -203,13 +203,9 @@
|
|||||||
<!-- ewe_id存的是数字ID,需要先根据耳号找到母羊ID,再查配种记录,再根据公羊ID找到公羊耳号 -->
|
<!-- ewe_id存的是数字ID,需要先根据耳号找到母羊ID,再查配种记录,再根据公羊ID找到公羊耳号 -->
|
||||||
<select id="selectBreedRecordByEwe" resultType="java.util.Map">
|
<select id="selectBreedRecordByEwe" resultType="java.util.Map">
|
||||||
SELECT
|
SELECT
|
||||||
ram_sf.bs_manage_tags AS ramId,
|
donor_ram AS donorMaleNo, create_time AS matingDate FROM sc_breed_record
|
||||||
br.create_time AS matingDate
|
WHERE donor_ewe = #{eweManageTag} AND (is_delete = 0 OR is_delete IS NULL)
|
||||||
FROM sc_breed_record br
|
ORDER BY create_time DESC
|
||||||
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
|
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user