Merge remote-tracking branch 'zhyc/main'
This commit is contained in:
commit
c0fe74aca3
@ -8,6 +8,7 @@ import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
|
||||
|
||||
0
zhyc-module/src/main/java/com/zhyc/module/base/1
Normal file
0
zhyc-module/src/main/java/com/zhyc/module/base/1
Normal file
@ -3,6 +3,7 @@ package com.zhyc.module.base.mapper;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhyc.module.base.domain.BasSheep;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
@ -11,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
* @author ruoyi
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@Mapper
|
||||
public interface BasSheepMapper
|
||||
{
|
||||
/**
|
||||
|
||||
@ -80,6 +80,17 @@ public class DiagnosisController extends BaseController
|
||||
return toAjax(diagnosisService.insertDiagnosis(diagnosis));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增批量诊疗结果
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('diagnosis:diagnosis:add')")
|
||||
@Log(title = "诊疗结果", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/adds")
|
||||
public AjaxResult adds(@RequestBody Diagnosis diagnosis)
|
||||
{
|
||||
return toAjax(diagnosisService.insertDiagnosisList(diagnosis));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改诊疗结果
|
||||
*/
|
||||
|
||||
@ -27,6 +27,7 @@ public class Diagnosis extends BaseEntity
|
||||
/** 治疗记录id */
|
||||
@Excel(name = "治疗记录")
|
||||
private Long treatId;
|
||||
private Integer[] treatIds;
|
||||
|
||||
/** 羊只id */
|
||||
@Excel(name = "羊只耳号")
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.zhyc.module.biosafety.domain;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -28,6 +30,18 @@ public class SwMedicineUsage extends BaseEntity
|
||||
@Excel(name = "使用名称")
|
||||
private String name;
|
||||
|
||||
/** 羊舍名称 */
|
||||
@Excel(name = "使用名称")
|
||||
private String sheepfoldName;
|
||||
private Integer sheepfoldId;
|
||||
/** 耳号 */
|
||||
@Excel(name = "耳号")
|
||||
private String sheepNo;
|
||||
private Integer sheepId;
|
||||
/** 使用时间 */
|
||||
@Excel(name = "使用时间")
|
||||
private Date datetime;
|
||||
|
||||
/** 使用类型 */
|
||||
@Excel(name = "使用类型")
|
||||
private String useType;
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
package com.zhyc.module.biosafety.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 java.util.Date;
|
||||
|
||||
/**
|
||||
* 药品使用记录详情对象 sw_medicine_usage_details
|
||||
*
|
||||
@ -46,6 +49,11 @@ public class SwMedicineUsageDetails extends BaseEntity
|
||||
@Excel(name = "使用方法")
|
||||
private String usageId;
|
||||
|
||||
/** 使用时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "使用时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date usetime;
|
||||
|
||||
/** 生产厂家 */
|
||||
@Excel(name = "生产厂家")
|
||||
private String manufacturer;
|
||||
|
||||
@ -89,6 +89,10 @@ public class Treatment extends BaseEntity
|
||||
/** 兽医 */
|
||||
@Excel(name = "兽医")
|
||||
private String veterinary;
|
||||
/** 治疗状态 */
|
||||
@Excel(name = "治疗状态")
|
||||
private String status;
|
||||
|
||||
|
||||
/** 药品使用记录id */
|
||||
@Excel(name = "药品使用记录id")
|
||||
|
||||
@ -63,4 +63,7 @@ public interface TreatmentMapper
|
||||
public int deleteTreatmentByIds(Long[] ids);
|
||||
|
||||
int insertTreatmentList(List<Treatment> treatments);
|
||||
|
||||
|
||||
List<Treatment> selectTreatmentStatus(Long sheepId);
|
||||
}
|
||||
|
||||
@ -59,4 +59,6 @@ public interface IDiagnosisService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDiagnosisById(Long id);
|
||||
|
||||
int insertDiagnosisList(Diagnosis diagnosis);
|
||||
}
|
||||
|
||||
@ -78,6 +78,7 @@ public class DewormServiceImpl implements IDewormService
|
||||
medicineUsage.setSwMedicineUsageDetailsList(deworm.getUsageDetails());
|
||||
medicineUsage.setName("羊只驱虫");
|
||||
medicineUsage.setUseType("1");
|
||||
medicineUsage.setDatetime(deworm.getDatetime());
|
||||
|
||||
List<Deworm> deworms = new ArrayList<>();
|
||||
|
||||
@ -95,6 +96,8 @@ public class DewormServiceImpl implements IDewormService
|
||||
dew.setGender(String.valueOf(sheepFile.getGender()));
|
||||
dew.setBreed(sheepFile.getBreed());
|
||||
dew.setParity(sheepFile.getParity());
|
||||
|
||||
medicineUsage.setSheepId(sheepId);
|
||||
// 获取药品使用记录的id
|
||||
Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage);
|
||||
dew.setUsageId(usageId);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@ -9,13 +10,18 @@ import com.zhyc.module.base.domain.BasSheep;
|
||||
import com.zhyc.module.base.domain.SheepFile;
|
||||
import com.zhyc.module.base.mapper.BasSheepMapper;
|
||||
import com.zhyc.module.base.mapper.SheepFileMapper;
|
||||
import com.zhyc.module.biosafety.domain.Treatment;
|
||||
import com.zhyc.module.biosafety.mapper.DiagnosisMapper;
|
||||
import com.zhyc.module.biosafety.mapper.TreatmentMapper;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.biosafety.domain.Diagnosis;
|
||||
import com.zhyc.module.biosafety.service.IDiagnosisService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 诊疗结果Service业务层处理
|
||||
*
|
||||
@ -31,6 +37,8 @@ public class DiagnosisServiceImpl implements IDiagnosisService
|
||||
private SheepFileMapper sheepFileMapper;
|
||||
@Autowired
|
||||
private BasSheepMapper sheepMapper;
|
||||
@Autowired
|
||||
private TreatmentMapper treatmentMapper;
|
||||
|
||||
/**
|
||||
* 查询诊疗结果
|
||||
@ -75,16 +83,87 @@ public class DiagnosisServiceImpl implements IDiagnosisService
|
||||
String username = SecurityUtils.getLoginUser().getUser().getNickName();
|
||||
diagnosis.setCreateBy(username);
|
||||
diagnosis.setCreateTime(DateUtils.getNowDate());
|
||||
if (!Objects.equals(sheepFile.getSheepfoldId(), diagnosis.getSheepfoldId())){
|
||||
BasSheep basSheep = new BasSheep();
|
||||
basSheep.setId(diagnosis.getSheepId());
|
||||
basSheep.setSheepfoldId(diagnosis.getSheepfoldId());
|
||||
sheepMapper.updateBasSheep(basSheep);
|
||||
|
||||
if (diagnosis.getSheepfoldId() != null)
|
||||
if (!Objects.equals(sheepFile.getSheepfoldId(), diagnosis.getSheepfoldId())) {
|
||||
BasSheep basSheep = new BasSheep();
|
||||
basSheep.setId(diagnosis.getSheepId());
|
||||
basSheep.setSheepfoldId(diagnosis.getSheepfoldId());
|
||||
sheepMapper.updateBasSheep(basSheep);
|
||||
}
|
||||
|
||||
// 更改治疗记录的状态
|
||||
Treatment treatment = new Treatment();
|
||||
treatment.setId(diagnosis.getTreatId());
|
||||
if (diagnosis.getResult().equals("0")){
|
||||
treatment.setStatus("-1");
|
||||
treatmentMapper.updateTreatment(treatment);
|
||||
}else if (diagnosis.getResult().equals("1")){
|
||||
treatment.setStatus("2");
|
||||
treatmentMapper.updateTreatment(treatment);
|
||||
}
|
||||
// 转入其他羊舍
|
||||
return diagnosisMapper.insertDiagnosis(diagnosis);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertDiagnosisList(Diagnosis diagnosis) {
|
||||
if (diagnosis.getTreatIds() != null && diagnosis.getTreatIds().length > 0){
|
||||
for (Integer treatId : diagnosis.getTreatIds()) {
|
||||
System.out.println(treatId);
|
||||
Treatment treatment = treatmentMapper.selectTreatmentById(Long.valueOf(treatId));
|
||||
System.out.println(treatment);
|
||||
// BasSheep basSheep = sheepMapper.selectBasSheepById(treatment.getSheepId());
|
||||
|
||||
Diagnosis diag = new Diagnosis();
|
||||
BeanUtils.copyProperties(treatment,diag);
|
||||
diag.setResult(diagnosis.getResult());
|
||||
diag.setParity(String.valueOf(treatment.getParity()));
|
||||
|
||||
|
||||
// treatment 和 diagnosis 是你的两个实体对象
|
||||
Date start = treatment.getDatetime(); // 已经是 Date
|
||||
Date end = diagnosis.getDatetime(); // 已经是 Date
|
||||
diag.setBegindate(start);
|
||||
diag.setEnddate(end);
|
||||
long oneDayMillis = 24 * 60 * 60 * 1000L;
|
||||
long days = (end.getTime() / oneDayMillis) - (start.getTime() / oneDayMillis);
|
||||
if (days<0){
|
||||
days=0;
|
||||
}
|
||||
|
||||
diag.setTreatDay(days);
|
||||
diag.setTreatId(treatment.getId());
|
||||
|
||||
|
||||
String username = SecurityUtils.getLoginUser().getUser().getNickName();
|
||||
diag.setCreateBy(username);
|
||||
diag.setCreateTime(DateUtils.getNowDate());
|
||||
diagnosisMapper.insertDiagnosis(diag);
|
||||
treatment.setDiagId(diag.getId());
|
||||
|
||||
// 更改治疗记录的状态
|
||||
if (diagnosis.getResult().equals("0")){
|
||||
treatment.setStatus("-1");
|
||||
treatmentMapper.updateTreatment(treatment);
|
||||
}else if (diagnosis.getResult().equals("1")){
|
||||
treatment.setStatus("2");
|
||||
treatmentMapper.updateTreatment(treatment);
|
||||
}
|
||||
if (diagnosis.getSheepfoldId() != null){
|
||||
BasSheep basSheep = new BasSheep();
|
||||
basSheep.setId(diagnosis.getSheepId());
|
||||
basSheep.setSheepfoldId(diagnosis.getSheepfoldId());
|
||||
sheepMapper.updateBasSheep(basSheep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改诊疗结果
|
||||
*
|
||||
@ -130,4 +209,5 @@ public class DiagnosisServiceImpl implements IDiagnosisService
|
||||
{
|
||||
return diagnosisMapper.deleteDiagnosisById(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -79,6 +79,7 @@ public class DisinfectServiceImpl implements IDisinfectService
|
||||
medicineUsage.setSwMedicineUsageDetailsList(disinfect.getUsageDetails());
|
||||
medicineUsage.setName("羊舍消毒");
|
||||
medicineUsage.setUseType("3");
|
||||
medicineUsage.setDatetime(disinfect.getDatetime());
|
||||
|
||||
|
||||
List<Disinfect> disinfects = new ArrayList<>();
|
||||
@ -90,6 +91,8 @@ public class DisinfectServiceImpl implements IDisinfectService
|
||||
Disinfect dis = new Disinfect();
|
||||
BeanUtils.copyProperties(disinfect,dis);
|
||||
dis.setSheepfoldId(sheepfold);
|
||||
|
||||
medicineUsage.setSheepfoldId(sheepfold);
|
||||
// 获取药品使用记录的id
|
||||
Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage);
|
||||
dis.setUsageId(usageId);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.zhyc.module.biosafety.service.impl;
|
||||
|
||||
import java.beans.Transient;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
@ -70,6 +71,7 @@ public class HealthServiceImpl implements IHealthService
|
||||
* @param health 保健
|
||||
* @return 结果
|
||||
*/
|
||||
@Transient
|
||||
@Override
|
||||
public int insertHealth(Health health)
|
||||
{
|
||||
@ -80,6 +82,7 @@ public class HealthServiceImpl implements IHealthService
|
||||
medicineUsage.setSwMedicineUsageDetailsList(health.getUsageDetails());
|
||||
medicineUsage.setName("羊只保健");
|
||||
medicineUsage.setUseType("2");
|
||||
medicineUsage.setDatetime(health.getDatetime());
|
||||
|
||||
List<Health> healths = new ArrayList<>();
|
||||
health.setCreateBy(username);
|
||||
@ -96,6 +99,7 @@ public class HealthServiceImpl implements IHealthService
|
||||
heal.setBreed(sheepFile.getBreed());
|
||||
heal.setParity(sheepFile.getParity());
|
||||
|
||||
medicineUsage.setSheepId(sheepId);
|
||||
// 获取药品使用记录的id
|
||||
Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage);
|
||||
|
||||
|
||||
@ -82,8 +82,10 @@ public class ImmunityServiceImpl implements IImmunityService
|
||||
medicineUsage.setSwMedicineUsageDetailsList(immunity.getUsageDetails());
|
||||
medicineUsage.setName("羊只免疫");
|
||||
medicineUsage.setUseType("0");
|
||||
medicineUsage.setDatetime(immunity.getDatetime());
|
||||
medicineUsage.setCreateBy(username);
|
||||
|
||||
|
||||
List<Immunity> immunities = new ArrayList<>();
|
||||
|
||||
immunity.setUpdateBy(username);
|
||||
@ -101,6 +103,8 @@ public class ImmunityServiceImpl implements IImmunityService
|
||||
imm.setGender(String.valueOf(sheepFile.getGender()));
|
||||
imm.setBreed(sheepFile.getBreed());
|
||||
imm.setParity(sheepFile.getParity());
|
||||
|
||||
medicineUsage.setSheepId(sheepId);
|
||||
// 获取药品使用记录的id
|
||||
Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage);
|
||||
|
||||
|
||||
@ -7,8 +7,10 @@ import com.zhyc.common.utils.SecurityUtils;
|
||||
import com.zhyc.common.utils.bean.BeanUtils;
|
||||
import com.zhyc.module.base.domain.SheepFile;
|
||||
import com.zhyc.module.base.mapper.SheepFileMapper;
|
||||
import com.zhyc.module.biosafety.domain.Diagnosis;
|
||||
import com.zhyc.module.biosafety.domain.SwMedicineUsage;
|
||||
import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails;
|
||||
import com.zhyc.module.biosafety.mapper.DiagnosisMapper;
|
||||
import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -34,6 +36,8 @@ public class TreatmentServiceImpl implements ITreatmentService
|
||||
private SwMedicineUsageMapper medicineUsageMapper;
|
||||
@Autowired
|
||||
private SheepFileMapper sheepFileMapper;
|
||||
@Autowired
|
||||
private DiagnosisMapper diagnosisMapper;
|
||||
|
||||
/**
|
||||
* 查询治疗记录
|
||||
@ -47,7 +51,9 @@ public class TreatmentServiceImpl implements ITreatmentService
|
||||
Treatment treatment = treatmentMapper.selectTreatmentById(id);
|
||||
// 获取药品使用记录
|
||||
SwMedicineUsage swMedicineUsage = medicineUsageService.selectSwMedicineUsageById(treatment.getUsageId());
|
||||
treatment.setUsageDetails(swMedicineUsage.getSwMedicineUsageDetailsList());
|
||||
if (swMedicineUsage!=null){
|
||||
treatment.setUsageDetails(swMedicineUsage.getSwMedicineUsageDetailsList());
|
||||
}
|
||||
return treatment;
|
||||
}
|
||||
|
||||
@ -79,10 +85,12 @@ public class TreatmentServiceImpl implements ITreatmentService
|
||||
medicineUsage.setSwMedicineUsageDetailsList(treatment.getUsageDetails());
|
||||
medicineUsage.setName("羊只治疗");
|
||||
medicineUsage.setUseType("4");
|
||||
medicineUsage.setDatetime(treatment.getDatetime());
|
||||
medicineUsage.setCreateBy(username);
|
||||
medicineUsage.setCreateTime(DateUtils.getNowDate());
|
||||
// 新增单挑数据
|
||||
if (treatment.getSheepId()!=null){
|
||||
medicineUsage.setSheepId(Math.toIntExact(treatment.getSheepId()));
|
||||
// 药品使用记录
|
||||
Integer id=medicineUsageService.insertSwMedicineUsage(medicineUsage);
|
||||
// 药品使用记录id
|
||||
@ -108,6 +116,8 @@ public class TreatmentServiceImpl implements ITreatmentService
|
||||
treat.setParity(sheepFile.getParity());
|
||||
treat.setLactDay(sheepFile.getLactationDay());
|
||||
treat.setGestDay(sheepFile.getGestationDay());
|
||||
|
||||
medicineUsage.setSheepId(Integer.valueOf(sheepId));
|
||||
// 获取药品使用记录的id
|
||||
Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage);
|
||||
System.out.println(medicineUsage);
|
||||
@ -172,4 +182,21 @@ public class TreatmentServiceImpl implements ITreatmentService
|
||||
{
|
||||
return treatmentMapper.deleteTreatmentById(id);
|
||||
}
|
||||
|
||||
public void updateTreatmentStatus(Long sheepId) {
|
||||
List<Treatment> treatments=treatmentMapper.selectTreatmentStatus(sheepId);
|
||||
Diagnosis diagnosis = new Diagnosis();
|
||||
for (Treatment treatment : treatments) {
|
||||
if (treatment.getDiagId()!=null){
|
||||
diagnosis.setId(treatment.getDiagId());
|
||||
diagnosis.setResult("-1");
|
||||
diagnosisMapper.updateDiagnosis(diagnosis);
|
||||
if (treatment.getDiagId()!=null){
|
||||
Treatment treat = new Treatment();
|
||||
treat.setId(treatment.getId());
|
||||
treatmentMapper.updateTreatment(treat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,134 @@
|
||||
package com.zhyc.module.produce.breed.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.zhyc.common.annotation.Log;
|
||||
import com.zhyc.common.core.controller.BaseController;
|
||||
import com.zhyc.common.core.domain.AjaxResult;
|
||||
import com.zhyc.common.enums.BusinessType;
|
||||
import com.zhyc.module.produce.breed.domain.ScMiscarriageRecord;
|
||||
import com.zhyc.module.produce.breed.service.IScMiscarriageRecordService;
|
||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||
import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 流产记录Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/miscarriage/miscarriage")
|
||||
public class ScMiscarriageRecordController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IScMiscarriageRecordService scMiscarriageRecordService;
|
||||
|
||||
/**
|
||||
* 查询流产记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('miscarriage:miscarriage:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ScMiscarriageRecord scMiscarriageRecord)
|
||||
{
|
||||
startPage();
|
||||
List<ScMiscarriageRecord> list = scMiscarriageRecordService.selectScMiscarriageRecordList(scMiscarriageRecord);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出流产记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('miscarriage:miscarriage:export')")
|
||||
@Log(title = "流产记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ScMiscarriageRecord scMiscarriageRecord)
|
||||
{
|
||||
List<ScMiscarriageRecord> list = scMiscarriageRecordService.selectScMiscarriageRecordList(scMiscarriageRecord);
|
||||
ExcelUtil<ScMiscarriageRecord> util = new ExcelUtil<ScMiscarriageRecord>(ScMiscarriageRecord.class);
|
||||
util.exportExcel(response, list, "流产记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流产记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('miscarriage:miscarriage:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(scMiscarriageRecordService.selectScMiscarriageRecordById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据耳号查询羊只信息
|
||||
*/
|
||||
@GetMapping(value = "/sheep/{manageTags}")
|
||||
public AjaxResult getSheepInfo(@PathVariable("manageTags") String manageTags)
|
||||
{
|
||||
Map<String, Object> sheepInfo = scMiscarriageRecordService.selectSheepByManageTags(manageTags);
|
||||
return success(sheepInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流产原因字典
|
||||
*/
|
||||
@GetMapping("/reasonOptions")
|
||||
public AjaxResult getReasonOptions()
|
||||
{
|
||||
// 返回流产原因选项
|
||||
return success(new String[]{
|
||||
"利斯特氏菌病",
|
||||
"子宫积脓",
|
||||
"布鲁氏菌",
|
||||
"弧菌性流产传染性流产",
|
||||
"未知",
|
||||
"滴虫病",
|
||||
"细螺旋体病",
|
||||
"霉菌性流产"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增流产记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('miscarriage:miscarriage:add')")
|
||||
@Log(title = "流产记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ScMiscarriageRecord scMiscarriageRecord)
|
||||
{
|
||||
return toAjax(scMiscarriageRecordService.insertScMiscarriageRecord(scMiscarriageRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改流产记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('miscarriage:miscarriage:edit')")
|
||||
@Log(title = "流产记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ScMiscarriageRecord scMiscarriageRecord)
|
||||
{
|
||||
return toAjax(scMiscarriageRecordService.updateScMiscarriageRecord(scMiscarriageRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除流产记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('miscarriage:miscarriage:remove')")
|
||||
@Log(title = "流产记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(scMiscarriageRecordService.deleteScMiscarriageRecordByIds(ids));
|
||||
}
|
||||
}
|
||||
@ -18,6 +18,7 @@ import com.zhyc.common.annotation.Log;
|
||||
import com.zhyc.common.core.controller.BaseController;
|
||||
import com.zhyc.common.core.domain.AjaxResult;
|
||||
import com.zhyc.common.enums.BusinessType;
|
||||
import com.zhyc.common.exception.ServiceException;
|
||||
import com.zhyc.module.produce.breed.domain.ScPregnancyRecord;
|
||||
import com.zhyc.module.produce.breed.service.IScPregnancyRecordService;
|
||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||
@ -43,9 +44,14 @@ public class ScPregnancyRecordController extends BaseController
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ScPregnancyRecord scPregnancyRecord)
|
||||
{
|
||||
startPage();
|
||||
List<ScPregnancyRecord> list = scPregnancyRecordService.selectScPregnancyRecordList(scPregnancyRecord);
|
||||
return getDataTable(list);
|
||||
try {
|
||||
startPage();
|
||||
List<ScPregnancyRecord> list = scPregnancyRecordService.selectScPregnancyRecordList(scPregnancyRecord);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error("查询孕检记录列表失败", e);
|
||||
return getDataTable(new java.util.ArrayList<>());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,9 +62,13 @@ public class ScPregnancyRecordController extends BaseController
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ScPregnancyRecord scPregnancyRecord)
|
||||
{
|
||||
List<ScPregnancyRecord> list = scPregnancyRecordService.selectScPregnancyRecordList(scPregnancyRecord);
|
||||
ExcelUtil<ScPregnancyRecord> util = new ExcelUtil<ScPregnancyRecord>(ScPregnancyRecord.class);
|
||||
util.exportExcel(response, list, "孕检记录数据");
|
||||
try {
|
||||
List<ScPregnancyRecord> list = scPregnancyRecordService.selectScPregnancyRecordList(scPregnancyRecord);
|
||||
ExcelUtil<ScPregnancyRecord> util = new ExcelUtil<ScPregnancyRecord>(ScPregnancyRecord.class);
|
||||
util.exportExcel(response, list, "孕检记录数据");
|
||||
} catch (Exception e) {
|
||||
logger.error("导出孕检记录失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -68,7 +78,21 @@ public class ScPregnancyRecordController extends BaseController
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(scPregnancyRecordService.selectScPregnancyRecordById(id));
|
||||
try {
|
||||
if (id == null) {
|
||||
return error("记录ID不能为空");
|
||||
}
|
||||
|
||||
ScPregnancyRecord result = scPregnancyRecordService.selectScPregnancyRecordById(id);
|
||||
if (result == null) {
|
||||
return error("记录不存在");
|
||||
}
|
||||
|
||||
return success(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取孕检记录详细信息失败,ID: " + id, e);
|
||||
return error("获取记录详细信息失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,7 +103,46 @@ public class ScPregnancyRecordController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ScPregnancyRecord scPregnancyRecord)
|
||||
{
|
||||
return toAjax(scPregnancyRecordService.insertScPregnancyRecord(scPregnancyRecord));
|
||||
try {
|
||||
// 基础参数校验
|
||||
if (scPregnancyRecord == null) {
|
||||
return error("请求参数不能为空");
|
||||
}
|
||||
|
||||
if (scPregnancyRecord.getManageTags() == null || scPregnancyRecord.getManageTags().trim().isEmpty()) {
|
||||
return error("管理耳号不能为空");
|
||||
}
|
||||
|
||||
if (scPregnancyRecord.getDatetime() == null) {
|
||||
return error("孕检日期不能为空");
|
||||
}
|
||||
|
||||
if (scPregnancyRecord.getResult() == null || scPregnancyRecord.getResult().trim().isEmpty()) {
|
||||
return error("孕检结果不能为空");
|
||||
}
|
||||
|
||||
if (scPregnancyRecord.getTechnician() == null || scPregnancyRecord.getTechnician().trim().isEmpty()) {
|
||||
return error("技术员不能为空");
|
||||
}
|
||||
|
||||
// 如果孕检方式为空,默认设置为B超
|
||||
if (scPregnancyRecord.getWay() == null || scPregnancyRecord.getWay().trim().isEmpty()) {
|
||||
scPregnancyRecord.setWay("B超");
|
||||
}
|
||||
|
||||
int result = scPregnancyRecordService.insertScPregnancyRecord(scPregnancyRecord);
|
||||
if (result > 0) {
|
||||
return success("新增成功");
|
||||
} else {
|
||||
return error("新增失败");
|
||||
}
|
||||
} catch (ServiceException e) {
|
||||
logger.warn("新增孕检记录业务异常: " + e.getMessage());
|
||||
return error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("新增孕检记录失败", e);
|
||||
return error("新增失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,7 +153,45 @@ public class ScPregnancyRecordController extends BaseController
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ScPregnancyRecord scPregnancyRecord)
|
||||
{
|
||||
return toAjax(scPregnancyRecordService.updateScPregnancyRecord(scPregnancyRecord));
|
||||
try {
|
||||
// 基础参数校验
|
||||
if (scPregnancyRecord == null) {
|
||||
return error("请求参数不能为空");
|
||||
}
|
||||
|
||||
if (scPregnancyRecord.getId() == null) {
|
||||
return error("记录ID不能为空");
|
||||
}
|
||||
|
||||
if (scPregnancyRecord.getManageTags() == null || scPregnancyRecord.getManageTags().trim().isEmpty()) {
|
||||
return error("管理耳号不能为空");
|
||||
}
|
||||
|
||||
if (scPregnancyRecord.getDatetime() == null) {
|
||||
return error("孕检日期不能为空");
|
||||
}
|
||||
|
||||
if (scPregnancyRecord.getResult() == null || scPregnancyRecord.getResult().trim().isEmpty()) {
|
||||
return error("孕检结果不能为空");
|
||||
}
|
||||
|
||||
if (scPregnancyRecord.getTechnician() == null || scPregnancyRecord.getTechnician().trim().isEmpty()) {
|
||||
return error("技术员不能为空");
|
||||
}
|
||||
|
||||
int result = scPregnancyRecordService.updateScPregnancyRecord(scPregnancyRecord);
|
||||
if (result > 0) {
|
||||
return success("修改成功");
|
||||
} else {
|
||||
return error("修改失败,记录可能不存在");
|
||||
}
|
||||
} catch (ServiceException e) {
|
||||
logger.warn("修改孕检记录业务异常: " + e.getMessage());
|
||||
return error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("修改孕检记录失败", e);
|
||||
return error("修改失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,7 +202,24 @@ public class ScPregnancyRecordController extends BaseController
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(scPregnancyRecordService.deleteScPregnancyRecordByIds(ids));
|
||||
try {
|
||||
if (ids == null || ids.length == 0) {
|
||||
return error("删除的记录ID不能为空");
|
||||
}
|
||||
|
||||
int result = scPregnancyRecordService.deleteScPregnancyRecordByIds(ids);
|
||||
if (result > 0) {
|
||||
return success("删除成功");
|
||||
} else {
|
||||
return error("删除失败,记录可能不存在");
|
||||
}
|
||||
} catch (ServiceException e) {
|
||||
logger.warn("删除孕检记录业务异常: " + e.getMessage());
|
||||
return error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("删除孕检记录失败", e);
|
||||
return error("删除失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,7 +228,47 @@ public class ScPregnancyRecordController extends BaseController
|
||||
@GetMapping("/getSheepByManageTags")
|
||||
public AjaxResult getSheepByManageTags(@RequestParam("manageTags") String manageTags)
|
||||
{
|
||||
Map<String, Object> sheepInfo = scPregnancyRecordService.getSheepByManageTags(manageTags);
|
||||
return success(sheepInfo);
|
||||
try {
|
||||
if (manageTags == null || manageTags.trim().isEmpty()) {
|
||||
return error("管理耳号不能为空");
|
||||
}
|
||||
|
||||
Map<String, Object> sheepInfo = scPregnancyRecordService.getSheepByManageTags(manageTags.trim());
|
||||
if (sheepInfo == null) {
|
||||
return error("未找到该耳号的羊只信息");
|
||||
}
|
||||
|
||||
return success(sheepInfo);
|
||||
} catch (ServiceException e) {
|
||||
return error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("查询羊只信息失败,管理耳号: " + manageTags, e);
|
||||
return error("查询羊只信息失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据耳号获取配种信息
|
||||
*/
|
||||
@GetMapping("/getBreedInfoByManageTags")
|
||||
public AjaxResult getBreedInfoByManageTags(@RequestParam("manageTags") String manageTags)
|
||||
{
|
||||
try {
|
||||
if (manageTags == null || manageTags.trim().isEmpty()) {
|
||||
return error("管理耳号不能为空");
|
||||
}
|
||||
|
||||
Map<String, Object> breedInfo = scPregnancyRecordService.getBreedInfoByManageTags(manageTags.trim());
|
||||
if (breedInfo == null) {
|
||||
return error("未找到该耳号的配种信息");
|
||||
}
|
||||
|
||||
return success(breedInfo);
|
||||
} catch (ServiceException e) {
|
||||
return error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("查询配种信息失败,管理耳号: " + manageTags, e);
|
||||
return error("查询配种信息失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17,6 +17,7 @@ import com.zhyc.common.annotation.Log;
|
||||
import com.zhyc.common.core.controller.BaseController;
|
||||
import com.zhyc.common.core.domain.AjaxResult;
|
||||
import com.zhyc.common.enums.BusinessType;
|
||||
import com.zhyc.common.exception.ServiceException;
|
||||
import com.zhyc.module.produce.breed.domain.ScSheepDeath;
|
||||
import com.zhyc.module.produce.breed.service.IScSheepDeathService;
|
||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||
@ -42,9 +43,14 @@ public class ScSheepDeathController extends BaseController
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ScSheepDeath scSheepDeath)
|
||||
{
|
||||
startPage();
|
||||
List<ScSheepDeath> list = scSheepDeathService.selectScSheepDeathList(scSheepDeath);
|
||||
return getDataTable(list);
|
||||
try {
|
||||
startPage();
|
||||
List<ScSheepDeath> list = scSheepDeathService.selectScSheepDeathList(scSheepDeath);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error("查询羊只死淘记录列表失败", e);
|
||||
return getDataTable(new java.util.ArrayList<>());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -54,11 +60,20 @@ public class ScSheepDeathController extends BaseController
|
||||
@GetMapping("/sheepInfo/{manageTags}")
|
||||
public AjaxResult getSheepInfo(@PathVariable("manageTags") String manageTags)
|
||||
{
|
||||
Map<String, Object> sheepInfo = scSheepDeathService.selectSheepFileByManageTags(manageTags);
|
||||
if (sheepInfo != null) {
|
||||
return success(sheepInfo);
|
||||
} else {
|
||||
return error("未找到该耳号对应的羊只信息");
|
||||
try {
|
||||
if (manageTags == null || manageTags.trim().isEmpty()) {
|
||||
return error("管理耳号不能为空");
|
||||
}
|
||||
|
||||
Map<String, Object> sheepInfo = scSheepDeathService.selectSheepFileByManageTags(manageTags.trim());
|
||||
if (sheepInfo != null) {
|
||||
return success(sheepInfo);
|
||||
} else {
|
||||
return error("未找到该耳号对应的羊只信息");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("查询羊只信息失败,管理耳号: " + manageTags, e);
|
||||
return error("查询羊只信息失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,9 +85,14 @@ public class ScSheepDeathController extends BaseController
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ScSheepDeath scSheepDeath)
|
||||
{
|
||||
List<ScSheepDeath> list = scSheepDeathService.selectScSheepDeathList(scSheepDeath);
|
||||
ExcelUtil<ScSheepDeath> util = new ExcelUtil<ScSheepDeath>(ScSheepDeath.class);
|
||||
util.exportExcel(response, list, "羊只死淘记录数据");
|
||||
try {
|
||||
List<ScSheepDeath> list = scSheepDeathService.selectScSheepDeathList(scSheepDeath);
|
||||
ExcelUtil<ScSheepDeath> util = new ExcelUtil<ScSheepDeath>(ScSheepDeath.class);
|
||||
util.exportExcel(response, list, "羊只死淘记录数据");
|
||||
} catch (Exception e) {
|
||||
logger.error("导出羊只死淘记录失败", e);
|
||||
// 可以在这里返回错误响应
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,7 +102,21 @@ public class ScSheepDeathController extends BaseController
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(scSheepDeathService.selectScSheepDeathById(id));
|
||||
try {
|
||||
if (id == null) {
|
||||
return error("记录ID不能为空");
|
||||
}
|
||||
|
||||
ScSheepDeath result = scSheepDeathService.selectScSheepDeathById(id);
|
||||
if (result == null) {
|
||||
return error("记录不存在");
|
||||
}
|
||||
|
||||
return success(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取羊只死淘记录详细信息失败,ID: " + id, e);
|
||||
return error("获取记录详细信息失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -93,7 +127,33 @@ public class ScSheepDeathController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ScSheepDeath scSheepDeath)
|
||||
{
|
||||
return toAjax(scSheepDeathService.insertScSheepDeath(scSheepDeath));
|
||||
try {
|
||||
// 基础参数校验
|
||||
if (scSheepDeath == null) {
|
||||
return error("请求参数不能为空");
|
||||
}
|
||||
|
||||
if (scSheepDeath.getManageTags() == null || scSheepDeath.getManageTags().trim().isEmpty()) {
|
||||
return error("管理耳号不能为空");
|
||||
}
|
||||
|
||||
if (scSheepDeath.getDeathDate() == null) {
|
||||
return error("死淘日期不能为空");
|
||||
}
|
||||
|
||||
int result = scSheepDeathService.insertScSheepDeath(scSheepDeath);
|
||||
if (result > 0) {
|
||||
return success("新增成功");
|
||||
} else {
|
||||
return error("新增失败");
|
||||
}
|
||||
} catch (ServiceException e) {
|
||||
logger.warn("新增羊只死淘记录业务异常: " + e.getMessage());
|
||||
return error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("新增羊只死淘记录失败", e);
|
||||
return error("新增失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,7 +164,37 @@ public class ScSheepDeathController extends BaseController
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ScSheepDeath scSheepDeath)
|
||||
{
|
||||
return toAjax(scSheepDeathService.updateScSheepDeath(scSheepDeath));
|
||||
try {
|
||||
// 基础参数校验
|
||||
if (scSheepDeath == null) {
|
||||
return error("请求参数不能为空");
|
||||
}
|
||||
|
||||
if (scSheepDeath.getId() == null) {
|
||||
return error("记录ID不能为空");
|
||||
}
|
||||
|
||||
if (scSheepDeath.getManageTags() == null || scSheepDeath.getManageTags().trim().isEmpty()) {
|
||||
return error("管理耳号不能为空");
|
||||
}
|
||||
|
||||
if (scSheepDeath.getDeathDate() == null) {
|
||||
return error("死淘日期不能为空");
|
||||
}
|
||||
|
||||
int result = scSheepDeathService.updateScSheepDeath(scSheepDeath);
|
||||
if (result > 0) {
|
||||
return success("修改成功");
|
||||
} else {
|
||||
return error("修改失败,记录可能不存在");
|
||||
}
|
||||
} catch (ServiceException e) {
|
||||
logger.warn("修改羊只死淘记录业务异常: " + e.getMessage());
|
||||
return error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("修改羊只死淘记录失败", e);
|
||||
return error("修改失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,6 +205,23 @@ public class ScSheepDeathController extends BaseController
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(scSheepDeathService.deleteScSheepDeathByIds(ids));
|
||||
try {
|
||||
if (ids == null || ids.length == 0) {
|
||||
return error("删除的记录ID不能为空");
|
||||
}
|
||||
|
||||
int result = scSheepDeathService.deleteScSheepDeathByIds(ids);
|
||||
if (result > 0) {
|
||||
return success("删除成功");
|
||||
} else {
|
||||
return error("删除失败,记录可能不存在");
|
||||
}
|
||||
} catch (ServiceException e) {
|
||||
logger.warn("删除羊只死淘记录业务异常: " + e.getMessage());
|
||||
return error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("删除羊只死淘记录失败", e);
|
||||
return error("删除失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,308 @@
|
||||
package com.zhyc.module.produce.breed.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.zhyc.common.annotation.Excel;
|
||||
import com.zhyc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 流产记录对象 sc_miscarriage_record
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-23
|
||||
*/
|
||||
public class ScMiscarriageRecord extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 羊只id */
|
||||
private String sheepId;
|
||||
|
||||
/** 事件日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date datetime;
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
||||
/** 技术员 */
|
||||
@Excel(name = "技术员")
|
||||
private String technician;
|
||||
|
||||
/** 流产原因 */
|
||||
@Excel(name = "流产原因")
|
||||
private String reason;
|
||||
|
||||
/** 是否见胎 (1-是, 2-复检无胎, 3-返情) */
|
||||
@Excel(name = "是否见胎", readConverterExp = "1=是,2=复检无胎,3=返情")
|
||||
private Long exposeType;
|
||||
|
||||
/** 是否列胎次 (1-是, 0-否) */
|
||||
@Excel(name = "是否列胎次", readConverterExp = "1=是,0=否")
|
||||
private Long status;
|
||||
|
||||
/** 流产羔羊数 */
|
||||
@Excel(name = "流产羔羊数")
|
||||
private Long miscaLamb;
|
||||
|
||||
// 以下是关联查询字段,不存储到数据库
|
||||
/** 管理耳号 */
|
||||
@Excel(name = "耳号")
|
||||
private String bsManageTags;
|
||||
|
||||
/** 品种 */
|
||||
@Excel(name = "品种")
|
||||
private String variety;
|
||||
|
||||
/** 事件类型 */
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType = "流产";
|
||||
|
||||
/** 配种类型ID */
|
||||
private Integer matingTypeId;
|
||||
|
||||
/** 配种类型 */
|
||||
@Excel(name = "配种类型")
|
||||
private String matingTypeName;
|
||||
|
||||
/** 配种日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "配种日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date matingDate;
|
||||
|
||||
/** 胎次 */
|
||||
@Excel(name = "胎次")
|
||||
private Integer parity;
|
||||
|
||||
/** 配种公羊品种 */
|
||||
@Excel(name = "配种公羊品种")
|
||||
private String ramVariety;
|
||||
|
||||
/** 月龄 */
|
||||
@Excel(name = "月龄")
|
||||
private Long monthAge;
|
||||
|
||||
/** 流产时怀孕天数 */
|
||||
@Excel(name = "流产时怀孕天数")
|
||||
private Integer pregnantDays;
|
||||
|
||||
/** 当前羊舍 */
|
||||
@Excel(name = "当前羊舍")
|
||||
private String sheepfoldName;
|
||||
|
||||
/** 所在牧场 */
|
||||
@Excel(name = "所在牧场")
|
||||
private String drRanch;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setSheepId(String sheepId)
|
||||
{
|
||||
this.sheepId = sheepId;
|
||||
}
|
||||
|
||||
public String getSheepId()
|
||||
{
|
||||
return sheepId;
|
||||
}
|
||||
|
||||
public void setDatetime(Date datetime)
|
||||
{
|
||||
this.datetime = datetime;
|
||||
}
|
||||
|
||||
public Date getDatetime()
|
||||
{
|
||||
return datetime;
|
||||
}
|
||||
|
||||
public void setComment(String comment)
|
||||
{
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public String getComment()
|
||||
{
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setTechnician(String technician)
|
||||
{
|
||||
this.technician = technician;
|
||||
}
|
||||
|
||||
public String getTechnician()
|
||||
{
|
||||
return technician;
|
||||
}
|
||||
|
||||
public void setReason(String reason)
|
||||
{
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public String getReason()
|
||||
{
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setExposeType(Long exposeType)
|
||||
{
|
||||
this.exposeType = exposeType;
|
||||
}
|
||||
|
||||
public Long getExposeType()
|
||||
{
|
||||
return exposeType;
|
||||
}
|
||||
|
||||
public void setStatus(Long status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setMiscaLamb(Long miscaLamb)
|
||||
{
|
||||
this.miscaLamb = miscaLamb;
|
||||
}
|
||||
|
||||
public Long getMiscaLamb()
|
||||
{
|
||||
return miscaLamb;
|
||||
}
|
||||
|
||||
public String getBsManageTags() {
|
||||
return bsManageTags;
|
||||
}
|
||||
|
||||
public void setBsManageTags(String bsManageTags) {
|
||||
this.bsManageTags = bsManageTags;
|
||||
}
|
||||
|
||||
public String getVariety() {
|
||||
return variety;
|
||||
}
|
||||
|
||||
public void setVariety(String variety) {
|
||||
this.variety = variety;
|
||||
}
|
||||
|
||||
public String getEventType() {
|
||||
return eventType;
|
||||
}
|
||||
|
||||
public void setEventType(String eventType) {
|
||||
this.eventType = eventType;
|
||||
}
|
||||
|
||||
public Integer getMatingTypeId() {
|
||||
return matingTypeId;
|
||||
}
|
||||
|
||||
public void setMatingTypeId(Integer matingTypeId) {
|
||||
this.matingTypeId = matingTypeId;
|
||||
}
|
||||
|
||||
public String getMatingTypeName() {
|
||||
return matingTypeName;
|
||||
}
|
||||
|
||||
public void setMatingTypeName(String matingTypeName) {
|
||||
this.matingTypeName = matingTypeName;
|
||||
}
|
||||
|
||||
public Date getMatingDate() {
|
||||
return matingDate;
|
||||
}
|
||||
|
||||
public void setMatingDate(Date matingDate) {
|
||||
this.matingDate = matingDate;
|
||||
}
|
||||
|
||||
public Integer getParity() {
|
||||
return parity;
|
||||
}
|
||||
|
||||
public void setParity(Integer parity) {
|
||||
this.parity = parity;
|
||||
}
|
||||
|
||||
public String getRamVariety() {
|
||||
return ramVariety;
|
||||
}
|
||||
|
||||
public void setRamVariety(String ramVariety) {
|
||||
this.ramVariety = ramVariety;
|
||||
}
|
||||
|
||||
public Long getMonthAge() {
|
||||
return monthAge;
|
||||
}
|
||||
|
||||
public void setMonthAge(Long monthAge) {
|
||||
this.monthAge = monthAge;
|
||||
}
|
||||
|
||||
public Integer getPregnantDays() {
|
||||
return pregnantDays;
|
||||
}
|
||||
|
||||
public void setPregnantDays(Integer pregnantDays) {
|
||||
this.pregnantDays = pregnantDays;
|
||||
}
|
||||
|
||||
public String getSheepfoldName() {
|
||||
return sheepfoldName;
|
||||
}
|
||||
|
||||
public void setSheepfoldName(String sheepfoldName) {
|
||||
this.sheepfoldName = sheepfoldName;
|
||||
}
|
||||
|
||||
public String getDrRanch() {
|
||||
return drRanch;
|
||||
}
|
||||
|
||||
public void setDrRanch(String drRanch) {
|
||||
this.drRanch = drRanch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("sheepId", getSheepId())
|
||||
.append("datetime", getDatetime())
|
||||
.append("comment", getComment())
|
||||
.append("technician", getTechnician())
|
||||
.append("reason", getReason())
|
||||
.append("exposeType", getExposeType())
|
||||
.append("status", getStatus())
|
||||
.append("miscaLamb", getMiscaLamb())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("bsManageTags", getBsManageTags())
|
||||
.append("variety", getVariety())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -116,4 +116,7 @@ public class ScPregnancyRecord extends BaseEntity
|
||||
@Excel(name = "所在牧场")
|
||||
private String ranchName;
|
||||
|
||||
/** 配后天数 */
|
||||
@Excel(name = "配后天数")
|
||||
private Integer daysAfterMating;
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.zhyc.module.produce.breed.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.zhyc.module.produce.breed.domain.ScMiscarriageRecord;
|
||||
|
||||
/**
|
||||
* 流产记录Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-23
|
||||
*/
|
||||
public interface ScMiscarriageRecordMapper
|
||||
{
|
||||
/**
|
||||
* 查询流产记录
|
||||
*
|
||||
* @param id 流产记录主键
|
||||
* @return 流产记录
|
||||
*/
|
||||
public ScMiscarriageRecord selectScMiscarriageRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询流产记录列表
|
||||
*
|
||||
* @param scMiscarriageRecord 流产记录
|
||||
* @return 流产记录集合
|
||||
*/
|
||||
public List<ScMiscarriageRecord> selectScMiscarriageRecordList(ScMiscarriageRecord scMiscarriageRecord);
|
||||
|
||||
/**
|
||||
* 新增流产记录
|
||||
*
|
||||
* @param scMiscarriageRecord 流产记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScMiscarriageRecord(ScMiscarriageRecord scMiscarriageRecord);
|
||||
|
||||
/**
|
||||
* 修改流产记录
|
||||
*
|
||||
* @param scMiscarriageRecord 流产记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScMiscarriageRecord(ScMiscarriageRecord scMiscarriageRecord);
|
||||
|
||||
/**
|
||||
* 删除流产记录
|
||||
*
|
||||
* @param id 流产记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScMiscarriageRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除流产记录
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScMiscarriageRecordByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据耳号查询羊只信息
|
||||
*
|
||||
* @param manageTags 管理耳号
|
||||
* @return 羊只信息
|
||||
*/
|
||||
public Map<String, Object> selectSheepByManageTags(String manageTags);
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.zhyc.module.produce.breed.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.zhyc.module.produce.breed.domain.ScPregnancyRecord;
|
||||
|
||||
/**
|
||||
@ -68,6 +69,14 @@ public interface ScPregnancyRecordMapper
|
||||
*/
|
||||
public Map<String, Object> selectSheepByManageTags(String manageTags);
|
||||
|
||||
/**
|
||||
* 根据耳号获取配种信息
|
||||
*
|
||||
* @param manageTags 耳号
|
||||
* @return 配种信息
|
||||
*/
|
||||
public Map<String, Object> selectBreedInfoByManageTags(String manageTags);
|
||||
|
||||
/**
|
||||
* 更新羊只基础表中的孕检相关字段
|
||||
*
|
||||
|
||||
@ -2,6 +2,7 @@ package com.zhyc.module.produce.breed.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.zhyc.module.produce.breed.domain.ScSheepDeath;
|
||||
|
||||
/**
|
||||
@ -67,4 +68,22 @@ public interface ScSheepDeathMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScSheepDeathByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 更新羊只繁育状态
|
||||
*
|
||||
* @param sheepId 羊只ID
|
||||
* @param status 繁育状态
|
||||
* @return 更新结果
|
||||
*/
|
||||
public int updateSheepFileStatus(@Param("sheepId") Long sheepId, @Param("status") String status);
|
||||
|
||||
/**
|
||||
* 新增:更新羊只在群状态
|
||||
*
|
||||
* @param sheepId 羊只ID
|
||||
* @param status 在群状态(1-在群,2-不在群)
|
||||
* @return 更新结果
|
||||
*/
|
||||
public int updateSheepStatus(@Param("sheepId") Long sheepId, @Param("status") String status);
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.zhyc.module.produce.breed.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.zhyc.module.produce.breed.domain.ScMiscarriageRecord;
|
||||
|
||||
/**
|
||||
* 流产记录Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-23
|
||||
*/
|
||||
public interface IScMiscarriageRecordService
|
||||
{
|
||||
/**
|
||||
* 查询流产记录
|
||||
*
|
||||
* @param id 流产记录主键
|
||||
* @return 流产记录
|
||||
*/
|
||||
public ScMiscarriageRecord selectScMiscarriageRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询流产记录列表
|
||||
*
|
||||
* @param scMiscarriageRecord 流产记录
|
||||
* @return 流产记录集合
|
||||
*/
|
||||
public List<ScMiscarriageRecord> selectScMiscarriageRecordList(ScMiscarriageRecord scMiscarriageRecord);
|
||||
|
||||
/**
|
||||
* 新增流产记录
|
||||
*
|
||||
* @param scMiscarriageRecord 流产记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertScMiscarriageRecord(ScMiscarriageRecord scMiscarriageRecord);
|
||||
|
||||
/**
|
||||
* 修改流产记录
|
||||
*
|
||||
* @param scMiscarriageRecord 流产记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateScMiscarriageRecord(ScMiscarriageRecord scMiscarriageRecord);
|
||||
|
||||
/**
|
||||
* 批量删除流产记录
|
||||
*
|
||||
* @param ids 需要删除的流产记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScMiscarriageRecordByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除流产记录信息
|
||||
*
|
||||
* @param id 流产记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteScMiscarriageRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 根据耳号查询羊只信息
|
||||
*
|
||||
* @param manageTags 管理耳号
|
||||
* @return 羊只信息
|
||||
*/
|
||||
public Map<String, Object> selectSheepByManageTags(String manageTags);
|
||||
}
|
||||
@ -67,4 +67,12 @@ public interface IScPregnancyRecordService
|
||||
* @return 羊只信息
|
||||
*/
|
||||
public Map<String, Object> getSheepByManageTags(String manageTags);
|
||||
|
||||
/**
|
||||
* 根据耳号获取配种信息
|
||||
*
|
||||
* @param manageTags 耳号
|
||||
* @return 配种信息
|
||||
*/
|
||||
public Map<String, Object> getBreedInfoByManageTags(String manageTags);
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
package com.zhyc.module.produce.breed.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.produce.breed.mapper.ScMiscarriageRecordMapper;
|
||||
import com.zhyc.module.produce.breed.domain.ScMiscarriageRecord;
|
||||
import com.zhyc.module.produce.breed.service.IScMiscarriageRecordService;
|
||||
|
||||
/**
|
||||
* 流产记录Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-23
|
||||
*/
|
||||
@Service
|
||||
public class ScMiscarriageRecordServiceImpl implements IScMiscarriageRecordService
|
||||
{
|
||||
@Autowired
|
||||
private ScMiscarriageRecordMapper scMiscarriageRecordMapper;
|
||||
|
||||
/**
|
||||
* 查询流产记录
|
||||
*
|
||||
* @param id 流产记录主键
|
||||
* @return 流产记录
|
||||
*/
|
||||
@Override
|
||||
public ScMiscarriageRecord selectScMiscarriageRecordById(Long id)
|
||||
{
|
||||
return scMiscarriageRecordMapper.selectScMiscarriageRecordById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询流产记录列表
|
||||
*
|
||||
* @param scMiscarriageRecord 流产记录
|
||||
* @return 流产记录
|
||||
*/
|
||||
@Override
|
||||
public List<ScMiscarriageRecord> selectScMiscarriageRecordList(ScMiscarriageRecord scMiscarriageRecord)
|
||||
{
|
||||
return scMiscarriageRecordMapper.selectScMiscarriageRecordList(scMiscarriageRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增流产记录
|
||||
*
|
||||
* @param scMiscarriageRecord 流产记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertScMiscarriageRecord(ScMiscarriageRecord scMiscarriageRecord)
|
||||
{
|
||||
scMiscarriageRecord.setCreateTime(DateUtils.getNowDate());
|
||||
return scMiscarriageRecordMapper.insertScMiscarriageRecord(scMiscarriageRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改流产记录
|
||||
*
|
||||
* @param scMiscarriageRecord 流产记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateScMiscarriageRecord(ScMiscarriageRecord scMiscarriageRecord)
|
||||
{
|
||||
return scMiscarriageRecordMapper.updateScMiscarriageRecord(scMiscarriageRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除流产记录
|
||||
*
|
||||
* @param ids 需要删除的流产记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScMiscarriageRecordByIds(Long[] ids)
|
||||
{
|
||||
return scMiscarriageRecordMapper.deleteScMiscarriageRecordByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除流产记录信息
|
||||
*
|
||||
* @param id 流产记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteScMiscarriageRecordById(Long id)
|
||||
{
|
||||
return scMiscarriageRecordMapper.deleteScMiscarriageRecordById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据耳号查询羊只信息
|
||||
*
|
||||
* @param manageTags 管理耳号
|
||||
* @return 羊只信息
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> selectSheepByManageTags(String manageTags)
|
||||
{
|
||||
return scMiscarriageRecordMapper.selectSheepByManageTags(manageTags);
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ import java.util.Map;
|
||||
import java.util.Calendar;
|
||||
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.common.exception.ServiceException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -56,24 +57,50 @@ public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertScPregnancyRecord(ScPregnancyRecord scPregnancyRecord)
|
||||
{
|
||||
// 参数校验
|
||||
if (scPregnancyRecord.getManageTags() == null || scPregnancyRecord.getManageTags().trim().isEmpty()) {
|
||||
throw new ServiceException("管理耳号不能为空");
|
||||
}
|
||||
|
||||
if (scPregnancyRecord.getDatetime() == null) {
|
||||
throw new ServiceException("孕检日期不能为空");
|
||||
}
|
||||
|
||||
if (scPregnancyRecord.getResult() == null || scPregnancyRecord.getResult().trim().isEmpty()) {
|
||||
throw new ServiceException("孕检结果不能为空");
|
||||
}
|
||||
|
||||
// 根据耳号获取羊只信息并验证
|
||||
Map<String, Object> sheepInfo = scPregnancyRecordMapper.selectSheepByManageTags(scPregnancyRecord.getManageTags().trim());
|
||||
if (sheepInfo == null) {
|
||||
throw new ServiceException("管理耳号[" + scPregnancyRecord.getManageTags() + "]对应的羊只不存在");
|
||||
}
|
||||
|
||||
Long sheepId = sheepInfo.get("id") != null ? Long.valueOf(sheepInfo.get("id").toString()) : null;
|
||||
if (sheepId == null) {
|
||||
throw new ServiceException("无法获取羊只ID,请检查数据完整性");
|
||||
}
|
||||
scPregnancyRecord.setSheepId(sheepId);
|
||||
|
||||
// 验证孕检结果和胎儿数量的一致性
|
||||
validatePregnancyResult(scPregnancyRecord);
|
||||
|
||||
// 设置默认值
|
||||
scPregnancyRecord.setCreateTime(DateUtils.getNowDate());
|
||||
scPregnancyRecord.setIsDelete(0);
|
||||
|
||||
// 根据耳号获取羊只ID
|
||||
if (scPregnancyRecord.getManageTags() != null) {
|
||||
Map<String, Object> sheepInfo = scPregnancyRecordMapper.selectSheepByManageTags(scPregnancyRecord.getManageTags());
|
||||
if (sheepInfo != null && sheepInfo.get("id") != null) {
|
||||
scPregnancyRecord.setSheepId(Long.valueOf(sheepInfo.get("id").toString()));
|
||||
}
|
||||
// 如果孕检方式为空,默认设置为B超
|
||||
if (scPregnancyRecord.getWay() == null || scPregnancyRecord.getWay().trim().isEmpty()) {
|
||||
scPregnancyRecord.setWay("B超");
|
||||
}
|
||||
|
||||
int result = scPregnancyRecordMapper.insertScPregnancyRecord(scPregnancyRecord);
|
||||
|
||||
// 如果孕检结果为怀孕,更新羊只基础表相关字段
|
||||
if ("怀孕".equals(scPregnancyRecord.getResult()) && scPregnancyRecord.getSheepId() != null) {
|
||||
if ("怀孕".equals(scPregnancyRecord.getResult()) && result > 0) {
|
||||
updateSheepPregnancyStatus(scPregnancyRecord);
|
||||
}
|
||||
|
||||
@ -87,29 +114,67 @@ public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateScPregnancyRecord(ScPregnancyRecord scPregnancyRecord)
|
||||
{
|
||||
scPregnancyRecord.setUpdateTime(DateUtils.getNowDate());
|
||||
|
||||
// 根据耳号获取羊只ID
|
||||
if (scPregnancyRecord.getManageTags() != null) {
|
||||
Map<String, Object> sheepInfo = scPregnancyRecordMapper.selectSheepByManageTags(scPregnancyRecord.getManageTags());
|
||||
if (sheepInfo != null && sheepInfo.get("id") != null) {
|
||||
scPregnancyRecord.setSheepId(Long.valueOf(sheepInfo.get("id").toString()));
|
||||
}
|
||||
// 参数校验
|
||||
if (scPregnancyRecord.getId() == null) {
|
||||
throw new ServiceException("记录ID不能为空");
|
||||
}
|
||||
|
||||
if (scPregnancyRecord.getManageTags() == null || scPregnancyRecord.getManageTags().trim().isEmpty()) {
|
||||
throw new ServiceException("管理耳号不能为空");
|
||||
}
|
||||
|
||||
// 根据耳号获取羊只信息并验证
|
||||
Map<String, Object> sheepInfo = scPregnancyRecordMapper.selectSheepByManageTags(scPregnancyRecord.getManageTags().trim());
|
||||
if (sheepInfo == null) {
|
||||
throw new ServiceException("管理耳号[" + scPregnancyRecord.getManageTags() + "]对应的羊只不存在");
|
||||
}
|
||||
|
||||
Long sheepId = sheepInfo.get("id") != null ? Long.valueOf(sheepInfo.get("id").toString()) : null;
|
||||
if (sheepId == null) {
|
||||
throw new ServiceException("无法获取羊只ID,请检查数据完整性");
|
||||
}
|
||||
scPregnancyRecord.setSheepId(sheepId);
|
||||
|
||||
// 验证孕检结果和胎儿数量的一致性
|
||||
validatePregnancyResult(scPregnancyRecord);
|
||||
|
||||
scPregnancyRecord.setUpdateTime(DateUtils.getNowDate());
|
||||
|
||||
int result = scPregnancyRecordMapper.updateScPregnancyRecord(scPregnancyRecord);
|
||||
|
||||
// 如果孕检结果为怀孕,更新羊只基础表相关字段
|
||||
if ("怀孕".equals(scPregnancyRecord.getResult()) && scPregnancyRecord.getSheepId() != null) {
|
||||
if ("怀孕".equals(scPregnancyRecord.getResult()) && result > 0) {
|
||||
updateSheepPregnancyStatus(scPregnancyRecord);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证孕检结果和胎儿数量的一致性
|
||||
*
|
||||
* @param scPregnancyRecord 孕检记录
|
||||
*/
|
||||
private void validatePregnancyResult(ScPregnancyRecord scPregnancyRecord) {
|
||||
String result = scPregnancyRecord.getResult();
|
||||
Integer fetusCount = scPregnancyRecord.getFetusCount();
|
||||
|
||||
if ("怀孕".equals(result)) {
|
||||
if (fetusCount == null || fetusCount <= 0) {
|
||||
throw new ServiceException("孕检结果为怀孕时,胎儿数量必须填写且大于0");
|
||||
}
|
||||
if (fetusCount > 10) {
|
||||
throw new ServiceException("胎儿数量不能超过10个");
|
||||
}
|
||||
} else if ("未孕".equals(result) || "流产".equals(result)) {
|
||||
// 未孕或流产时,胎儿数量应为0或null
|
||||
scPregnancyRecord.setFetusCount(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除孕检记录
|
||||
*
|
||||
@ -117,8 +182,12 @@ public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteScPregnancyRecordByIds(Long[] ids)
|
||||
{
|
||||
if (ids == null || ids.length == 0) {
|
||||
throw new ServiceException("删除的记录ID不能为空");
|
||||
}
|
||||
return scPregnancyRecordMapper.deleteScPregnancyRecordByIds(ids);
|
||||
}
|
||||
|
||||
@ -129,8 +198,12 @@ public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteScPregnancyRecordById(Long id)
|
||||
{
|
||||
if (id == null) {
|
||||
throw new ServiceException("删除的记录ID不能为空");
|
||||
}
|
||||
return scPregnancyRecordMapper.deleteScPregnancyRecordById(id);
|
||||
}
|
||||
|
||||
@ -143,7 +216,25 @@ public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService
|
||||
@Override
|
||||
public Map<String, Object> getSheepByManageTags(String manageTags)
|
||||
{
|
||||
return scPregnancyRecordMapper.selectSheepByManageTags(manageTags);
|
||||
if (manageTags == null || manageTags.trim().isEmpty()) {
|
||||
throw new ServiceException("管理耳号不能为空");
|
||||
}
|
||||
return scPregnancyRecordMapper.selectSheepByManageTags(manageTags.trim());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据耳号获取配种信息
|
||||
*
|
||||
* @param manageTags 耳号
|
||||
* @return 配种信息
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getBreedInfoByManageTags(String manageTags)
|
||||
{
|
||||
if (manageTags == null || manageTags.trim().isEmpty()) {
|
||||
throw new ServiceException("管理耳号不能为空");
|
||||
}
|
||||
return scPregnancyRecordMapper.selectBreedInfoByManageTags(manageTags.trim());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -152,27 +243,32 @@ public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService
|
||||
* @param scPregnancyRecord 孕检记录
|
||||
*/
|
||||
private void updateSheepPregnancyStatus(ScPregnancyRecord scPregnancyRecord) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("sheepId", scPregnancyRecord.getSheepId());
|
||||
params.put("pregDate", scPregnancyRecord.getDatetime());
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("sheepId", scPregnancyRecord.getSheepId());
|
||||
params.put("pregDate", scPregnancyRecord.getDatetime());
|
||||
|
||||
// 设置繁育状态为怀孕状态(假设怀孕状态ID为2)
|
||||
params.put("breedStatusId", 2);
|
||||
// 设置繁育状态为怀孕状态(假设怀孕状态ID为2)
|
||||
params.put("breedStatusId", 2);
|
||||
|
||||
// 计算预产日期(羊的妊娠期大约150天)
|
||||
if (scPregnancyRecord.getDatetime() != null) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(scPregnancyRecord.getDatetime());
|
||||
cal.add(Calendar.DAY_OF_YEAR, 150);
|
||||
params.put("expectedDate", cal.getTime());
|
||||
// 计算预产日期(羊的妊娠期大约150天)
|
||||
if (scPregnancyRecord.getDatetime() != null) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(scPregnancyRecord.getDatetime());
|
||||
cal.add(Calendar.DAY_OF_YEAR, 150);
|
||||
params.put("expectedDate", cal.getTime());
|
||||
}
|
||||
|
||||
// 计算怀孕天数
|
||||
if (scPregnancyRecord.getDatetime() != null) {
|
||||
long days = (System.currentTimeMillis() - scPregnancyRecord.getDatetime().getTime()) / (1000 * 60 * 60 * 24);
|
||||
params.put("gestationDay", (int) days);
|
||||
}
|
||||
|
||||
scPregnancyRecordMapper.updateSheepPregnancyInfo(params);
|
||||
} catch (Exception e) {
|
||||
// 记录日志但不影响主流程
|
||||
System.err.println("更新羊只怀孕状态失败: " + e.getMessage());
|
||||
}
|
||||
|
||||
// 计算怀孕天数
|
||||
if (scPregnancyRecord.getDatetime() != null) {
|
||||
long days = (System.currentTimeMillis() - scPregnancyRecord.getDatetime().getTime()) / (1000 * 60 * 60 * 24);
|
||||
params.put("gestationDay", (int) days);
|
||||
}
|
||||
|
||||
scPregnancyRecordMapper.updateSheepPregnancyInfo(params);
|
||||
}
|
||||
}
|
||||
@ -3,11 +3,17 @@ package com.zhyc.module.produce.breed.service.impl;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.zhyc.common.utils.DateUtils;
|
||||
import com.zhyc.module.biosafety.domain.Diagnosis;
|
||||
import com.zhyc.module.biosafety.domain.Treatment;
|
||||
import com.zhyc.module.biosafety.mapper.DiagnosisMapper;
|
||||
import com.zhyc.module.biosafety.mapper.TreatmentMapper;
|
||||
import com.zhyc.module.biosafety.service.impl.TreatmentServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.produce.breed.mapper.ScSheepDeathMapper;
|
||||
import com.zhyc.module.produce.breed.domain.ScSheepDeath;
|
||||
import com.zhyc.module.produce.breed.service.IScSheepDeathService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 羊只死淘记录Service业务层处理
|
||||
@ -20,6 +26,13 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
||||
{
|
||||
@Autowired
|
||||
private ScSheepDeathMapper scSheepDeathMapper;
|
||||
@Autowired
|
||||
private DiagnosisMapper diagnosisMapper;
|
||||
@Autowired
|
||||
private TreatmentServiceImpl treatmentService;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询羊只死淘记录
|
||||
@ -100,6 +113,7 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertScSheepDeath(ScSheepDeath scSheepDeath)
|
||||
{
|
||||
// 设置事件类型默认为"死亡"
|
||||
@ -111,11 +125,20 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
||||
if (scSheepDeath.getManageTags() != null && !scSheepDeath.getManageTags().isEmpty()) {
|
||||
Map<String, Object> sheepInfo = selectSheepFileByManageTags(scSheepDeath.getManageTags());
|
||||
if (sheepInfo != null) {
|
||||
scSheepDeath.setSheepId(sheepInfo.get("sheepId") != null ? Long.valueOf(sheepInfo.get("sheepId").toString()) : null);
|
||||
Long sheepId = sheepInfo.get("sheepId") != null ? Long.valueOf(sheepInfo.get("sheepId").toString()) : null;
|
||||
scSheepDeath.setSheepId(sheepId);
|
||||
|
||||
// 插入死淘记录后,同时更新羊只在群状态为"不在群"(字典值为2)
|
||||
if (sheepId != null) {
|
||||
scSheepDeathMapper.updateSheepStatus(sheepId, "2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
treatmentService.updateTreatmentStatus(scSheepDeath.getSheepId());
|
||||
|
||||
scSheepDeath.setCreateTime(DateUtils.getNowDate());
|
||||
|
||||
return scSheepDeathMapper.insertScSheepDeath(scSheepDeath);
|
||||
}
|
||||
|
||||
@ -132,10 +155,15 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
||||
if (scSheepDeath.getManageTags() != null && !scSheepDeath.getManageTags().isEmpty()) {
|
||||
Map<String, Object> sheepInfo = selectSheepFileByManageTags(scSheepDeath.getManageTags());
|
||||
if (sheepInfo != null) {
|
||||
scSheepDeath.setSheepId(sheepInfo.get("sheepId") != null ? Long.valueOf(sheepInfo.get("sheepId").toString()) : null);
|
||||
Long sheepId = sheepInfo.get("sheepId") != null ? Long.valueOf(sheepInfo.get("sheepId").toString()) : null;
|
||||
scSheepDeath.setSheepId(sheepId);
|
||||
|
||||
// 修改死淘记录时,同时更新羊只在群状态为"不在群"(字典值为2)
|
||||
if (sheepId != null) {
|
||||
scSheepDeathMapper.updateSheepStatus(sheepId, "2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scSheepDeath.setUpdateTime(DateUtils.getNowDate());
|
||||
return scSheepDeathMapper.updateScSheepDeath(scSheepDeath);
|
||||
}
|
||||
@ -149,6 +177,15 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
||||
@Override
|
||||
public int deleteScSheepDeathByIds(Long[] ids)
|
||||
{
|
||||
// 可选:删除死淘记录前,将对应羊只在群状态改回"在群"
|
||||
for (Long id : ids) {
|
||||
ScSheepDeath scSheepDeath = scSheepDeathMapper.selectScSheepDeathById(id);
|
||||
if (scSheepDeath != null && scSheepDeath.getSheepId() != null) {
|
||||
// 恢复羊只在群状态为"在群"(字典值为1)
|
||||
scSheepDeathMapper.updateSheepStatus(scSheepDeath.getSheepId(), "1");
|
||||
}
|
||||
}
|
||||
|
||||
return scSheepDeathMapper.deleteScSheepDeathByIds(ids);
|
||||
}
|
||||
|
||||
@ -161,6 +198,13 @@ public class ScSheepDeathServiceImpl implements IScSheepDeathService
|
||||
@Override
|
||||
public int deleteScSheepDeathById(Long id)
|
||||
{
|
||||
// 可选:删除死淘记录前,将对应羊只在群状态改回"在群"
|
||||
ScSheepDeath scSheepDeath = scSheepDeathMapper.selectScSheepDeathById(id);
|
||||
if (scSheepDeath != null && scSheepDeath.getSheepId() != null) {
|
||||
// 恢复羊只在群状态为"在群"(字典值为1)
|
||||
scSheepDeathMapper.updateSheepStatus(scSheepDeath.getSheepId(), "1");
|
||||
}
|
||||
|
||||
return scSheepDeathMapper.deleteScSheepDeathById(id);
|
||||
}
|
||||
}
|
||||
@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
|
||||
<if test="technical != null and technical != ''"> and technical = #{technical}</if>
|
||||
</where>
|
||||
ORDER BY datetime DESC
|
||||
</select>
|
||||
|
||||
<select id="selectDewormById" parameterType="Long" resultMap="DewormResult">
|
||||
|
||||
@ -52,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="treatDay != null "> and treat_day = #{treatDay}</if>
|
||||
<if test="sheepfoldId != null "> and sd.sheepfold_id = #{sheepfoldId}</if>
|
||||
</where>
|
||||
ORDER BY datetime DESC
|
||||
</select>
|
||||
|
||||
<select id="selectDiagnosisById" parameterType="Long" resultMap="DiagnosisResult">
|
||||
|
||||
@ -61,6 +61,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND sm.name like concat('%',#{mediName},'%')
|
||||
)
|
||||
</if>
|
||||
ORDER BY datetime DESC
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectDisinfectById" parameterType="Long" resultMap="DisinfectResult">
|
||||
|
||||
@ -39,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="datetime != null "> and datetime = #{datetime}</if>
|
||||
<if test="technical != null and technical != ''"> and technical = #{technical}</if>
|
||||
</where>
|
||||
ORDER BY datetime DESC
|
||||
</select>
|
||||
|
||||
<select id="selectHealthById" parameterType="Long" resultMap="HealthResult">
|
||||
|
||||
@ -39,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
|
||||
<if test="technical != null and technical != ''"> and technical = #{technical}</if>
|
||||
</where>
|
||||
ORDER BY datetime DESC
|
||||
</select>
|
||||
|
||||
<select id="selectImmunityById" parameterType="Long" resultMap="ImmunityResult">
|
||||
|
||||
@ -68,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join sw_quarantine_sample sqs on sqr.sample_type = sqs.id
|
||||
left join sheep_file sf on sqr.sheep_id = sf.id
|
||||
where sqr.id = #{id}
|
||||
ORDER BY datetime DESC
|
||||
</select>
|
||||
|
||||
<insert id="insertQuarantineReport" parameterType="java.util.List">
|
||||
|
||||
@ -7,6 +7,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="SwMedicineUsage" id="SwMedicineUsageResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="sheepfoldId" column="sheepfold_id"/>
|
||||
<result property="sheepfoldName" column="sheepfold_name"/>
|
||||
<result property="sheepId" column="sheep_id"/>
|
||||
<result property="sheepNo" column="sheep_no"/>
|
||||
<result property="datetime" column="datetime"/>
|
||||
<result property="useType" column="use_type" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
@ -26,12 +31,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="dosage" column="dosage" />
|
||||
<result property="unit" column="unit" />
|
||||
<result property="usageId" column="usageId" />
|
||||
<result property="usetime" column="usetime" />
|
||||
<result property="manufacturer" column="manufacturer" />
|
||||
<result property="batchNumber" column="batch_number" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSwMedicineUsageVo">
|
||||
select id, name, use_type, update_by, update_time, create_by, create_time from sw_medicine_usage
|
||||
select smu.id, sheepfold as sheepfold_id,sheep sheep_id,name, datetime,use_type, smu.update_by, smu.update_time, smu.create_by, smu.create_time,
|
||||
ds.sheepfold_name,
|
||||
bs.manage_tags sheep_no
|
||||
from sw_medicine_usage smu
|
||||
left join da_sheepfold ds on ds.id = smu.sheepfold
|
||||
left join bas_sheep bs on bs.id = smu.sheep
|
||||
</sql>
|
||||
|
||||
<select id="selectSwMedicineUsageList" parameterType="SwMedicineUsage" resultMap="SwMedicineUsageResult">
|
||||
@ -39,8 +50,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="useType != null and useType != ''"> and use_type = #{useType}</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
||||
<if test="sheepNo != null and sheepNo != ''"> and bs.manage_tags like concat('%', #{sheepNo}, '%')</if>
|
||||
<if test="params.beginUseTime != null and params.beginUseTime != '' and params.endUseTime != null and params.endUseTime != ''"> and smu.datetime between #{params.beginUseTime} and #{params.endUseTime}</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and smu.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if> <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and smu.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
||||
</where>
|
||||
ORDER BY datetime DESC
|
||||
</select>
|
||||
|
||||
<select id="selectSwMedicineUsageById" parameterType="Integer" resultMap="SwMedicineUsageSwMedicineUsageDetailsResult">
|
||||
@ -50,11 +64,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectSwMedicineUsageDetailsList" resultMap="SwMedicineUsageDetailsResult">
|
||||
select smud.id, medi_usage, medi_id, dosage, unit, usageId, manufacturer, batch_number,
|
||||
select smud.id, medi_usage, medi_id, dosage, unit, usageId,usetime, manufacturer, batch_number,
|
||||
sm.name
|
||||
from sw_medicine_usage_details smud
|
||||
join sw_medicine sm on smud.medi_id = sm.id
|
||||
where medi_usage = #{medi_usage}
|
||||
|
||||
</select>
|
||||
|
||||
<insert id="insertSwMedicineUsage" parameterType="SwMedicineUsage" useGeneratedKeys="true" keyProperty="id">
|
||||
@ -62,6 +77,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
<if test="useType != null">use_type,</if>
|
||||
<if test="sheepfoldId != null">sheepfold,</if>
|
||||
<if test="sheepId != null">sheep,</if>
|
||||
<if test="datetime != null">datetime,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
@ -70,6 +88,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="useType != null">#{useType},</if>
|
||||
<if test="sheepfoldId != null">#{sheepfoldId},</if>
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="datetime != null">#{datetime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
@ -113,9 +134,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<insert id="batchSwMedicineUsageDetails">
|
||||
insert into sw_medicine_usage_details( id, medi_usage, medi_id, dosage, unit, usageId, manufacturer, batch_number) values
|
||||
insert into sw_medicine_usage_details( id, medi_usage, medi_id, dosage, unit, usageId,usetime, manufacturer, batch_number) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.mediUsage}, #{item.mediId}, #{item.dosage}, #{item.unit}, #{item.usageId}, #{item.manufacturer}, #{item.batchNumber})
|
||||
( #{item.id}, #{item.mediUsage}, #{item.mediId}, #{item.dosage}, #{item.unit}, #{item.usageId}, #{item.usetime},#{item.manufacturer}, #{item.batchNumber})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
@ -24,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="diseasePName" column="disease_pname"/>
|
||||
<result property="veterinary" column="veterinary" />
|
||||
<result property="usageId" column="usage_id" />
|
||||
<result property="status" column="status"/>
|
||||
<result property="comment" column="comment" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
@ -32,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTreatmentVo">
|
||||
select t.id, diag_id, sheep_id, variety, sheep_type, month_age, t.gender, t.parity, breed, lact_day, gest_day, datetime, disease_id, disease_pid, veterinary, usage_id, t.comment, t.update_by, t.update_time, t.create_by, t.create_time,
|
||||
select t.id, diag_id, sheep_id, variety, sheep_type, month_age, t.gender, t.parity, breed, lact_day, gest_day, datetime, disease_id, disease_pid, veterinary, usage_id,status, t.comment, t.update_by, t.update_time, t.create_by, t.create_time,
|
||||
bs.manage_tags,
|
||||
sd.name disease_name,
|
||||
sd2.name disease_pname
|
||||
@ -48,14 +49,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
|
||||
<if test="params.beginDatetime != null and params.beginDatetime != '' and params.endDatetime != null and params.endDatetime != ''"> and datetime between #{params.beginDatetime} and #{params.endDatetime}</if>
|
||||
<if test="diseaseId != null "> and disease_id = #{diseaseId}</if>
|
||||
<if test="status != null and status !=''"> and status = #{status}</if>
|
||||
<if test="veterinary != null and veterinary != ''"> and veterinary = #{veterinary}</if>
|
||||
</where>
|
||||
ORDER BY datetime DESC
|
||||
</select>
|
||||
|
||||
<select id="selectTreatmentById" parameterType="Long" resultMap="TreatmentResult">
|
||||
<include refid="selectTreatmentVo"/>
|
||||
where t.id = #{id}
|
||||
</select>
|
||||
<select id="selectTreatmentStatus" resultMap="TreatmentResult">
|
||||
select * from sw_treatment where sheep_id = #{sheepId} and status in (0, 1)
|
||||
</select>
|
||||
|
||||
<insert id="insertTreatment" parameterType="Treatment" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sw_treatment
|
||||
@ -75,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="diseasePid != null">disease_pid,</if>
|
||||
<if test="veterinary != null">veterinary,</if>
|
||||
<if test="usageId != null">usage_id,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
@ -97,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="diseasePid != null">#{diseasePid},</if>
|
||||
<if test="veterinary != null">#{veterinary},</if>
|
||||
<if test="usageId != null">#{usageId},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
@ -109,14 +117,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
insert into sw_treatment
|
||||
(diag_id, sheep_id, variety, sheep_type, month_age, gender,
|
||||
parity, breed, lact_day, gest_day, datetime,
|
||||
disease_id, disease_pid, veterinary, usage_id,
|
||||
disease_id, disease_pid, veterinary, usage_id,status ,
|
||||
comment, update_by, update_time, create_by, create_time)
|
||||
values
|
||||
<foreach collection="list" item="t" separator=",">
|
||||
(#{t.diagId}, #{t.sheepId}, #{t.variety}, #{t.sheepType},
|
||||
#{t.monthAge}, #{t.gender}, #{t.parity}, #{t.breed},
|
||||
#{t.lactDay}, #{t.gestDay}, #{t.datetime}, #{t.diseaseId},
|
||||
#{t.diseasePid}, #{t.veterinary},#{t.usageId}, #{t.comment},
|
||||
#{t.diseasePid}, #{t.veterinary},#{t.usageId}, #{t.status}, #{t.comment},
|
||||
#{t.updateBy}, #{t.updateTime},#{t.createBy}, #{t.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
@ -139,6 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="diseasePid != null">disease_pid = #{diseasePid},</if>
|
||||
<if test="veterinary != null">veterinary = #{veterinary},</if>
|
||||
<if test="usageId != null">usage_id = #{usageId},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
|
||||
@ -0,0 +1,155 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhyc.module.produce.breed.mapper.ScMiscarriageRecordMapper">
|
||||
|
||||
<resultMap type="ScMiscarriageRecord" id="ScMiscarriageRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="datetime" column="datetime" />
|
||||
<result property="comment" column="comment" />
|
||||
<result property="technician" column="technician" />
|
||||
<result property="reason" column="reason" />
|
||||
<result property="exposeType" column="expose_type" />
|
||||
<result property="status" column="status" />
|
||||
<result property="miscaLamb" column="misca_lamb" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<!-- 关联查询字段 -->
|
||||
<result property="bsManageTags" column="bs_manage_tags" />
|
||||
<result property="variety" column="variety" />
|
||||
<result property="matingTypeId" column="mating_type_id" />
|
||||
<result property="matingTypeName" column="mating_type_name" />
|
||||
<result property="matingDate" column="mating_date" />
|
||||
<result property="parity" column="parity" />
|
||||
<result property="ramVariety" column="ram_variety" />
|
||||
<result property="monthAge" column="month_age" />
|
||||
<result property="pregnantDays" column="pregnant_days" />
|
||||
<result property="sheepfoldName" column="sheepfold_name" />
|
||||
<result property="drRanch" column="dr_ranch" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScMiscarriageRecordVo">
|
||||
select
|
||||
smr.id,
|
||||
smr.sheep_id,
|
||||
smr.datetime,
|
||||
smr.comment,
|
||||
smr.technician,
|
||||
smr.reason,
|
||||
smr.expose_type,
|
||||
smr.status,
|
||||
smr.misca_lamb,
|
||||
smr.create_by,
|
||||
smr.create_time,
|
||||
sf.bs_manage_tags,
|
||||
sf.variety,
|
||||
sf.mating_type_id,
|
||||
CASE sf.mating_type_id
|
||||
WHEN 1 THEN '人工授精'
|
||||
WHEN 2 THEN '自然配种'
|
||||
WHEN 3 THEN '胚胎移植'
|
||||
ELSE '未知'
|
||||
END as mating_type_name,
|
||||
sf.mating_date,
|
||||
sf.parity,
|
||||
sf.variety as ram_variety, -- 这里需要根据实际配种公羊信息调整
|
||||
sf.month_age,
|
||||
CASE
|
||||
WHEN sf.mating_date IS NOT NULL AND smr.datetime IS NOT NULL
|
||||
THEN DATEDIFF(smr.datetime, sf.mating_date)
|
||||
ELSE NULL
|
||||
END as pregnant_days,
|
||||
sf.sheepfold_name,
|
||||
sf.dr_ranch
|
||||
from sc_miscarriage_record smr
|
||||
left join sheep_file sf on smr.sheep_id = sf.bs_manage_tags
|
||||
</sql>
|
||||
|
||||
<select id="selectScMiscarriageRecordList" parameterType="ScMiscarriageRecord" resultMap="ScMiscarriageRecordResult">
|
||||
<include refid="selectScMiscarriageRecordVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null and sheepId != ''"> and smr.sheep_id = #{sheepId}</if>
|
||||
<if test="bsManageTags != null and bsManageTags != ''"> and sf.bs_manage_tags like concat('%', #{bsManageTags}, '%')</if>
|
||||
<if test="datetime != null"> and smr.datetime = #{datetime}</if>
|
||||
<if test="comment != null and comment != ''"> and smr.comment like concat('%', #{comment}, '%')</if>
|
||||
<if test="technician != null and technician != ''"> and smr.technician like concat('%', #{technician}, '%')</if>
|
||||
<if test="reason != null and reason != ''"> and smr.reason = #{reason}</if>
|
||||
<if test="exposeType != null"> and smr.expose_type = #{exposeType}</if>
|
||||
<if test="status != null"> and smr.status = #{status}</if>
|
||||
<if test="miscaLamb != null"> and smr.misca_lamb = #{miscaLamb}</if>
|
||||
<if test="variety != null and variety != ''"> and sf.variety like concat('%', #{variety}, '%')</if>
|
||||
</where>
|
||||
order by smr.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectScMiscarriageRecordById" parameterType="Long" resultMap="ScMiscarriageRecordResult">
|
||||
<include refid="selectScMiscarriageRecordVo"/>
|
||||
where smr.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertScMiscarriageRecord" parameterType="ScMiscarriageRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_miscarriage_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="datetime != null">datetime,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="technician != null">technician,</if>
|
||||
<if test="reason != null">reason,</if>
|
||||
<if test="exposeType != null">expose_type,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="miscaLamb != null">misca_lamb,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="datetime != null">#{datetime},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="technician != null">#{technician},</if>
|
||||
<if test="reason != null">#{reason},</if>
|
||||
<if test="exposeType != null">#{exposeType},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="miscaLamb != null">#{miscaLamb},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateScMiscarriageRecord" parameterType="ScMiscarriageRecord">
|
||||
update sc_miscarriage_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="datetime != null">datetime = #{datetime},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="reason != null">reason = #{reason},</if>
|
||||
<if test="exposeType != null">expose_type = #{exposeType},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="miscaLamb != null">misca_lamb = #{miscaLamb},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteScMiscarriageRecordById" parameterType="Long">
|
||||
delete from sc_miscarriage_record where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteScMiscarriageRecordByIds" parameterType="String">
|
||||
delete from sc_miscarriage_record where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据耳号查询羊只信息 -->
|
||||
<select id="selectSheepByManageTags" parameterType="String" resultType="map">
|
||||
select bs_manage_tags, variety, parity, month_age, sheepfold_name, dr_ranch
|
||||
from sheep_file
|
||||
where bs_manage_tags = #{manageTags}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -102,6 +102,7 @@
|
||||
and sm.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY sm.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectScBodyMeasureById" parameterType="Long" resultMap="ScBodyMeasureResult">
|
||||
|
||||
@ -58,6 +58,7 @@
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY sbs.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectScBodyScoreById" parameterType="Long" resultMap="ScBodyScoreResult">
|
||||
|
||||
@ -56,6 +56,7 @@
|
||||
and sbr.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY sbr.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectScBreastRatingById" parameterType="Long" resultMap="ScBreastRatingResult">
|
||||
|
||||
@ -16,8 +16,6 @@
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="create_by" />
|
||||
<result property="updateTime" column="create_time" />
|
||||
<!-- 关联羊只信息字段 -->
|
||||
<result property="variety" column="variety" />
|
||||
<result property="monthAge" column="month_age" />
|
||||
@ -32,6 +30,7 @@
|
||||
<result property="expectedDate" column="expected_date" />
|
||||
<result property="lastEventDate" column="last_event_date" />
|
||||
<result property="ranchName" column="ranch" />
|
||||
<result property="daysAfterMating" column="days_after_mating" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectScPregnancyRecordVo">
|
||||
@ -46,8 +45,6 @@
|
||||
pr.remark,
|
||||
pr.create_by,
|
||||
pr.create_time,
|
||||
pr.create_by,
|
||||
pr.create_time,
|
||||
sf.bs_manage_tags as manage_tags,
|
||||
sf.variety,
|
||||
sf.month_age,
|
||||
@ -55,18 +52,37 @@
|
||||
sf.mating_counts,
|
||||
sf.sheepfold_name,
|
||||
sf.breed,
|
||||
sf.father_manage_tags,
|
||||
father_sf.variety as father_variety,
|
||||
mating_type.dict_label as mating_type_name,
|
||||
sf.mating_date,
|
||||
sf.expected_date,
|
||||
sf.lambing_date as last_event_date,
|
||||
r.ranch as ranch
|
||||
sf.dr_ranch as ranch,
|
||||
-- 关联配种信息
|
||||
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
|
||||
left join sheep_file sf on pr.sheep_id = 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'
|
||||
left join da_ranch r on sf.ranch_id = r.id
|
||||
left join sheep_file father_sf on sf.bs_father_id = father_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>
|
||||
|
||||
<select id="selectScPregnancyRecordList" parameterType="ScPregnancyRecord" resultMap="ScPregnancyRecordResult">
|
||||
@ -86,7 +102,7 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="datetime != null "> and pr.datetime = #{datetime}</if>
|
||||
<if test="datetime != null "> and DATE(pr.datetime) = DATE(#{datetime})</if>
|
||||
<if test="result != null and result != ''"> and pr.result = #{result}</if>
|
||||
<if test="technician != null and technician != ''"> and pr.technician like concat('%', #{technician}, '%')</if>
|
||||
<if test="way != null and way != ''"> and pr.way = #{way}</if>
|
||||
@ -116,6 +132,28 @@
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<!-- 根据耳号获取配种信息 -->
|
||||
<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.create_time as matingDate,
|
||||
mating_type.dict_label as matingTypeName,
|
||||
br.technician as breedTechnician,
|
||||
br.create_time as breedCreateTime
|
||||
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
|
||||
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
|
||||
</select>
|
||||
|
||||
<insert id="insertScPregnancyRecord" parameterType="ScPregnancyRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sc_pregnancy_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@ -153,8 +191,6 @@
|
||||
<if test="technician != null">technician = #{technician},</if>
|
||||
<if test="way != null">way = #{way},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null">create_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">create_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
@ -178,7 +214,6 @@
|
||||
<if test="breedStatusId != null">breed_status_id = #{breedStatusId},</if>
|
||||
<if test="expectedDate != null">expected_date = #{expectedDate},</if>
|
||||
<if test="gestationDay != null">gestation_day = #{gestationDay},</if>
|
||||
create_time = now()
|
||||
</set>
|
||||
where id = #{sheepId}
|
||||
</update>
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
|
||||
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectScSheepDeathById" parameterType="Long" resultMap="ScSheepDeathResult">
|
||||
@ -53,9 +54,21 @@
|
||||
|
||||
<!-- 根据管理耳号查询sheep_file视图信息 -->
|
||||
<select id="selectSheepFileByManageTags" parameterType="String" resultType="java.util.Map">
|
||||
select id as sheepId, variety, name as sheepType, gender, day_age as dayAge, parity, sheepfold_name as sheepfoldName, breed as breedStatus, post_lambing_day as postLambingDay, lactation_day as lactationDay, gestation_day as gestationDay
|
||||
select
|
||||
id as sheepId,
|
||||
variety,
|
||||
name as sheepType,
|
||||
gender,
|
||||
day_age as dayAge,
|
||||
parity,
|
||||
sheepfold_name as sheepfoldName,
|
||||
breed as breedStatus,
|
||||
post_lambing_day as postLambingDay,
|
||||
lactation_day as lactationDay,
|
||||
gestation_day as gestationDay
|
||||
from sheep_file
|
||||
where bs_manage_tags = #{manageTags} and is_delete = 0
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertScSheepDeath" parameterType="ScSheepDeath" useGeneratedKeys="true" keyProperty="id">
|
||||
@ -131,4 +144,23 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 更新羊只繁育状态 - 保留原有功能 -->
|
||||
<update id="updateSheepFileStatus">
|
||||
UPDATE sheep_file
|
||||
SET breed = #{status},
|
||||
update_time = NOW()
|
||||
WHERE id = #{sheepId}
|
||||
AND is_delete = 0
|
||||
</update>
|
||||
|
||||
<!-- 新增:更新羊只在群状态 -->
|
||||
<update id="updateSheepStatus">
|
||||
UPDATE sheep_file
|
||||
SET status = #{status},
|
||||
update_time = NOW()
|
||||
WHERE id = #{sheepId}
|
||||
AND is_delete = 0
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@ -49,6 +49,7 @@
|
||||
and scc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY scc.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectScChangeCommentById" parameterType="Long" resultMap="ScChangeCommentResult">
|
||||
|
||||
@ -61,6 +61,7 @@
|
||||
and sce.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY sce.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectScChangeEarById" parameterType="Integer" resultMap="ScChangeEarResult">
|
||||
|
||||
@ -52,6 +52,7 @@
|
||||
and scv.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY scv.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectScChangeVarietyById" parameterType="Integer" resultMap="ScChangeVarietyResult">
|
||||
|
||||
@ -71,6 +71,7 @@
|
||||
and tg.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY tg.create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@ -67,6 +67,7 @@
|
||||
and t.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY t.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectScTransitionInfoById" parameterType="Integer" resultMap="ScTransitionInfoResult">
|
||||
|
||||
@ -52,6 +52,7 @@
|
||||
and sc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY sc.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectScCastrateById" parameterType="Long" resultMap="ScCastrateResult">
|
||||
|
||||
@ -48,6 +48,7 @@
|
||||
and bs.manage_tags like concat('%', #{manageTags}, '%')
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY fh.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectScFixHoofById" parameterType="java.lang.Integer" resultMap="ScFixHoofResult">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user