Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -137,7 +137,6 @@ public class BasSheepController extends BaseController {
|
||||
}
|
||||
BasSheep query = new BasSheep();
|
||||
query.setTypeId(typeId.longValue());
|
||||
startPage();
|
||||
List<BasSheep> list = basSheepService.selectBasSheepList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@@ -154,7 +153,6 @@ public class BasSheepController extends BaseController {
|
||||
BasSheep query = new BasSheep();
|
||||
query.setSheepfoldId(sheepfoldId.longValue());
|
||||
query.setTypeId(typeId.longValue());
|
||||
startPage();
|
||||
List<BasSheep> list = basSheepService.selectBasSheepList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@@ -191,7 +189,6 @@ public class BasSheepController extends BaseController {
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断耳号是否存在(用于新增羊只时校验)
|
||||
*/
|
||||
|
||||
@@ -77,7 +77,7 @@ public class DaRanchController extends BaseController
|
||||
/**
|
||||
* 获取指定牧场下的所有羊只耳号
|
||||
*/
|
||||
// @GetMapping("/getSheepByRanchId/{ranchId}")
|
||||
@GetMapping("/getSheepByRanchId/{ranchId}")
|
||||
public AjaxResult getSheepByRanchId(@PathVariable Long ranchId) {
|
||||
List<BasSheep> sheepList = basSheepService.getSheepByRanchId(ranchId);
|
||||
return AjaxResult.success(sheepList);
|
||||
|
||||
@@ -3,6 +3,11 @@ package com.zhyc.module.produce.bodyManage.controller;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.StringUtils;
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.service.IBasSheepService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -14,6 +19,7 @@ import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
|
||||
import com.zhyc.module.produce.bodyManage.service.IScBodyMeasureService;
|
||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||
import com.zhyc.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 体尺测量Controller
|
||||
@@ -23,19 +29,18 @@ import com.zhyc.common.core.page.TableDataInfo;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/body_measure/body_measure")
|
||||
public class ScBodyMeasureController extends BaseController
|
||||
{
|
||||
public class ScBodyMeasureController extends BaseController {
|
||||
@Autowired
|
||||
private IScBodyMeasureService scBodyMeasureService;
|
||||
|
||||
@Autowired
|
||||
private IBasSheepService basSheepService;
|
||||
|
||||
/**
|
||||
* 查询体尺测量列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ScBodyMeasure scBodyMeasure)
|
||||
{
|
||||
public TableDataInfo list(ScBodyMeasure scBodyMeasure) {
|
||||
startPage();
|
||||
List<ScBodyMeasure> list = scBodyMeasureService.selectScBodyMeasureList(scBodyMeasure);
|
||||
return getDataTable(list);
|
||||
@@ -47,8 +52,7 @@ public class ScBodyMeasureController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:export')")
|
||||
@Log(title = "体尺测量", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ScBodyMeasure scBodyMeasure)
|
||||
{
|
||||
public void export(HttpServletResponse response, ScBodyMeasure scBodyMeasure) {
|
||||
List<ScBodyMeasure> list = scBodyMeasureService.selectScBodyMeasureList(scBodyMeasure);
|
||||
ExcelUtil<ScBodyMeasure> util = new ExcelUtil<ScBodyMeasure>(ScBodyMeasure.class);
|
||||
util.exportExcel(response, list, "体尺测量数据");
|
||||
@@ -59,8 +63,7 @@ public class ScBodyMeasureController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(scBodyMeasureService.selectScBodyMeasureById(id));
|
||||
}
|
||||
|
||||
@@ -70,8 +73,7 @@ public class ScBodyMeasureController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:add')")
|
||||
@Log(title = "体尺测量", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ScBodyMeasure scBodyMeasure)
|
||||
{
|
||||
public AjaxResult add(@RequestBody ScBodyMeasure scBodyMeasure) {
|
||||
return toAjax(scBodyMeasureService.insertScBodyMeasure(scBodyMeasure));
|
||||
}
|
||||
|
||||
@@ -81,8 +83,7 @@ public class ScBodyMeasureController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:edit')")
|
||||
@Log(title = "体尺测量", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ScBodyMeasure scBodyMeasure)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody ScBodyMeasure scBodyMeasure) {
|
||||
return toAjax(scBodyMeasureService.updateScBodyMeasure(scBodyMeasure));
|
||||
}
|
||||
|
||||
@@ -92,8 +93,7 @@ public class ScBodyMeasureController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:remove')")
|
||||
@Log(title = "体尺测量", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(scBodyMeasureService.deleteScBodyMeasureByIds(ids));
|
||||
}
|
||||
|
||||
@@ -101,4 +101,73 @@ public class ScBodyMeasureController extends BaseController
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query) {
|
||||
return success(scBodyMeasureService.searchEarNumbers(query.trim()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入体尺测量数据
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('body_measure:body_measure:import')")
|
||||
@Log(title = "体尺测量", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/import")
|
||||
public AjaxResult importData(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
ExcelUtil<ScBodyMeasure> util = new ExcelUtil<>(ScBodyMeasure.class);
|
||||
List<ScBodyMeasure> list = util.importExcel(file.getInputStream());
|
||||
|
||||
// 数据校验和处理
|
||||
StringBuilder errorMsg = new StringBuilder();
|
||||
int successCount = 0;
|
||||
int failCount = 0;
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
ScBodyMeasure measure = list.get(i);
|
||||
try {
|
||||
// 根据耳号查询羊只ID
|
||||
if (StringUtils.isNotBlank(measure.getManageTags())) {
|
||||
BasSheep sheep = basSheepService.selectBasSheepByManageTags(measure.getManageTags().trim());
|
||||
if (sheep == null) {
|
||||
failCount++;
|
||||
errorMsg.append("第").append(i + 2).append("行:耳号【")
|
||||
.append(measure.getManageTags()).append("】不存在;");
|
||||
continue;
|
||||
}
|
||||
measure.setSheepId(sheep.getId());
|
||||
} else {
|
||||
failCount++;
|
||||
errorMsg.append("第").append(i + 2).append("行:耳号不能为空;");
|
||||
continue;
|
||||
}
|
||||
|
||||
// 设置默认值
|
||||
measure.setCreateTime(DateUtils.getNowDate());
|
||||
measure.setCreateBy(SecurityUtils.getUsername());
|
||||
|
||||
scBodyMeasureService.insertScBodyMeasure(measure);
|
||||
successCount++;
|
||||
|
||||
// 更新羊只当前体重
|
||||
if (measure.getCurrentWeight() != null) {
|
||||
BasSheep updateSheep = new BasSheep();
|
||||
updateSheep.setId(measure.getSheepId());
|
||||
updateSheep.setCurrentWeight(measure.getCurrentWeight());
|
||||
basSheepService.updateBasSheep(updateSheep);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
failCount++;
|
||||
errorMsg.append("第").append(i + 2).append("行:").append(e.getMessage()).append(";");
|
||||
}
|
||||
}
|
||||
|
||||
String msg = String.format("导入完成:成功%d条,失败%d条", successCount, failCount);
|
||||
if (failCount > 0) {
|
||||
msg += ";失败原因:" + errorMsg.toString();
|
||||
}
|
||||
return success(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取繁殖状态列表(用于下拉选择)
|
||||
*/
|
||||
@GetMapping("/breedStatus")
|
||||
public AjaxResult listBreedStatus() {
|
||||
return success(scBodyMeasureService.selectBreedStatusList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package com.zhyc.module.produce.bodyManage.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -62,8 +65,10 @@ public class ScBodyMeasure extends BaseEntity {
|
||||
/**
|
||||
* 测量日期
|
||||
*/
|
||||
@Excel(name = "测量日期")
|
||||
private LocalDate measureDate;
|
||||
@Excel(name = "测量日期", dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date measureDate;
|
||||
/**
|
||||
* 羊只类别
|
||||
*/
|
||||
@@ -82,10 +87,12 @@ public class ScBodyMeasure extends BaseEntity {
|
||||
/**
|
||||
* 出生体重
|
||||
*/
|
||||
@Excel(name = "出生体重")
|
||||
private BigDecimal birthWeight;
|
||||
/**
|
||||
* 断奶体重
|
||||
*/
|
||||
@Excel(name = "断奶体重")
|
||||
private BigDecimal weaningWeight;
|
||||
/**
|
||||
* 当前体重
|
||||
@@ -173,6 +180,13 @@ public class ScBodyMeasure extends BaseEntity {
|
||||
*/
|
||||
@Excel(name = "配后天数")
|
||||
private Integer postMatingDay;
|
||||
|
||||
|
||||
/**
|
||||
* 技术员
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@@ -180,12 +194,22 @@ public class ScBodyMeasure extends BaseEntity {
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 技术员
|
||||
* 前端多耳号查询条件,非表字段
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
/**
|
||||
* 月龄查询条件(开始),非数据库字段
|
||||
*/
|
||||
private Integer monthAgeStart;
|
||||
|
||||
/**
|
||||
* 月龄查询条件(结束),非数据库字段
|
||||
*/
|
||||
private Integer monthAgeEnd;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,13 @@ public class ScBodyScore extends BaseEntity {
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
/**
|
||||
* 前端多耳号查询条件,非表字段
|
||||
*/
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,13 @@ public class ScBreastRating extends BaseEntity {
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
/**
|
||||
* 前端多耳号查询条件,非表字段
|
||||
*/
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.produce.bodyManage.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -69,4 +71,9 @@ public interface ScBodyMeasureMapper
|
||||
List<ScBodyMeasure> selectScBodyMeasureList(
|
||||
@Param("sc") ScBodyMeasure sc,
|
||||
@Param("manageTagsList") List<String> manageTagsList);
|
||||
|
||||
/**
|
||||
* 查询繁殖状态列表
|
||||
*/
|
||||
List<Map<String, Object>> selectBreedStatusList();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.produce.bodyManage.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure;
|
||||
|
||||
/**
|
||||
@@ -60,4 +62,9 @@ public interface IScBodyMeasureService
|
||||
public int deleteScBodyMeasureById(Long id);
|
||||
|
||||
List<String> searchEarNumbers(String query);
|
||||
|
||||
/**
|
||||
* 查询繁殖状态列表
|
||||
*/
|
||||
List<Map<String, Object>> selectBreedStatusList();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zhyc.module.produce.bodyManage.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.StringUtils;
|
||||
@@ -127,4 +129,9 @@ public class ScBodyMeasureServiceImpl implements IScBodyMeasureService
|
||||
{
|
||||
return scBodyMeasureMapper.deleteScBodyMeasureById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> selectBreedStatusList() {
|
||||
return scBodyMeasureMapper.selectBreedStatusList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,8 +143,8 @@ public class ScBreedRecordController extends BaseController
|
||||
if (scBreedRecord.getBreedType() == null) {
|
||||
return error("配种方式不能为空");
|
||||
}
|
||||
if (scBreedRecord.getBreedType() < 1 || scBreedRecord.getBreedType() > 4) {
|
||||
return error("配种方式只能是:1-同期发情、2-本交、3-冲胚、4-自然发情人工授精");
|
||||
if (scBreedRecord.getBreedType() < 1 || scBreedRecord.getBreedType() > 5) {
|
||||
return error("配种方式只能是:1-供体母羊配种、2-同期发情人工授精、3-本交、4-自然发情人工授精、5-胚胎移植");
|
||||
}
|
||||
|
||||
// 验证技术员
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhyc.module.produce.breed.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -37,6 +38,8 @@ public class ScBreedRecord extends BaseEntity
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType = "配种";
|
||||
|
||||
// 核心注解:指定JSON解析/序列化的日期格式,时区指定为东八区(Asia/Shanghai)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
|
||||
@Excel(name = "配种日期", dateFormat = "yyyy-MM-dd")
|
||||
private Date createTime;
|
||||
|
||||
@@ -62,7 +65,7 @@ public class ScBreedRecord extends BaseEntity
|
||||
private Integer embryoCount;
|
||||
|
||||
/** 1-同期发情, 2-本交, 3-自然发情, 4-胚胎移植 */
|
||||
@Excel(name = "配种方式", readConverterExp = "1=同期发情,2=本交,3=自然发情,4=胚胎移植")
|
||||
@Excel(name = "配种方式", readConverterExp = "1=供体母羊配种,2=同期发情人工授精,3=本交,4=胚胎移植,5=自然发情人工授精")
|
||||
private Integer breedType;
|
||||
|
||||
@Excel(name = "配种子类型")
|
||||
|
||||
@@ -123,6 +123,21 @@ public class ScPregnancyRecord extends BaseEntity
|
||||
private Integer daysAfterMating;
|
||||
/** 全部羊耳号列表(用于多耳号查询) */
|
||||
private List<String> allEarNumbers;
|
||||
// 1. 新增字段
|
||||
@Excel(name = "孕检原因")
|
||||
private String reason; // 初检/复检
|
||||
|
||||
// 2. 胚胎移植相关字段 (用于前端显示)
|
||||
@Excel(name = "供体母羊")
|
||||
private String donorEwe;
|
||||
@Excel(name = "供体母羊品种")
|
||||
private String donorEweVariety;
|
||||
@Excel(name = "供体公羊")
|
||||
private String donorRam;
|
||||
@Excel(name = "供体公羊品种")
|
||||
private String donorRamVariety;
|
||||
@Excel(name = "移胚数")
|
||||
private Integer embryoCount;
|
||||
|
||||
public List<String> getAllEarNumbers() {
|
||||
return allEarNumbers;
|
||||
|
||||
@@ -217,58 +217,28 @@ public class ScBreedRecordServiceImpl implements IScBreedRecordService
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* 根据母羊耳号获取最新的配种计划信息
|
||||
* 修改逻辑:优先查配种计划 -> 其次查冲胚记录(作为受体)
|
||||
* 简化后的获取配种计划方法:移除冲胚记录自动关联
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getLatestBreedPlanByEweTags(String manageTags)
|
||||
{
|
||||
public Map<String, Object> getLatestBreedPlanByEweTags(String manageTags) {
|
||||
try {
|
||||
// 1. 优先从配种计划生成表获取最新计划 (同期发情/本交等)
|
||||
// 1. 仅从配种计划生成表获取(本交、人工授精等普通计划)
|
||||
Map<String, Object> latestPlan = scBreedRecordMapper.getLatestBreedPlanByEweTags(manageTags);
|
||||
if (latestPlan != null && !latestPlan.isEmpty()) {
|
||||
log.info("从配种计划生成表获取到配种计划: {}", latestPlan);
|
||||
return latestPlan;
|
||||
}
|
||||
|
||||
// 2. 如果生成表中没有,从普通配种计划表获取
|
||||
// 2. 从普通配种计划表获取
|
||||
Map<String, Object> normalPlan = scBreedRecordMapper.getBreedPlanByEweTags(manageTags);
|
||||
if (normalPlan != null && !normalPlan.isEmpty()) {
|
||||
log.info("从配种计划表获取到配种计划: {}", normalPlan);
|
||||
return normalPlan;
|
||||
}
|
||||
|
||||
// 3. 【新增逻辑】如果都没有,尝试从冲胚记录中查找(该羊是否作为受体)
|
||||
// 这里的业务逻辑是:如果这只羊在冲胚记录的"受体列表"中,且是最近的操作,则认为它是去做胚胎移植
|
||||
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);
|
||||
// 胚胎移植逻辑已移至前端手动输入,此处不再查询 sc_embryo_flush
|
||||
log.info("未找到母羊 {} 的普通配种计划", manageTags);
|
||||
return null;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("获取配种/移植计划信息时发生异常,母羊耳号: {}", manageTags, e);
|
||||
log.error("获取配种计划异常", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,10 +45,10 @@ public class ScEmbryoFlushServiceImpl implements IScEmbryoFlushService
|
||||
VARIETY_NAME_MAP.put(4, "级杂一代");
|
||||
VARIETY_NAME_MAP.put(5, "级杂二代");
|
||||
VARIETY_NAME_MAP.put(6, "级杂三代");
|
||||
VARIETY_NAME_MAP.put(7, "1世代");
|
||||
VARIETY_NAME_MAP.put(8, "2世代");
|
||||
VARIETY_NAME_MAP.put(9, "3世代");
|
||||
VARIETY_NAME_MAP.put(10, "4世代");
|
||||
VARIETY_NAME_MAP.put(7, "一世代");
|
||||
VARIETY_NAME_MAP.put(8, "二世代");
|
||||
VARIETY_NAME_MAP.put(9, "三世代");
|
||||
VARIETY_NAME_MAP.put(10, "四世代");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -142,23 +142,24 @@ public class ScEmbryoFlushServiceImpl implements IScEmbryoFlushService
|
||||
// 2. 查询配种记录获取公羊信息
|
||||
Map<String, Object> breedRecord = scEmbryoFlushMapper.selectBreedRecordByEwe(donorFemaleNo);
|
||||
if (breedRecord != null && !breedRecord.isEmpty()) {
|
||||
String ramId = (String) breedRecord.get("ramId");
|
||||
result.put("donorMaleNo", ramId);
|
||||
String maleNo = (String) breedRecord.get("donorMaleNo"); // 这里的 Key 必须对应 SQL 里的别名
|
||||
result.put("donorMaleNo", maleNo);
|
||||
result.put("matingDate", breedRecord.get("matingDate"));
|
||||
|
||||
// 3. 查询公羊品种
|
||||
if (ramId != null && !ramId.trim().isEmpty()) {
|
||||
Map<String, Object> maleInfo = scEmbryoFlushMapper.selectSheepInfoByManageTag(ramId);
|
||||
if (maleNo != null && !maleNo.trim().isEmpty()) {
|
||||
Map<String, Object> maleInfo = scEmbryoFlushMapper.selectSheepInfoByManageTag(maleNo);
|
||||
if (maleInfo != null && !maleInfo.isEmpty()) {
|
||||
String maleVariety = (String) maleInfo.get("variety");
|
||||
Integer maleVarietyId = getIntValue(maleInfo.get("varietyId"));
|
||||
|
||||
result.put("donorMaleVariety", maleVariety);
|
||||
result.put("donorMaleVarietyId", maleVarietyId);
|
||||
|
||||
// 4. 根据品种ID计算胚胎品种
|
||||
if (maleVarietyId != null && femaleVarietyId != null) {
|
||||
String embryoVariety = calculateEmbryoVarietyById(maleVarietyId, femaleVarietyId);
|
||||
// 4. 【关键修复】使用品种名称计算胚胎品种
|
||||
// 这样可以确保无论数据库ID是多少,只要名字是对的就能算出结果
|
||||
Integer mId = getVarietyIdByName(maleVariety);
|
||||
Integer fId = getVarietyIdByName(femaleVariety);
|
||||
|
||||
if (mId != null && fId != null) {
|
||||
String embryoVariety = calculateEmbryoVarietyById(mId, fId);
|
||||
result.put("embryoVariety", embryoVariety);
|
||||
}
|
||||
}
|
||||
@@ -168,6 +169,7 @@ public class ScEmbryoFlushServiceImpl implements IScEmbryoFlushService
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 安全获取Integer值
|
||||
*/
|
||||
@@ -292,23 +294,22 @@ public class ScEmbryoFlushServiceImpl implements IScEmbryoFlushService
|
||||
// 级杂二代(BM)或n世代(SM) × 级杂一代/级杂二代/级杂三代/回交(公) → 世代
|
||||
|
||||
// 判断公羊是否为可产生世代的品种(级杂一代/二代/三代/回交)
|
||||
boolean isMaleForShidai = (male == VARIETY_JIZA_1 || male == VARIETY_JIZA_2 ||
|
||||
male == VARIETY_JIZA_3 || male == VARIETY_HUIJIAO);
|
||||
boolean isMaleCapableOfGeneration = (male >= 3 && male <= 10);
|
||||
|
||||
if (isMaleForShidai) {
|
||||
// 级杂二代(母) × 以上公羊 → 1世代
|
||||
if (isMaleCapableOfGeneration) {
|
||||
// 级杂二代(母) x 任意合格公羊 -> 一世代
|
||||
if (female == VARIETY_JIZA_2) {
|
||||
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_1);
|
||||
}
|
||||
// 1世代(母) × 以上公羊 → 2世代
|
||||
// 一世代(母) x 任意合格公羊 -> 二世代
|
||||
if (female == VARIETY_SHIDAI_1) {
|
||||
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_2);
|
||||
}
|
||||
// 2世代(母) × 以上公羊 → 3世代
|
||||
// 二世代(母) x 任意合格公羊 -> 三世代
|
||||
if (female == VARIETY_SHIDAI_2) {
|
||||
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_3);
|
||||
}
|
||||
// 3世代(母) × 以上公羊 → 4世代
|
||||
// 三世代(母) x 任意合格公羊 -> 四世代
|
||||
if (female == VARIETY_SHIDAI_3) {
|
||||
return VARIETY_NAME_MAP.get(VARIETY_SHIDAI_4);
|
||||
}
|
||||
|
||||
@@ -103,9 +103,6 @@ public class ScTransitionInfoController extends BaseController {
|
||||
|
||||
@PutMapping("/approve")
|
||||
public AjaxResult approveScTransitionInfo(@RequestBody ScTransitionInfo scTransitionInfo) {
|
||||
if ("转场转入".equals(scTransitionInfo.getEventType()) && scTransitionInfo.getSheepfoldId() == null) {
|
||||
return AjaxResult.error("转场转入时,接收羊舍ID不能为空");
|
||||
}
|
||||
int rows = scTransitionInfoService.approveScTransitionInfo(scTransitionInfo);
|
||||
return toAjax(rows);
|
||||
}
|
||||
@@ -114,4 +111,6 @@ public class ScTransitionInfoController extends BaseController {
|
||||
public AjaxResult searchEarNumbers(@RequestParam("query") String query){
|
||||
return success(scTransitionInfoService.searchEarNumbers(query.trim()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -31,20 +31,23 @@ public class ScChangeComment extends BaseEntity {
|
||||
* 羊只id
|
||||
*/
|
||||
private String sheepId;
|
||||
|
||||
@Excel(name = "管理耳号")
|
||||
private String manageTags;
|
||||
|
||||
/** 羊舍 */
|
||||
private Long sheepfoldId;
|
||||
@Excel(name = "羊舍")
|
||||
private String sheepfoldName;
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
/**
|
||||
* 事件日期
|
||||
*/
|
||||
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date eventDate;
|
||||
|
||||
/**
|
||||
* 新备注
|
||||
*/
|
||||
@@ -58,17 +61,25 @@ public class ScChangeComment extends BaseEntity {
|
||||
private String oldComment;
|
||||
|
||||
/**
|
||||
* 事件日期
|
||||
* 羊舍
|
||||
*/
|
||||
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date eventDate;
|
||||
private Long sheepfoldId;
|
||||
@Excel(name = "羊舍")
|
||||
private String sheepfoldName;
|
||||
|
||||
/**
|
||||
* 技术员
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/** 前端多耳号条件,非数据库字段 */
|
||||
/**
|
||||
* 前端多耳号条件,非数据库字段
|
||||
*/
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
}
|
||||
|
||||
@@ -36,11 +36,10 @@ public class ScChangeEar extends BaseEntity {
|
||||
private String manageTags;
|
||||
|
||||
/**
|
||||
* 羊舍
|
||||
* 品种
|
||||
*/
|
||||
private Long sheepfoldId;
|
||||
@Excel(name = "羊舍")
|
||||
private String sheepfoldName;
|
||||
@Excel(name = "品种")
|
||||
private String varietyName;
|
||||
|
||||
/**
|
||||
* 事件类型(改管理耳号/改电子耳号)
|
||||
@@ -48,6 +47,13 @@ public class ScChangeEar extends BaseEntity {
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
/**
|
||||
* 事件日期
|
||||
*/
|
||||
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date eventDate;
|
||||
|
||||
/**
|
||||
* 选择更改耳号类型(0电子耳号1管理耳号)
|
||||
*/
|
||||
@@ -67,17 +73,11 @@ public class ScChangeEar extends BaseEntity {
|
||||
private String oldTag;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
* 羊舍
|
||||
*/
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 事件日期
|
||||
*/
|
||||
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date eventDate;
|
||||
private Long sheepfoldId;
|
||||
@Excel(name = "羊舍")
|
||||
private String sheepfoldName;
|
||||
|
||||
/**
|
||||
* 技术员
|
||||
@@ -85,7 +85,20 @@ public class ScChangeEar extends BaseEntity {
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
/**
|
||||
* 前端多耳号查询条件,非表字段
|
||||
*/
|
||||
private List<String> manageTagsList;
|
||||
|
||||
|
||||
/**
|
||||
* 在群状态 0-全部 1-在群 2-不在群(列表查询用)
|
||||
*/
|
||||
private Integer inGroup;
|
||||
}
|
||||
|
||||
@@ -31,9 +31,35 @@ public class ScChangeVariety extends BaseEntity {
|
||||
* 羊只id
|
||||
*/
|
||||
private Integer sheepId;
|
||||
|
||||
@Excel(name = "耳号")
|
||||
private String manageTags;
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
/**
|
||||
* 事件日期
|
||||
*/
|
||||
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date eventDate;
|
||||
|
||||
/**
|
||||
* 新品种
|
||||
*/
|
||||
@Excel(name = "新品种")
|
||||
private String varietyNew;
|
||||
|
||||
/**
|
||||
* 旧品种
|
||||
*/
|
||||
@Excel(name = "旧品种")
|
||||
private String varietyOld;
|
||||
|
||||
/**
|
||||
* 羊舍
|
||||
*/
|
||||
@@ -42,22 +68,10 @@ public class ScChangeVariety extends BaseEntity {
|
||||
private String sheepfoldName;
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
* 技术员
|
||||
*/
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
/**
|
||||
* 原品种
|
||||
*/
|
||||
@Excel(name = "原品种")
|
||||
private String varietyOld;
|
||||
|
||||
/**
|
||||
* 新品种
|
||||
*/
|
||||
@Excel(name = "新品种")
|
||||
private String varietyNew;
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
@@ -66,18 +80,12 @@ public class ScChangeVariety extends BaseEntity {
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 技术员
|
||||
* 前端多耳号查询条件,非表字段
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 事件日期
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
@Excel(name = "事件日期",width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date eventDate;
|
||||
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
private List<String> manageTagsList;
|
||||
private Integer isDelete;
|
||||
}
|
||||
|
||||
@@ -33,42 +33,6 @@ public class ScTransGroup extends BaseEntity {
|
||||
@Excel(name = "耳号")
|
||||
private String manageTags;
|
||||
|
||||
/**
|
||||
* 事件类型(1-围产转群,2-普通转群,3-育肥转群,4-预售转群)
|
||||
*/
|
||||
private Integer eventType;
|
||||
@Excel(name = "事件类型")
|
||||
private String eventTypeText;
|
||||
|
||||
/**
|
||||
* 转入羊舍
|
||||
*/
|
||||
private String foldTo;
|
||||
|
||||
/**
|
||||
* 转出羊舍
|
||||
*/
|
||||
private String foldFrom;
|
||||
|
||||
/**
|
||||
* 羊只类型
|
||||
*/
|
||||
private Integer sheepTypeId;
|
||||
@Excel(name = "羊只类型")
|
||||
private String sheepTypeName;
|
||||
|
||||
/**
|
||||
* 转出羊舍名称
|
||||
*/
|
||||
@Excel(name = "转出羊舍")
|
||||
private String foldFromName;
|
||||
|
||||
/**
|
||||
* 转入羊舍名称
|
||||
*/
|
||||
@Excel(name = "转入羊舍")
|
||||
private String foldToName;
|
||||
|
||||
/**
|
||||
* 品种id
|
||||
*/
|
||||
@@ -80,40 +44,72 @@ public class ScTransGroup extends BaseEntity {
|
||||
@Excel(name = "品种")
|
||||
private String varietyName;
|
||||
|
||||
/**
|
||||
* 事件类型(1-围产转群,2-普通转群,3-育肥转群,4-预售转群)
|
||||
*/
|
||||
private String eventType;
|
||||
@Excel(name = "事件类型")
|
||||
private String eventTypeText;
|
||||
|
||||
private Integer reason;
|
||||
/**
|
||||
* 转群日期
|
||||
*/
|
||||
@Excel(name = "转群日期")
|
||||
private String transDate;
|
||||
|
||||
/**
|
||||
* 转入羊舍
|
||||
*/
|
||||
private String foldTo;
|
||||
/**
|
||||
* 转入羊舍名称
|
||||
*/
|
||||
@Excel(name = "转入羊舍")
|
||||
private String foldToName;
|
||||
|
||||
/**
|
||||
* 转出羊舍
|
||||
*/
|
||||
private String foldFrom;
|
||||
/**
|
||||
* 转出羊舍名称
|
||||
*/
|
||||
@Excel(name = "转出羊舍")
|
||||
private String foldFromName;
|
||||
|
||||
private String reason;
|
||||
/**
|
||||
* 转群原因描述 用于导出
|
||||
*/
|
||||
@Excel(name = "转群原因")
|
||||
private String reasonText;
|
||||
|
||||
/** 转群日期 */
|
||||
@Excel(name = "转群日期")
|
||||
private String transDate;
|
||||
/**
|
||||
* 技术员
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
|
||||
private Integer status;
|
||||
/**
|
||||
* 状态描述 用于导出
|
||||
*/
|
||||
@Excel(name = "状态")
|
||||
private String statusText;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
/**
|
||||
* 羊只类型
|
||||
*/
|
||||
private Integer sheepTypeId;
|
||||
|
||||
private String sheepTypeName;
|
||||
|
||||
/**
|
||||
* 前端多耳号查询条件,非表字段
|
||||
*/
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群)
|
||||
*/
|
||||
private Integer isDelete;
|
||||
}
|
||||
|
||||
@@ -33,24 +33,6 @@ public class ScTransitionInfo extends BaseEntity {
|
||||
@Excel(name = "耳号")
|
||||
private String manageTags;
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
|
||||
/**
|
||||
* 转场类型
|
||||
*/
|
||||
private Integer transType;
|
||||
@Excel(name = "转场类型")
|
||||
private String transTypeText;
|
||||
|
||||
/** 转场日期 */
|
||||
@Excel(name = "转场日期")
|
||||
private LocalDate transitionDate;
|
||||
|
||||
/**
|
||||
* 品种id
|
||||
*/
|
||||
@@ -62,6 +44,23 @@ public class ScTransitionInfo extends BaseEntity {
|
||||
@Excel(name = "品种")
|
||||
private String varietyName;
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
/** 转场日期 */
|
||||
@Excel(name = "转场日期")
|
||||
private LocalDate transitionDate;
|
||||
|
||||
/**
|
||||
* 转场类型
|
||||
*/
|
||||
private Integer transType;
|
||||
@Excel(name = "转场类型")
|
||||
private String transTypeText;
|
||||
|
||||
/**
|
||||
* 转入牧场
|
||||
*/
|
||||
@@ -69,21 +68,34 @@ public class ScTransitionInfo extends BaseEntity {
|
||||
private String transTo;
|
||||
|
||||
/**
|
||||
* 当前牧场
|
||||
* 转出牧场
|
||||
*/
|
||||
@Excel(name = "当前牧场")
|
||||
@Excel(name = "转出牧场")
|
||||
private String transFrom;
|
||||
|
||||
/**
|
||||
* 羊舍
|
||||
*/
|
||||
@Excel(name = "羊舍")
|
||||
private String sheepfoldName;
|
||||
|
||||
/**
|
||||
* 接收羊舍
|
||||
*/
|
||||
private Long sheepfoldId;
|
||||
|
||||
/**
|
||||
* 技术员
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@@ -91,12 +103,21 @@ public class ScTransitionInfo extends BaseEntity {
|
||||
@Excel(name = "状态")
|
||||
private String statusText;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
private List<String> manageTagsList;
|
||||
|
||||
private Integer isDelete;
|
||||
|
||||
/** 羊只类型ID(查询条件,非数据库字段) */
|
||||
private Long sheepTypeId;
|
||||
|
||||
/**
|
||||
* 当前场区ID(查询条件,关联bas_sheep.ranch_id),非数据库字段
|
||||
*/
|
||||
private Long currentRanchId;
|
||||
|
||||
/**
|
||||
* 当前场区名称(展示用),非数据库字段
|
||||
*/
|
||||
private String currentRanchName;
|
||||
}
|
||||
|
||||
@@ -59,11 +59,5 @@ public interface IScTransGroupService {
|
||||
*/
|
||||
public int deleteScTransGroupById(Integer id);
|
||||
|
||||
|
||||
/**
|
||||
* 审批转群记录
|
||||
*/
|
||||
int approveScTransGroup(ScTransGroup scTransGroup);
|
||||
|
||||
List<String> searchEarNumbers(String query);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
|
||||
public ScTransGroup selectScTransGroupById(Integer id) {
|
||||
ScTransGroup group = scTransGroupMapper.selectScTransGroupById(id);
|
||||
group.setReasonText(convertReason(group.getReason()));
|
||||
group.setStatusText(convertStatus(group.getStatus()));
|
||||
group.setEventTypeText(convertEventType(group.getEventType()));
|
||||
return group;
|
||||
}
|
||||
@@ -60,7 +59,6 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
|
||||
scTransGroup.getManageTagsList());
|
||||
list.forEach(group -> {
|
||||
group.setReasonText(convertReason(group.getReason()));
|
||||
group.setStatusText(convertStatus(group.getStatus()));
|
||||
group.setEventTypeText(convertEventType(group.getEventType()));
|
||||
});
|
||||
return list;
|
||||
@@ -76,7 +74,6 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertScTransGroup(ScTransGroup scTransGroup) {
|
||||
scTransGroup.setStatus(0);
|
||||
scTransGroup.setCreateTime(DateUtils.getNowDate());
|
||||
scTransGroup.setCreateBy(SecurityUtils.getUsername());
|
||||
int rows = scTransGroupMapper.insertScTransGroup(scTransGroup);
|
||||
@@ -123,22 +120,6 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
|
||||
return scTransGroupMapper.deleteScTransGroupById(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 审批转群记录
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int approveScTransGroup(ScTransGroup scTransGroup) {
|
||||
int rows = scTransGroupMapper.updateScTransGroup(scTransGroup);
|
||||
|
||||
if (rows > 0 && scTransGroup.getStatus() == 1) {
|
||||
updateSheepFold(scTransGroup);
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新羊只所在羊舍
|
||||
*/
|
||||
@@ -177,38 +158,28 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
|
||||
/**
|
||||
* 转换转群原因
|
||||
*/
|
||||
private String convertReason(Integer reasonCode) {
|
||||
Map<Integer, String> reasonMap = new HashMap<>();
|
||||
reasonMap.put(0, "新产羊过抗转群");
|
||||
reasonMap.put(1, "治愈转群");
|
||||
reasonMap.put(2, "病羊过抗转群");
|
||||
return reasonMap.getOrDefault(reasonCode, "未知原因");
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换状态
|
||||
*/
|
||||
private String convertStatus(Integer statusCode) {
|
||||
Map<Integer, String> statusMap = new HashMap<>();
|
||||
statusMap.put(0, "待批准");
|
||||
statusMap.put(1, "通过");
|
||||
statusMap.put(2, "驳回");
|
||||
return statusMap.getOrDefault(statusCode, "未知状态");
|
||||
private String convertReason(String reasonCode) {
|
||||
if (reasonCode == null) return "未知原因";
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("0","新产羊过抗转群");
|
||||
map.put("1","治愈转群");
|
||||
map.put("2","病羊过抗转群");
|
||||
return map.getOrDefault(reasonCode, reasonCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换事件类型(1-围产转群,2-普通转群,3-育肥转群,4-预售转群)
|
||||
*/
|
||||
private String convertEventType(Integer eventType) {
|
||||
private String convertEventType(String eventType) {
|
||||
if (eventType == null) {
|
||||
return "未知";
|
||||
}
|
||||
Map<Integer, String> eventTypeMap = new HashMap<>();
|
||||
eventTypeMap.put(1, "围产转群");
|
||||
eventTypeMap.put(2, "普通转群");
|
||||
eventTypeMap.put(3, "育肥转群");
|
||||
eventTypeMap.put(4, "预售转群");
|
||||
return eventTypeMap.getOrDefault(eventType, "未知");
|
||||
Map<String, String> eventTypeMap = new HashMap<>();
|
||||
eventTypeMap.put("1", "围产转群");
|
||||
eventTypeMap.put("2", "普通转群");
|
||||
eventTypeMap.put("3", "育肥转群");
|
||||
eventTypeMap.put("4", "预售转群");
|
||||
return eventTypeMap.getOrDefault(eventType, eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -135,6 +135,11 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
|
||||
if (existing.getStatus() != 0) {
|
||||
throw new RuntimeException("该记录已完成审批,无法重复操作");
|
||||
}
|
||||
if (scTransitionInfo.getStatus() == 1) { // 同意
|
||||
if ("转场转入".equals(scTransitionInfo.getEventType()) && scTransitionInfo.getSheepfoldId() == null) {
|
||||
throw new RuntimeException("转场转入时,接收羊舍ID不能为空");
|
||||
}
|
||||
}
|
||||
int rows = scTransitionInfoMapper.updateScTransitionInfo(scTransitionInfo);
|
||||
if (rows > 0 && scTransitionInfo.getStatus() == 1) {
|
||||
updateSheepRanch(scTransitionInfo);
|
||||
@@ -143,52 +148,47 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新羊只的所在牧场(基于现有牧场列表接口)
|
||||
* 更新羊只的所在牧场及羊舍
|
||||
*/
|
||||
private void updateSheepRanch(ScTransitionInfo transitionInfo) {
|
||||
/* 1. 目标牧场 */
|
||||
String transTo = transitionInfo.getTransTo();
|
||||
if (StringUtils.isBlank(transTo)) {
|
||||
throw new RuntimeException("转入牧场不能为空");
|
||||
}
|
||||
|
||||
DaRanch query = new DaRanch();
|
||||
query.setRanch(transTo);
|
||||
List<DaRanch> ranchList = daRanchService.selectDaRanchList(query);
|
||||
|
||||
Optional<DaRanch> matchedRanch = ranchList.stream()
|
||||
.filter(ranch -> transTo.equals(ranch.getRanch()))
|
||||
.findFirst();
|
||||
|
||||
if (!matchedRanch.isPresent()) {
|
||||
throw new RuntimeException("转入牧场 [" + transTo + "] 不存在");
|
||||
}
|
||||
Long targetRanchId = matchedRanch.get().getId();
|
||||
|
||||
//获取接收羊舍
|
||||
/* 2. 接收羊舍(审批通过时必传) */
|
||||
Long targetSheepfoldId = transitionInfo.getSheepfoldId();
|
||||
if ("转场转入".equals(transitionInfo.getEventType()) && targetSheepfoldId == null) {
|
||||
throw new RuntimeException("转场转入时,接收羊舍不能为空");
|
||||
if (targetSheepfoldId == null) {
|
||||
throw new RuntimeException("接收羊舍不能为空");
|
||||
}
|
||||
|
||||
/* 3. 逐只迁移 */
|
||||
String manageTags = transitionInfo.getManageTags();
|
||||
if (StringUtils.isBlank(manageTags)) {
|
||||
throw new RuntimeException("耳号不能为空");
|
||||
}
|
||||
List<String> tagList = Arrays.asList(manageTags.split(","));
|
||||
|
||||
for (String tag : tagList) {
|
||||
BasSheep sheep = basSheepService.selectBasSheepByManageTags(tag.trim());
|
||||
if (sheep == null) {
|
||||
throw new RuntimeException("耳号 [" + tag + "] 不存在");
|
||||
}
|
||||
|
||||
BasSheep updateSheep = new BasSheep();
|
||||
updateSheep.setId(sheep.getId());
|
||||
updateSheep.setRanchId(targetRanchId);
|
||||
if ("转场转入".equals(transitionInfo.getEventType())) {
|
||||
updateSheep.setSheepfoldId(targetSheepfoldId);
|
||||
}
|
||||
basSheepMapper.updateBasSheep(updateSheep);
|
||||
BasSheep upd = new BasSheep();
|
||||
upd.setId(sheep.getId());
|
||||
upd.setRanchId(targetRanchId);
|
||||
upd.setSheepfoldId(targetSheepfoldId); // 真正换舍
|
||||
basSheepMapper.updateBasSheep(upd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,10 +48,14 @@ public class ScCastrate extends BaseEntity {
|
||||
@Excel(name = "羊舍名称")
|
||||
private String sheepfoldName;
|
||||
|
||||
/** 品种id */
|
||||
/**
|
||||
* 品种id
|
||||
*/
|
||||
private Long varietyId;
|
||||
|
||||
/** 品种名称(联表查询返回,非数据库字段) */
|
||||
/**
|
||||
* 品种名称(联表查询返回,非数据库字段)
|
||||
*/
|
||||
@Excel(name = "品种")
|
||||
private String varietyName;
|
||||
|
||||
@@ -74,6 +78,13 @@ public class ScCastrate extends BaseEntity {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private String eventDate;
|
||||
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
/**
|
||||
* 前端多耳号查询条件,非表字段
|
||||
*/
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
}
|
||||
|
||||
@@ -18,14 +18,17 @@ import java.util.List;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ScFixHoof extends BaseEntity
|
||||
{
|
||||
public class ScFixHoof extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
/**
|
||||
* $column.columnComment
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/** 羊只id */
|
||||
/**
|
||||
* 羊只id
|
||||
*/
|
||||
private Integer sheepId;
|
||||
@Excel(name = "管理耳号")
|
||||
private String manageTags;
|
||||
@@ -36,25 +39,37 @@ public class ScFixHoof extends BaseEntity
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
/** 羊舍id */
|
||||
/**
|
||||
* 羊舍id
|
||||
*/
|
||||
private Integer sheepfold;
|
||||
|
||||
/** 羊舍名称 */
|
||||
/**
|
||||
* 羊舍名称
|
||||
*/
|
||||
@Excel(name = "羊舍名称")
|
||||
private String sheepfoldName;
|
||||
|
||||
/** 品种id */
|
||||
/**
|
||||
* 品种id
|
||||
*/
|
||||
private Long varietyId;
|
||||
|
||||
/** 品种名称(联表查询返回,非数据库字段) */
|
||||
/**
|
||||
* 品种名称(联表查询返回,非数据库字段)
|
||||
*/
|
||||
@Excel(name = "品种")
|
||||
private String varietyName;
|
||||
|
||||
/** 备注 */
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/** 技术员 */
|
||||
/**
|
||||
* 技术员
|
||||
*/
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
@@ -65,6 +80,13 @@ public class ScFixHoof extends BaseEntity
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private String eventDate;
|
||||
|
||||
/** 前端多耳号查询条件,非表字段 */
|
||||
/**
|
||||
* 前端多耳号查询条件,非表字段
|
||||
*/
|
||||
private List<String> manageTagsList;
|
||||
|
||||
/**
|
||||
* 是否在群查询条件(0-在群,1-离群),非数据库字段
|
||||
*/
|
||||
private Integer isDelete;
|
||||
}
|
||||
|
||||
@@ -103,6 +103,24 @@
|
||||
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
|
||||
and sm.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
|
||||
</if>
|
||||
<if test="sc.gender != null and sc.gender != ''">
|
||||
and bs.gender = #{sc.gender}
|
||||
</if>
|
||||
<if test="sc.technician != null and sc.technician != ''">
|
||||
and sm.technician like concat('%', #{sc.technician}, '%')
|
||||
</if>
|
||||
<if test="sc.isDelete != null">
|
||||
and bs.is_delete = #{sc.isDelete}
|
||||
</if>
|
||||
<if test="sc.monthAgeStart != null">
|
||||
and <![CDATA[ TIMESTAMPDIFF(MONTH, bs.birthday, CURDATE()) >= #{sc.monthAgeStart} ]]>
|
||||
</if>
|
||||
<if test="sc.monthAgeEnd != null">
|
||||
and <![CDATA[ TIMESTAMPDIFF(MONTH, bs.birthday, CURDATE()) <= #{sc.monthAgeEnd} ]]>
|
||||
</if>
|
||||
<if test="sc.breedStatusName != null and sc.breedStatusName != ''">
|
||||
and bbs.breed = #{sc.breedStatusName}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY sm.create_time DESC
|
||||
</select>
|
||||
@@ -196,6 +214,11 @@
|
||||
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
|
||||
AND bs.is_delete = 0
|
||||
ORDER BY bs.manage_tags
|
||||
LIMIT 50
|
||||
</select>
|
||||
|
||||
<select id="selectBreedStatusList" resultType="java.util.HashMap">
|
||||
SELECT id, breed as label, breed as value
|
||||
FROM bas_breed_status
|
||||
ORDER BY id
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -59,6 +59,9 @@
|
||||
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
|
||||
and sbs.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
|
||||
</if>
|
||||
<if test="sc.isDelete != null">
|
||||
and bs.is_delete = #{sc.isDelete}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY sbs.create_time DESC
|
||||
</select>
|
||||
|
||||
@@ -57,6 +57,9 @@
|
||||
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.endCreateTime != null">
|
||||
and sbr.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
|
||||
</if>
|
||||
<if test="sc.isDelete != null">
|
||||
and bs.is_delete = #{sc.isDelete}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY sbr.create_time DESC
|
||||
</select>
|
||||
@@ -134,7 +137,6 @@
|
||||
FROM bas_sheep bs
|
||||
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
|
||||
AND bs.is_delete = 0
|
||||
ORDER BY bs.manage_tags
|
||||
LIMIT 50
|
||||
ORDER BY bs.manage_tags LIMIT 50
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -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" />
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -31,63 +31,135 @@
|
||||
<result property="lastEventDate" column="last_event_date" />
|
||||
<result property="ranchName" column="sysRanch" />
|
||||
<result property="daysAfterMating" column="days_after_mating" />
|
||||
<result property="reason" column="reason" />
|
||||
<result property="donorEwe" column="donor_ewe" />
|
||||
<result property="donorRam" column="donor_ram" />
|
||||
<result property="embryoCount" column="embryo_count" />
|
||||
<result property="donorEweVariety" column="donor_ewe_variety" />
|
||||
<result property="donorRamVariety" column="donor_ram_variety" />
|
||||
</resultMap>
|
||||
|
||||
<!-- <sql id="selectScPregnancyRecordVo">-->
|
||||
<!-- select-->
|
||||
<!-- pr.id,-->
|
||||
<!-- pr.sheep_id,-->
|
||||
<!-- pr.datetime,-->
|
||||
<!-- pr.result,-->
|
||||
<!-- pr.fetus_count,-->
|
||||
<!-- pr.technician,-->
|
||||
<!-- pr.way,-->
|
||||
<!-- pr.remark,-->
|
||||
<!-- pr.create_by,-->
|
||||
<!-- pr.create_time,-->
|
||||
<!-- sf.bs_manage_tags as manage_tags,-->
|
||||
<!-- sf.variety,-->
|
||||
<!-- sf.month_age,-->
|
||||
<!-- sf.parity,-->
|
||||
<!-- sf.mating_counts,-->
|
||||
<!-- sf.sheepfold_name,-->
|
||||
<!-- sf.breed,-->
|
||||
<!-- sf.expected_date,-->
|
||||
<!-- sf.lambing_date as last_event_date,-->
|
||||
<!-- sf.dr_ranch as sysRanch,-->
|
||||
|
||||
<!-- -- 1. 上次孕检日期逻辑-->
|
||||
<!-- (SELECT MAX(datetime) FROM sc_pregnancy_record-->
|
||||
<!-- WHERE sheep_id = pr.sheep_id AND datetime < pr.datetime AND is_delete = 0) as last_event_date,-->
|
||||
<!-- -- 2. 配种基础信息-->
|
||||
<!-- br.create_time as mating_date,-->
|
||||
<!-- br.embryo_count,-->
|
||||
<!-- br.donor_ewe,-->
|
||||
<!-- br.donor_ram,-->
|
||||
<!-- -- 3. 配种类型映射逻辑-->
|
||||
<!-- CASE br.breed_type-->
|
||||
<!-- WHEN 1 THEN '供体母羊配种'-->
|
||||
<!-- WHEN 2 THEN '同期发情人工授精'-->
|
||||
<!-- WHEN 3 THEN '本交'-->
|
||||
<!-- WHEN 4 THEN '自然发情人工授精'-->
|
||||
<!-- WHEN 5 THEN '胚胎移植'-->
|
||||
<!-- ELSE '' END as mating_type_name,-->
|
||||
<!-- -- 4. 配种公羊品种-->
|
||||
<!-- ram_sf.bs_manage_tags as father_manage_tags,-->
|
||||
<!-- ram_sf.variety as father_variety,-->
|
||||
<!-- -- 5. 供体品种逻辑 (再次关联羊档案)-->
|
||||
<!-- donor_e_sf.variety as donor_ewe_variety,-->
|
||||
<!-- donor_r_sf.variety as donor_ram_variety-->
|
||||
<!-- FROM sc_pregnancy_record pr-->
|
||||
<!-- LEFT JOIN sheep_file sf ON pr.sheep_id = sf.id-->
|
||||
<!-- -- 关联最新的配种记录-->
|
||||
<!-- LEFT JOIN (-->
|
||||
<!-- SELECT t1.* FROM sc_breed_record t1-->
|
||||
<!-- INNER JOIN (SELECT ewe_id, MAX(create_time) as mt FROM sc_breed_record GROUP BY ewe_id) t2-->
|
||||
<!-- ON t1.ewe_id = t2.ewe_id AND t1.create_time = t2.mt-->
|
||||
<!-- ) br ON pr.sheep_id = br.ewe_id-->
|
||||
<!-- -- 关联配种公羊品种-->
|
||||
<!-- LEFT JOIN sheep_file ram_sf ON br.ram_id = ram_sf.id-->
|
||||
<!-- -- 关联供体母羊品种 (基于耳号)-->
|
||||
<!-- LEFT JOIN sheep_file donor_e_sf ON br.donor_ewe = donor_e_sf.bs_manage_tags-->
|
||||
<!-- -- 关联供体公羊品种 (基于耳号)-->
|
||||
<!-- LEFT JOIN sheep_file donor_r_sf ON br.donor_ram = donor_r_sf.bs_manage_tags-->
|
||||
<!-- -- 关联配种信息-->
|
||||
<!-- ram_sf.bs_manage_tags as father_manage_tags,-->
|
||||
<!-- ram_sf.variety as father_variety,-->
|
||||
<!-- mating_type.dict_label as mating_type_name,-->
|
||||
<!-- COALESCE(br.create_time, sf.mating_date) as mating_date,-->
|
||||
<!-- -- 计算配后天数:孕检日期 - 配种日期-->
|
||||
<!-- CASE-->
|
||||
<!-- WHEN COALESCE(br.create_time, sf.mating_date) IS NOT NULL-->
|
||||
<!-- THEN DATEDIFF(pr.datetime, COALESCE(br.create_time, sf.mating_date))-->
|
||||
<!-- ELSE NULL-->
|
||||
<!-- END as days_after_mating-->
|
||||
<!-- from sc_pregnancy_record pr-->
|
||||
<!-- INNER JOIN sheep_file sf on pr.sheep_id = sf.id-->
|
||||
<!-- -- 关联配种记录表,获取最新的配种记录-->
|
||||
<!-- left join (-->
|
||||
<!-- select br1.*-->
|
||||
<!-- from sc_breed_record br1-->
|
||||
<!-- inner join (-->
|
||||
<!-- select ewe_id, max(create_time) as max_time-->
|
||||
<!-- from sc_breed_record-->
|
||||
<!-- group by ewe_id-->
|
||||
<!-- ) br2 on br1.ewe_id = br2.ewe_id and br1.create_time = br2.max_time-->
|
||||
<!-- ) br on sf.id = br.ewe_id-->
|
||||
<!-- -- 关联公羊信息-->
|
||||
<!-- left join sheep_file ram_sf on br.ram_id = ram_sf.id-->
|
||||
<!-- -- 关联配种类型字典-->
|
||||
<!-- left join sys_dict_data mating_type on sf.mating_type_id = mating_type.dict_value-->
|
||||
<!-- and mating_type.dict_type = 'breed_type' and mating_type.status = '0'-->
|
||||
<!-- </sql>-->
|
||||
|
||||
|
||||
<sql id="selectScPregnancyRecordVo">
|
||||
select
|
||||
pr.id,
|
||||
pr.sheep_id,
|
||||
pr.datetime,
|
||||
pr.result,
|
||||
pr.fetus_count,
|
||||
pr.technician,
|
||||
pr.way,
|
||||
pr.remark,
|
||||
pr.create_by,
|
||||
pr.create_time,
|
||||
sf.bs_manage_tags as manage_tags,
|
||||
sf.variety,
|
||||
sf.month_age,
|
||||
sf.parity,
|
||||
sf.mating_counts,
|
||||
sf.sheepfold_name,
|
||||
sf.breed,
|
||||
sf.expected_date,
|
||||
sf.lambing_date as last_event_date,
|
||||
sf.dr_ranch as sysRanch,
|
||||
-- 关联配种信息
|
||||
pr.id, pr.sheep_id, pr.datetime, pr.result, pr.fetus_count, pr.technician, pr.way, pr.remark, pr.create_by, pr.create_time,pr.reason,
|
||||
sf.bs_manage_tags as manage_tags, sf.variety, sf.month_age, sf.parity, sf.mating_counts, sf.sheepfold_name, sf.breed, sf.expected_date, sf.dr_ranch as sysRanch,
|
||||
(SELECT MAX(datetime) FROM sc_pregnancy_record WHERE sheep_id = pr.sheep_id AND datetime < pr.datetime AND is_delete = 0) as last_event_date,
|
||||
br.create_time as mating_date,
|
||||
br.embryo_count, br.donor_ewe, br.donor_ram,
|
||||
mating_type.dict_label as mating_type_name,
|
||||
ram_sf.bs_manage_tags as father_manage_tags,
|
||||
ram_sf.variety as father_variety,
|
||||
mating_type.dict_label as mating_type_name,
|
||||
COALESCE(br.create_time, sf.mating_date) as mating_date,
|
||||
-- 计算配后天数:孕检日期 - 配种日期
|
||||
CASE
|
||||
WHEN COALESCE(br.create_time, sf.mating_date) IS NOT NULL
|
||||
THEN DATEDIFF(pr.datetime, COALESCE(br.create_time, sf.mating_date))
|
||||
ELSE NULL
|
||||
END as days_after_mating
|
||||
donor_e_sf.variety as donor_ewe_variety,
|
||||
donor_r_sf.variety as donor_ram_variety,
|
||||
DATEDIFF(pr.datetime, br.create_time) as days_after_mating
|
||||
from sc_pregnancy_record pr
|
||||
INNER JOIN sheep_file sf on pr.sheep_id = sf.id
|
||||
-- 关联配种记录表,获取最新的配种记录
|
||||
left join (
|
||||
select br1.*
|
||||
from sc_breed_record br1
|
||||
inner join (
|
||||
select ewe_id, max(create_time) as max_time
|
||||
from sc_breed_record
|
||||
group by ewe_id
|
||||
) br2 on br1.ewe_id = br2.ewe_id and br1.create_time = br2.max_time
|
||||
) br on sf.id = br.ewe_id
|
||||
-- 关联公羊信息
|
||||
left join sheep_file ram_sf on br.ram_id = ram_sf.id
|
||||
-- 关联配种类型字典
|
||||
left join sys_dict_data mating_type on sf.mating_type_id = mating_type.dict_value
|
||||
LEFT JOIN sheep_file sf on pr.sheep_id = sf.id
|
||||
LEFT JOIN (
|
||||
select t1.* from sc_breed_record t1
|
||||
inner join (select ewe_id, max(create_time) as mt from sc_breed_record group by ewe_id) t2
|
||||
on t1.ewe_id = t2.ewe_id and t1.create_time = t2.mt
|
||||
) br on pr.sheep_id = br.ewe_id
|
||||
LEFT JOIN sheep_file ram_sf on br.ram_id = ram_sf.id
|
||||
LEFT JOIN sys_dict_data mating_type on CAST(br.breed_type AS CHAR) = mating_type.dict_value
|
||||
and mating_type.dict_type = 'breed_type' and mating_type.status = '0'
|
||||
LEFT JOIN sheep_file donor_e_sf on br.donor_ewe = donor_e_sf.bs_manage_tags
|
||||
LEFT JOIN sheep_file donor_r_sf on br.donor_ram = donor_r_sf.bs_manage_tags
|
||||
</sql>
|
||||
|
||||
<!-- 重写的查询列表方法 -->
|
||||
<select id="selectScPregnancyRecordList" parameterType="ScPregnancyRecord" resultMap="ScPregnancyRecordResult">
|
||||
<include refid="selectScPregnancyRecordVo"/>
|
||||
|
||||
<where>
|
||||
pr.is_delete = 0
|
||||
|
||||
@@ -142,22 +214,33 @@
|
||||
<select id="selectBreedInfoByManageTags" parameterType="String" resultType="map">
|
||||
SELECT
|
||||
sf.bs_manage_tags as manageTags,
|
||||
-- 从配种记录表获取公羊耳号
|
||||
ram_sf.bs_manage_tags as fatherManageTags,
|
||||
ram_sf.variety as fatherVariety,
|
||||
br.donor_ewe as donorEwe,
|
||||
br.donor_ram as donorRam,
|
||||
donor_e_sf.variety as donorEweVariety,
|
||||
donor_r_sf.variety as donorRamVariety,
|
||||
-- 核心修改:如果是胚胎移植(5),显示供体公羊;否则显示普通配种公羊
|
||||
CASE
|
||||
WHEN br.breed_type = 5 THEN br.donor_ram
|
||||
ELSE ram_sf.bs_manage_tags
|
||||
END as fatherManageTags,
|
||||
-- 品种也需要同步切换
|
||||
CASE
|
||||
WHEN br.breed_type = 5 THEN donor_r_sf.variety
|
||||
ELSE ram_sf.variety
|
||||
END as fatherVariety,
|
||||
br.create_time as matingDate,
|
||||
mating_type.dict_label as matingTypeName,
|
||||
br.technician as breedTechnician,
|
||||
br.create_time as breedCreateTime
|
||||
br.technician as breedTechnician
|
||||
FROM sheep_file sf
|
||||
LEFT JOIN sc_breed_record br ON sf.id = br.ewe_id
|
||||
LEFT JOIN sheep_file ram_sf ON br.ram_id = ram_sf.id
|
||||
LEFT JOIN sys_dict_data mating_type ON sf.mating_type_id = mating_type.dict_value
|
||||
-- 新增关联:通过耳号获取供体公羊的品种信息
|
||||
LEFT JOIN sheep_file donor_r_sf ON br.donor_ram = donor_r_sf.bs_manage_tags
|
||||
LEFT JOIN sheep_file donor_e_sf ON br.donor_ewe = donor_e_sf.bs_manage_tags
|
||||
LEFT JOIN sys_dict_data mating_type ON CAST(br.breed_type AS CHAR) = mating_type.dict_value
|
||||
AND mating_type.dict_type = 'breed_type' AND mating_type.status = '0'
|
||||
WHERE sf.bs_manage_tags = #{manageTags}
|
||||
AND sf.is_delete = 0
|
||||
ORDER BY br.create_time DESC
|
||||
LIMIT 1
|
||||
WHERE sf.bs_manage_tags = #{manageTags} AND sf.is_delete = 0
|
||||
ORDER BY br.create_time DESC LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insertScPregnancyRecord" parameterType="ScPregnancyRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
@@ -172,6 +255,7 @@
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="reason != null">reason,</if>
|
||||
is_delete
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
@@ -184,6 +268,7 @@
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="reason != null">#{reason},</if>
|
||||
0
|
||||
</trim>
|
||||
</insert>
|
||||
@@ -197,6 +282,7 @@
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="way != null">way = #{way},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="reason != null">reason = #{reason},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -43,8 +43,11 @@
|
||||
bs.manage_tags like concat('%', #{tag}, '%')
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="sc.sheepfoldId != null">
|
||||
and bs.sheepfold_id = #{sc.sheepfoldId}
|
||||
<!-- <if test="sc.sheepfoldId != null">-->
|
||||
<!-- and bs.sheepfold_id = #{sc.sheepfoldId}-->
|
||||
<!-- </if>-->
|
||||
<if test="sc.technician != null and sc.technician != ''">
|
||||
and scc.technician like concat('%', #{sc.technician}, '%')
|
||||
</if>
|
||||
<if test="sc.newComment != null and sc.newComment != ''">
|
||||
and scc.new_comment like concat('%', #{sc.newComment}, '%')
|
||||
@@ -60,6 +63,9 @@
|
||||
and sc.params.endEventDate != null and sc.params.endEventDate != ''">
|
||||
and scc.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
|
||||
</if>
|
||||
<if test="sc.isDelete != null">
|
||||
and bs.is_delete = #{sc.isDelete}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY scc.create_time DESC
|
||||
</select>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
sce.sheep_id,
|
||||
bs.manage_tags as manage_tags,
|
||||
sf.sheepfold_name as sheepfold_name,
|
||||
bv.variety as varietyName,
|
||||
case
|
||||
when sce.ear_type = 0 then '改电子耳号'
|
||||
when sce.ear_type = 1 then '改管理耳号'
|
||||
@@ -41,6 +42,7 @@
|
||||
from sc_change_ear sce
|
||||
LEFT JOIN bas_sheep bs ON sce.sheep_id = bs.id
|
||||
LEFT JOIN da_sheepfold sf ON bs.sheepfold_id = sf.id
|
||||
LEFT JOIN bas_sheep_variety bv on bs.variety_id = bv.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScChangeEarList" resultMap="ScChangeEarResult">
|
||||
@@ -53,7 +55,7 @@
|
||||
or bs.electronic_tags like concat('%', #{tag}, '%'))
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="sc.sheepfoldId != null">and bs.sheepfold_id = #{sc.sheepfoldId}</if>
|
||||
<if test="sc.technician != null and sc.technician != ''">and sce.technician like concat('%', #{sc.technician}, '%')</if>
|
||||
<if test="sc.earType != null">and sce.ear_type = #{sc.earType}</if>
|
||||
<if test="sc.newTag != null and sc.newTag != ''">and sce.newTag like concat('%', #{sc.newTag}, '%')</if>
|
||||
<if test="sc.oldTag != null and sc.oldTag != ''">and sce.oldTag like concat('%', #{sc.oldTag}, '%')</if>
|
||||
@@ -65,6 +67,12 @@
|
||||
and sc.params.endEventDate != null and sc.params.endEventDate != ''">
|
||||
and sce.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
|
||||
</if>
|
||||
<if test="sc.inGroup != null">
|
||||
<choose>
|
||||
<when test="sc.inGroup == 1">and bs.is_delete = 0</when>
|
||||
<when test="sc.inGroup == 2">and bs.is_delete = 1</when>
|
||||
</choose>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY sce.create_time DESC
|
||||
</select>
|
||||
|
||||
@@ -46,15 +46,25 @@
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="sc.sheepId != null">and scv.sheep_id = #{sc.sheepId}</if>
|
||||
<if test="sc.sheepfoldId != null">and bs.sheepfold_id = #{sc.sheepfoldId}</if>
|
||||
<if test="sc.varietyOld != null and sc.varietyOld != ''">and scv.variety_old like concat('%', #{sc.varietyOld}, '%')</if>
|
||||
<if test="sc.varietyNew != null and sc.varietyNew != ''">and scv.variety_new like concat('%', #{sc.varietyNew}, '%')</if>
|
||||
<!-- <if test="sc.sheepfoldId != null">and bs.sheepfold_id = #{sc.sheepfoldId}</if>-->
|
||||
<if test="sc.technician != null and sc.technician != ''">and scv.technician like concat('%',
|
||||
#{sc.technician}, '%')
|
||||
</if>
|
||||
<if test="sc.varietyOld != null and sc.varietyOld != ''">and scv.variety_old like concat('%',
|
||||
#{sc.varietyOld}, '%')
|
||||
</if>
|
||||
<if test="sc.varietyNew != null and sc.varietyNew != ''">and scv.variety_new like concat('%',
|
||||
#{sc.varietyNew}, '%')
|
||||
</if>
|
||||
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
|
||||
and scv.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
|
||||
</if>
|
||||
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != '' and sc.params.endEventDate != null and sc.params.endEventDate != ''">
|
||||
and scv.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
|
||||
</if>
|
||||
<if test="sc.isDelete != null">
|
||||
and bs.is_delete = #{sc.isDelete}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY scv.create_time DESC
|
||||
</select>
|
||||
@@ -119,7 +129,6 @@
|
||||
FROM bas_sheep bs
|
||||
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
|
||||
AND bs.is_delete = 0
|
||||
ORDER BY bs.manage_tags
|
||||
LIMIT 50
|
||||
ORDER BY bs.manage_tags LIMIT 50
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -15,7 +15,6 @@
|
||||
<result property="varietyId" column="variety_id"/>
|
||||
<result property="varietyName" column="varietyName"/>
|
||||
<result property="technician" column="technician"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="comment" column="comment"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
@@ -34,7 +33,6 @@
|
||||
bv.variety AS varietyName,
|
||||
st.id AS sheepTypeId,
|
||||
st.name AS sheepTypeName,
|
||||
tg.status,
|
||||
tg.comment,
|
||||
tg.create_by,
|
||||
tg.create_time,
|
||||
@@ -54,20 +52,28 @@
|
||||
<select id="selectScTransGroupList" resultMap="ScTransGroupResult">
|
||||
<include refid="selectScTransGroupVo"/>
|
||||
<where>
|
||||
<if test="manageTagsList != null and manageTagsList.size() > 0">
|
||||
<foreach collection="manageTagsList" item="tag" separator="or" open="and (" close=")">
|
||||
s.manage_tags like concat('%', #{tag}, '%')
|
||||
<if test="sc.manageTagsList != null and sc.manageTagsList.size() > 0">
|
||||
<foreach collection="sc.manageTagsList" item="tag" separator="or" open="and (" close=")">
|
||||
s.manage_tags LIKE CONCAT('%', #{tag}, '%')
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="sc.sheepId != null">and tg.sheep_id = #{sc.sheepId}</if>
|
||||
<if test="sc.foldTo != null and sc.foldTo != ''">and tg.fold_to = #{sc.foldTo}</if>
|
||||
<if test="sc.foldFrom != null and sc.foldFrom != ''">and tg.fold_from = #{sc.foldFrom}</if>
|
||||
<if test="sc.status != null">and tg.status = #{sc.status}</if>
|
||||
<if test="sc.varietyId != null">and tg.variety_id = #{sc.varietyId}</if>
|
||||
<if test="sc.sheepTypeId != null">and st.id = #{sc.sheepTypeId}</if>
|
||||
<if test="sc.params != null and sc.params.beginTransDate != null and sc.params.beginTransDate != '' and sc.params.endTransDate != null and sc.params.endTransDate != ''">
|
||||
and tg.trans_date between #{sc.params.beginTransDate} and #{sc.params.endTransDate}
|
||||
</if>
|
||||
<if test="sc.eventType != null and sc.eventType != ''">
|
||||
and tg.event_type like concat('%', #{sc.eventType}, '%')
|
||||
</if>
|
||||
<if test="sc.technician != null and sc.technician != ''">
|
||||
and tg.technician like concat('%', #{sc.technician}, '%')
|
||||
</if>
|
||||
<if test="sc.isDelete != null">
|
||||
and s.is_delete = #{sc.isDelete}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY tg.create_time DESC
|
||||
</select>
|
||||
@@ -90,7 +96,6 @@
|
||||
<if test="varietyId != null">variety_id,</if>
|
||||
<if test="reason != null">reason,</if>
|
||||
<if test="technician != null and technician != ''">technician,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
@@ -104,7 +109,6 @@
|
||||
<if test="varietyId != null">#{varietyId},</if>
|
||||
<if test="reason != null">#{reason},</if>
|
||||
<if test="technician != null and technician != ''">#{technician},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
@@ -122,7 +126,6 @@
|
||||
<if test="varietyId != null">variety_id = #{varietyId},</if>
|
||||
<if test="reason != null">reason = #{reason},</if>
|
||||
<if test="technician != null and technician != ''">technician = #{technician},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
@@ -149,6 +152,5 @@
|
||||
WHERE s.manage_tags LIKE CONCAT('%', #{query}, '%')
|
||||
AND s.is_delete = 0
|
||||
ORDER BY s.manage_tags
|
||||
LIMIT 50
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -25,8 +25,10 @@
|
||||
SELECT t.*,
|
||||
bv.variety AS varietyName,
|
||||
bs.manage_tags AS manageTags,
|
||||
sf.sheepfold_name AS sheepfoldName,
|
||||
t.event_type AS eventType,
|
||||
t.transition_date AS transitionDate,
|
||||
dr.ranch AS currentRanchName,
|
||||
CASE t.trans_type
|
||||
WHEN 0 THEN '内部调拨'
|
||||
WHEN 1 THEN '内部销售'
|
||||
@@ -42,6 +44,8 @@
|
||||
FROM sc_transition_info t
|
||||
LEFT JOIN bas_sheep bs ON t.sheep_id = bs.id
|
||||
LEFT JOIN bas_sheep_variety bv ON bs.variety_id = bv.id
|
||||
LEFT JOIN da_sheepfold sf ON t.sheepfold_id = sf.id
|
||||
LEFT JOIN da_ranch dr ON bs.ranch_id = dr.id
|
||||
</sql>
|
||||
|
||||
<select id="selectScTransitionInfoList" resultMap="ScTransitionInfoResult">
|
||||
@@ -61,6 +65,18 @@
|
||||
<if test="sc.params != null and sc.params.beginTransitionDate != null and sc.params.beginTransitionDate != '' and sc.params.endTransitionDate != null and sc.params.endTransitionDate != ''">
|
||||
and t.transition_date between #{sc.params.beginTransitionDate} and #{sc.params.endTransitionDate}
|
||||
</if>
|
||||
<if test="sc.technician != null and sc.technician != ''">
|
||||
and t.technician like concat('%', #{sc.technician}, '%')
|
||||
</if>
|
||||
<if test="sc.isDelete != null">
|
||||
and bs.is_delete = #{sc.isDelete}
|
||||
</if>
|
||||
<if test="sc.sheepTypeId != null">
|
||||
and bs.type_id = #{sc.sheepTypeId}
|
||||
</if>
|
||||
<if test="sc.currentRanchId != null">
|
||||
and bs.ranch_id = #{sc.currentRanchId}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY t.create_time DESC
|
||||
</select>
|
||||
@@ -155,7 +171,6 @@
|
||||
FROM bas_sheep bs
|
||||
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
|
||||
AND bs.is_delete = 0
|
||||
ORDER BY bs.manage_tags
|
||||
LIMIT 50
|
||||
ORDER BY bs.manage_tags LIMIT 50
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -57,6 +57,9 @@
|
||||
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != '' and sc.params.endEventDate != null and sc.params.endEventDate != ''">
|
||||
and sc.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
|
||||
</if>
|
||||
<if test="sc.isDelete != null">
|
||||
and bs.is_delete = #{sc.isDelete}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY sc.create_time DESC
|
||||
</select>
|
||||
|
||||
@@ -47,13 +47,18 @@
|
||||
</if>
|
||||
<if test="sc.sheepfold != null">and bs.sheepfold_id = #{sc.sheepfold}</if>
|
||||
<if test="sc.varietyId != null">and bs.variety_id = #{sc.varietyId}</if>
|
||||
<if test="sc.technician != null and sc.technician != ''">and fh.technician like concat('%', #{sc.technician}, '%')</if>
|
||||
<if test="sc.technician != null and sc.technician != ''">and fh.technician like concat('%',
|
||||
#{sc.technician}, '%')
|
||||
</if>
|
||||
<if test="sc.params != null and sc.params.beginCreateTime != null and sc.params.beginCreateTime != '' and sc.params.endCreateTime != null and sc.params.endCreateTime != ''">
|
||||
and fh.create_time between #{sc.params.beginCreateTime} and #{sc.params.endCreateTime}
|
||||
</if>
|
||||
<if test="sc.params != null and sc.params.beginEventDate != null and sc.params.beginEventDate != '' and sc.params.endEventDate != null and sc.params.endEventDate != ''">
|
||||
and fh.event_date between #{sc.params.beginEventDate} and #{sc.params.endEventDate}
|
||||
</if>
|
||||
<if test="sc.isDelete != null">
|
||||
and bs.is_delete = #{sc.isDelete}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY fh.create_time DESC
|
||||
</select>
|
||||
@@ -118,6 +123,5 @@
|
||||
WHERE bs.manage_tags LIKE CONCAT('%', #{query}, '%')
|
||||
AND bs.is_delete = 0
|
||||
ORDER BY bs.manage_tags
|
||||
LIMIT 50
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user