This commit is contained in:
HashMap 2025-11-01 16:51:40 +08:00
commit 346ba1a966
38 changed files with 459 additions and 128 deletions

View File

@ -10,8 +10,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
* @author ruoyi * @author ruoyi
*/ */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class SheepApplication public class SheepApplication {
{
public static void main(String[] args) public static void main(String[] args)
{ {
// System.setProperty("spring.devtools.restart.enabled", "false"); // System.setProperty("spring.devtools.restart.enabled", "false");

View File

@ -0,0 +1,8 @@
package com.zhyc.module.Exception;
// 业务异常
public class BusinessException extends RuntimeException {
public BusinessException(String message) {
super(message);
}
}

View File

@ -1,5 +1,6 @@
package com.zhyc.module.biosafety.controller; package com.zhyc.module.biosafety.controller;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -56,8 +57,13 @@ public class SwMedicineUsageController extends BaseController
public void export(HttpServletResponse response, SwMedicineUsage swMedicineUsage) public void export(HttpServletResponse response, SwMedicineUsage swMedicineUsage)
{ {
List<SwMedicineUsage> list = swMedicineUsageService.selectSwMedicineUsageList(swMedicineUsage); List<SwMedicineUsage> list = swMedicineUsageService.selectSwMedicineUsageList(swMedicineUsage);
List<SwMedicineUsage> resultList = new ArrayList<>();
for (SwMedicineUsage medicineUsage : list) {
medicineUsage.setSwMedicineUsageDetailsList(swMedicineUsageService.selectSwMedicineUsageDetailsById(medicineUsage.getId()));
resultList.add(medicineUsage);
}
ExcelUtil<SwMedicineUsage> util = new ExcelUtil<SwMedicineUsage>(SwMedicineUsage.class); ExcelUtil<SwMedicineUsage> util = new ExcelUtil<SwMedicineUsage>(SwMedicineUsage.class);
util.exportExcel(response, list, "药品使用记录数据"); util.exportExcel(response, resultList, "药品使用记录数据");
} }
/** /**

View File

@ -28,27 +28,28 @@ public class SwMedicineUsage extends BaseEntity
private Integer id; private Integer id;
/** 使用名称 */ /** 使用名称 */
@Excel(name = "使用名称") @Excel(name = "使用名称",width = 20, needMerge = true)
private String name; private String name;
/** 羊舍名称 */ /** 羊舍名称 */
@Excel(name = "使用名称") @Excel(name = "使用名称" ,width = 20, needMerge = true)
private String sheepfoldName; private String sheepfoldName;
private Integer sheepfoldId; private Integer sheepfoldId;
/** 耳号 */ /** 耳号 */
@Excel(name = "耳号") @Excel(name = "耳号",width = 20, needMerge = true)
private String sheepNo; private String sheepNo;
private Integer sheepId; private Integer sheepId;
/** 使用时间 */ /** 使用时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "使用日期", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "使用日期", width = 30, dateFormat = "yyyy-MM-dd", needMerge = true)
private Date datetime; private Date datetime;
/** 使用类型 */ /** 使用类型 */
@Excel(name = "使用类型") @Excel(name = "使用类型",width = 20, needMerge = true)
private String useType; private String useType;
/** 药品使用记录详情信息 */ /** 药品使用记录详情信息 */
@Excel
private List<SwMedicineUsageDetails> swMedicineUsageDetailsList; private List<SwMedicineUsageDetails> swMedicineUsageDetailsList;

View File

@ -26,40 +26,40 @@ public class SwMedicineUsageDetails extends BaseEntity
private Long id; private Long id;
/** 药品使用记录id */ /** 药品使用记录id */
@Excel(name = "药品使用记录id") // @Excel(name = "药品使用记录id")
private Integer mediUsage; private Integer mediUsage;
/** 药品id */ /** 药品id */
@Excel(name = "药品id") // @Excel(name = "药品id")
private Long mediId; private Long mediId;
/** 药品名称*/ /** 药品名称*/
@Excel(name = "药品名称") @Excel(name = "药品名称",cellType = Excel.ColumnType.STRING)
private String mediName; private String mediName;
/** 用量 */ /** 用量 */
@Excel(name = "用量") @Excel(name = "用量",cellType = Excel.ColumnType.STRING)
private String dosage; private String dosage;
/** 单位 */ /** 单位 */
@Excel(name = "单位") @Excel(name = "单位",cellType = Excel.ColumnType.STRING)
private String unit; private String unit;
/** 使用方法 */ /** 使用方法 */
@Excel(name = "使用方法") @Excel(name = "使用方法",cellType = Excel.ColumnType.STRING)
private String usageId; private String usageId;
/** 使用时间 */ /** 使用时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "使用时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") // @Excel(name = "使用时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date usetime; private Date usetime;
/** 生产厂家 */ /** 生产厂家 */
@Excel(name = "生产厂家") @Excel(name = "生产厂家",cellType = Excel.ColumnType.STRING)
private String manufacturer; private String manufacturer;
/** 生产批号 */ /** 生产批号 */
@Excel(name = "生产批号") @Excel(name = "生产批号",cellType = Excel.ColumnType.STRING)
private String batchNumber; private String batchNumber;
} }

View File

@ -107,8 +107,16 @@ public class Treatment extends BaseEntity
@Excel(name = "备注") @Excel(name = "备注")
private String comment; private String comment;
public void setGender(String gender) { public void setGender(String gender) {
this.gender = gender; this.gender = gender; // 保留原始字符串
this.genderName = Gender.getDescByCode(Integer.valueOf(gender)); this.genderName = null; // 先清空
if (gender != null && !gender.trim().isEmpty()) {
try {
this.genderName = Gender.getDescByCode(Integer.valueOf(gender.trim()));
} catch (NumberFormatException ex) {
// 可选记录日志或抛业务异常
this.genderName = "未知";
}
}
} }
// 排序查询 // 排序查询

View File

@ -87,4 +87,6 @@ public interface SwMedicineUsageMapper
* @return 结果 * @return 结果
*/ */
public int deleteSwMedicineUsageDetailsByMediUsage(Integer id); public int deleteSwMedicineUsageDetailsByMediUsage(Integer id);
List<SwMedicineUsageDetails> selectSwMedicineUsageDetailsById(Integer id);
} }

View File

@ -2,6 +2,7 @@ package com.zhyc.module.biosafety.service;
import java.util.List; import java.util.List;
import com.zhyc.module.biosafety.domain.SwMedicineUsage; import com.zhyc.module.biosafety.domain.SwMedicineUsage;
import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails;
/** /**
* 药品使用记录Service接口 * 药品使用记录Service接口
@ -58,4 +59,6 @@ public interface ISwMedicineUsageService
* @return 结果 * @return 结果
*/ */
public int deleteSwMedicineUsageById(Integer id); public int deleteSwMedicineUsageById(Integer id);
List<SwMedicineUsageDetails> selectSwMedicineUsageDetailsById(Integer id);
} }

View File

@ -113,6 +113,11 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService
return swMedicineUsageMapper.deleteSwMedicineUsageById(id); return swMedicineUsageMapper.deleteSwMedicineUsageById(id);
} }
@Override
public List<SwMedicineUsageDetails> selectSwMedicineUsageDetailsById(Integer id) {
return swMedicineUsageMapper.selectSwMedicineUsageDetailsById(id);
}
/** /**
* 新增药品使用记录详情信息 * 新增药品使用记录详情信息
* *

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.SecurityUtils; import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.bean.BeanUtils; import com.zhyc.common.utils.bean.BeanUtils;
import com.zhyc.module.Exception.BusinessException;
import com.zhyc.module.base.domain.SheepFile; import com.zhyc.module.base.domain.SheepFile;
import com.zhyc.module.base.mapper.SheepFileMapper; import com.zhyc.module.base.mapper.SheepFileMapper;
import com.zhyc.module.biosafety.domain.Diagnosis; import com.zhyc.module.biosafety.domain.Diagnosis;
@ -77,10 +78,10 @@ public class TreatmentServiceImpl implements ITreatmentService
*/ */
@Override @Override
@Transactional @Transactional
public int insertTreatment(Treatment treatment) public int insertTreatment(Treatment treatment) {
{
String username = SecurityUtils.getLoginUser().getUser().getNickName(); String username = SecurityUtils.getLoginUser().getUser().getNickName();
// 使用记录的文件
// 药品使用记录公共字段
SwMedicineUsage medicineUsage = new SwMedicineUsage(); SwMedicineUsage medicineUsage = new SwMedicineUsage();
medicineUsage.setSwMedicineUsageDetailsList(treatment.getUsageDetails()); medicineUsage.setSwMedicineUsageDetailsList(treatment.getUsageDetails());
medicineUsage.setName("羊只治疗"); medicineUsage.setName("羊只治疗");
@ -88,52 +89,97 @@ public class TreatmentServiceImpl implements ITreatmentService
medicineUsage.setDatetime(treatment.getDatetime()); medicineUsage.setDatetime(treatment.getDatetime());
medicineUsage.setCreateBy(username); medicineUsage.setCreateBy(username);
medicineUsage.setCreateTime(DateUtils.getNowDate()); medicineUsage.setCreateTime(DateUtils.getNowDate());
// 新增单挑数据
if (treatment.getSheepId()!=null){
medicineUsage.setSheepId(Math.toIntExact(treatment.getSheepId()));
// 药品使用记录
Integer id=medicineUsageService.insertSwMedicineUsage(medicineUsage);
// 药品使用记录id
treatment.setUsageId(id);
treatment.setCreateTime(DateUtils.getNowDate());
return treatmentMapper.insertTreatment(treatment);
// 批量新增 /* ---------------- 单只插入 ---------------- */
}else { if (treatment.getSheepId() != null) {
// 1. 重复校验
Treatment query = new Treatment();
query.setDiseaseId(treatment.getDiseaseId());
query.setDiseasePid(treatment.getDiseasePid());
query.setSheepId(treatment.getSheepId());
query.setStatus("0");
List<Treatment> treatments = new ArrayList<>();
treatment.setCreateTime(DateUtils.getNowDate());
for (String sheepId : treatment.getSheepIds()) {
SheepFile sheepFile = sheepFileMapper.selectSheepFileById(Long.valueOf(sheepId));
Treatment treat = new Treatment();
BeanUtils.copyProperties(treatment, treat);
treat.setSheepId(Long.valueOf(sheepId));
treat.setVariety(sheepFile.getVariety());
treat.setSheepType(sheepFile.getName());
treat.setMonthAge(sheepFile.getMonthAge());
treat.setGender(String.valueOf(sheepFile.getGender()));
treat.setBreed(sheepFile.getBreed());
treat.setParity(sheepFile.getParity());
treat.setLactDay(sheepFile.getLactationDay());
treat.setGestDay(sheepFile.getGestationDay());
medicineUsage.setSheepId(Integer.valueOf(sheepId));
// 获取药品使用记录的id // 2. 羊只档案信息
Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage); SheepFile sheepFile = sheepFileMapper.selectSheepFileById(treatment.getSheepId());
System.out.println(medicineUsage);
System.out.println(usageId); if (!treatmentMapper.selectTreatmentList(query).isEmpty()) {
treat.setUsageId(usageId); throw new BusinessException("该羊只已存在相同疾病的治疗记录,不能重复添加");
treatments.add(treat);
} }
// 药品使用记录 // 3. 保存药品使用记录
medicineUsage.setSwMedicineUsageDetailsList(treatment.getUsageDetails()); medicineUsage.setSheepId(Math.toIntExact(treatment.getSheepId()));
Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage);
// 4. 组装治疗记录
treatment.setUsageId(usageId);
treatment.setCreateTime(DateUtils.getNowDate());
treatment.setVariety(sheepFile.getVariety());
treatment.setSheepType(sheepFile.getName());
treatment.setMonthAge(sheepFile.getMonthAge());
treatment.setGender(String.valueOf(sheepFile.getGender()));
treatment.setBreed(sheepFile.getBreed());
treatment.setParity(sheepFile.getParity());
treatment.setLactDay(sheepFile.getLactationDay());
treatment.setGestDay(sheepFile.getGestationDay());
return treatmentMapper.insertTreatmentList(treatments); // 5. 插入
return treatmentMapper.insertTreatment(treatment);
} }
} /* ---------------- 批量插入 ---------------- */
// 1. 收集所有重复耳号
List<String> duplicateSheepIds = new ArrayList<>();
for (String sheepId : treatment.getSheepIds()) {
Treatment query = new Treatment();
query.setDiseaseId(treatment.getDiseaseId());
query.setDiseasePid(treatment.getDiseasePid());
query.setSheepId(Long.valueOf(sheepId));
query.setStatus("0");
if (!treatmentMapper.selectTreatmentList(query).isEmpty()) {
String bsManageTags = sheepFileMapper.selectSheepFileById(Long.valueOf(sheepId)).getBsManageTags();
duplicateSheepIds.add(bsManageTags);
}
}
// 2. 存在重复则一次性提示
if (!duplicateSheepIds.isEmpty()) {
throw new BusinessException("以下耳号已存在相同疾病记录,无法添加:" + String.join("", duplicateSheepIds));
}
// 3. 全部合法开始批量组装
List<Treatment> treatments = new ArrayList<>();
treatment.setCreateTime(DateUtils.getNowDate());
for (String sheepId : treatment.getSheepIds()) {
SheepFile sheepFile = sheepFileMapper.selectSheepFileById(Long.valueOf(sheepId));
Treatment treat = new Treatment();
BeanUtils.copyProperties(treatment, treat);
treat.setSheepId(Long.valueOf(sheepId));
treat.setVariety(sheepFile.getVariety());
treat.setSheepType(sheepFile.getName());
treat.setMonthAge(sheepFile.getMonthAge());
treat.setGender(String.valueOf(sheepFile.getGender()));
treat.setBreed(sheepFile.getBreed());
treat.setParity(sheepFile.getParity());
treat.setLactDay(sheepFile.getLactationDay());
treat.setGestDay(sheepFile.getGestationDay());
// 药品使用记录
medicineUsage.setSheepId(Integer.valueOf(sheepId));
Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage);
treat.setUsageId(usageId);
treatments.add(treat);
}
// 4. 批量插入
return treatmentMapper.insertTreatmentList(treatments);
}
/** /**
* 修改治疗记录 * 修改治疗记录
* *
@ -153,7 +199,9 @@ public class TreatmentServiceImpl implements ITreatmentService
swMedicineUsage.setId(treatment.getUsageId()); swMedicineUsage.setId(treatment.getUsageId());
swMedicineUsage.setUpdateBy(username); swMedicineUsage.setUpdateBy(username);
medicineUsageMapper.updateSwMedicineUsage(swMedicineUsage); medicineUsageMapper.updateSwMedicineUsage(swMedicineUsage);
medicineUsageMapper.batchSwMedicineUsageDetails(treatment.getUsageDetails()); if (!treatment.getUsageDetails().isEmpty() || treatment.getUsageDetails().size() != 0){
medicineUsageMapper.batchSwMedicineUsageDetails(treatment.getUsageDetails());
}
treatment.setUpdateBy(username); treatment.setUpdateBy(username);
treatment.setUpdateTime(DateUtils.getNowDate()); treatment.setUpdateTime(DateUtils.getNowDate());
return treatmentMapper.updateTreatment(treatment); return treatmentMapper.updateTreatment(treatment);

View File

@ -0,0 +1,4 @@
package com.zhyc.module.enums;
public enum UseType {
}

View File

@ -183,4 +183,13 @@ public class ScBodyMeasure extends BaseEntity {
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/**
* 排序字段
*/
private String orderBy;
/**
* 排序方向
*/
private String sortDirection;
} }

View File

@ -77,4 +77,13 @@ public class ScBodyScore extends BaseEntity {
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/**
* 排序字段
*/
private String orderBy;
/**
* 排序方向
*/
private String sortDirection;
} }

View File

@ -110,5 +110,13 @@ public class ScBreastRating extends BaseEntity {
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/**
* 排序字段
*/
private String orderBy;
/**
* 排序方向
*/
private String sortDirection;
} }

View File

@ -1,6 +1,7 @@
package com.zhyc.module.produce.bodyManage.service.impl; package com.zhyc.module.produce.bodyManage.service.impl;
import java.util.List; import java.util.List;
import java.util.Map;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.SecurityUtils; import com.zhyc.common.utils.SecurityUtils;

View File

@ -96,7 +96,7 @@ public class ScAddSheepController {
// 根据牧场ID查询牧场信息 // 根据牧场ID查询牧场信息
DaRanch ranch = daRanchService.selectDaRanchById(scAddSheep.getRanchId().longValue()); DaRanch ranch = daRanchService.selectDaRanchById(scAddSheep.getRanchId().longValue());
if (ranch != null) { if (ranch != null) {
scAddSheep.setRanchName(ranch.getRanch()); // 将牧场名称设置到实体中 scAddSheep.setRanchName(ranch.getRanch());
} }
} }
// 处理羊舍名称 // 处理羊舍名称

View File

@ -37,7 +37,6 @@ public class ScAddSheep extends BaseEntity {
private String sheepfoldName; private String sheepfoldName;
// 导出时生成羊舍名称 Excel 不映射到数据库
@Excel(name = "羊舍名称") @Excel(name = "羊舍名称")
private String sheepfoldNameExcel; private String sheepfoldNameExcel;

View File

@ -1,11 +1,14 @@
package com.zhyc.module.produce.manage_sheep.domain; package com.zhyc.module.produce.manage_sheep.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;
import java.util.Date;
/** /**
* 改备注对象 sc_change_comment * 改备注对象 sc_change_comment
* *
@ -53,5 +56,15 @@ public class ScChangeComment extends BaseEntity {
@Excel(name = "原备注") @Excel(name = "原备注")
private String oldComment; private String oldComment;
/**
* 事件日期
*/
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date eventDate;
/**
* 技术员
*/
@Excel(name = "技术员")
private String technician;
} }

View File

@ -1,11 +1,14 @@
package com.zhyc.module.produce.manage_sheep.domain; package com.zhyc.module.produce.manage_sheep.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import com.zhyc.common.annotation.Excel; import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity; import com.zhyc.common.core.domain.BaseEntity;
import java.util.Date;
/** /**
* 修改电子耳号记录对象 sc_change_ear * 修改电子耳号记录对象 sc_change_ear
* *
@ -15,43 +18,70 @@ import com.zhyc.common.core.domain.BaseEntity;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class ScChangeEar extends BaseEntity public class ScChangeEar extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** id */ /**
* id
*/
private Integer id; private Integer id;
/** 羊只id */ /**
* 羊只id
*/
private Long sheepId; private Long sheepId;
@Excel(name = "管理耳号") @Excel(name = "管理耳号")
private String manageTags; private String manageTags;
/** 羊舍 */ /**
* 羊舍
*/
private Long sheepfoldId; private Long sheepfoldId;
@Excel(name = "羊舍") @Excel(name = "羊舍")
private String sheepfoldName; private String sheepfoldName;
/** 事件类型(改管理耳号/改电子耳号) */ /**
* 事件类型改管理耳号/改电子耳号
*/
@Excel(name = "事件类型") @Excel(name = "事件类型")
private String eventType; private String eventType;
/** 选择更改耳号类型0电子耳号1管理耳号 */ /**
* 选择更改耳号类型0电子耳号1管理耳号
*/
@Excel(name = "耳号类型", readConverterExp = "0=电子耳号,1=管理耳号") @Excel(name = "耳号类型", readConverterExp = "0=电子耳号,1=管理耳号")
private Integer earType; private Integer earType;
/** 新耳号/电子耳号 */ /**
* 新耳号/电子耳号
*/
@Excel(name = "新耳号/电子耳号") @Excel(name = "新耳号/电子耳号")
private String newTag; private String newTag;
/** 旧耳号/电子耳号 */ /**
* 旧耳号/电子耳号
*/
@Excel(name = "旧耳号/电子耳号") @Excel(name = "旧耳号/电子耳号")
private String oldTag; private String oldTag;
/** 备注 */ /**
* 备注
*/
@Excel(name = "备注") @Excel(name = "备注")
private String comment; private String comment;
/**
* 事件日期
*/
@Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date eventDate;
/**
* 技术员
*/
@Excel(name = "技术员")
private String technician;
} }

View File

@ -1,6 +1,7 @@
package com.zhyc.module.produce.manage_sheep.domain; package com.zhyc.module.produce.manage_sheep.domain;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
@ -17,19 +18,24 @@ import com.zhyc.common.core.domain.BaseEntity;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class ScChangeVariety extends BaseEntity public class ScChangeVariety extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** $column.columnComment */ /**
* $column.columnComment
*/
private Integer id; private Integer id;
/** 羊只id */ /**
* 羊只id
*/
private Integer sheepId; private Integer sheepId;
@Excel(name = "耳号") @Excel(name = "耳号")
private String manageTags; private String manageTags;
/** 羊舍 */ /**
* 羊舍
*/
private Long sheepfoldId; private Long sheepfoldId;
@Excel(name = "羊舍") @Excel(name = "羊舍")
private String sheepfoldName; private String sheepfoldName;
@ -40,17 +46,35 @@ public class ScChangeVariety extends BaseEntity
@Excel(name = "事件类型") @Excel(name = "事件类型")
private String eventType; private String eventType;
/** 原品种 */ /**
* 原品种
*/
@Excel(name = "原品种") @Excel(name = "原品种")
private String varietyOld; private String varietyOld;
/** 新品种 */ /**
* 新品种
*/
@Excel(name = "新品种") @Excel(name = "新品种")
private String varietyNew; private String varietyNew;
/** 备注 */ /**
* 备注
*/
@Excel(name = "备注") @Excel(name = "备注")
private String comment; private String comment;
/**
* 技术员
*/
@Excel(name = "技术员")
private String technician;
/**
* 事件日期
*/
@Excel(name = "事件日期",width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date eventDate;
} }

View File

@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.zhyc.common.utils.SecurityUtils; import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.StringUtils;
import com.zhyc.module.base.domain.BasSheep; import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.service.IBasSheepService; import com.zhyc.module.base.service.IBasSheepService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -61,6 +62,12 @@ public class ScChangeCommentServiceImpl implements IScChangeCommentService
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int insertScChangeComment(ScChangeComment scChangeComment) public int insertScChangeComment(ScChangeComment scChangeComment)
{ {
if (StringUtils.isBlank(scChangeComment.getTechnician())) {
throw new RuntimeException("技术员不能为空");
}
if (scChangeComment.getEventDate() == null) {
throw new RuntimeException("事件日期不能为空");
}
scChangeComment.setCreateTime(new Date()); scChangeComment.setCreateTime(new Date());
scChangeComment.setCreateBy(SecurityUtils.getUsername()); scChangeComment.setCreateBy(SecurityUtils.getUsername());
int rows = scChangeCommentMapper.insertScChangeComment(scChangeComment); int rows = scChangeCommentMapper.insertScChangeComment(scChangeComment);

View File

@ -3,6 +3,7 @@ package com.zhyc.module.produce.manage_sheep.service.impl;
import java.util.List; import java.util.List;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
import com.zhyc.common.utils.SecurityUtils; import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.StringUtils;
import com.zhyc.module.base.domain.BasSheep; import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.service.IBasSheepService; import com.zhyc.module.base.service.IBasSheepService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -81,11 +82,18 @@ public class ScChangeEarServiceImpl implements IScChangeEarService
public int insertScChangeEar(ScChangeEar scChangeEar) { public int insertScChangeEar(ScChangeEar scChangeEar) {
scChangeEar.setCreateTime(DateUtils.getNowDate()); scChangeEar.setCreateTime(DateUtils.getNowDate());
scChangeEar.setCreateBy(SecurityUtils.getUsername()); scChangeEar.setCreateBy(SecurityUtils.getUsername());
if (StringUtils.isBlank(scChangeEar.getTechnician())) {
// 在新增时确保旧耳号被正确设置为原始耳号的值 throw new RuntimeException("技术员不能为空");
}
if (scChangeEar.getEventDate() == null) {
throw new RuntimeException("事件日期不能为空");
}
if (scChangeEar.getSheepId() == null) { if (scChangeEar.getSheepId() == null) {
throw new RuntimeException("未找到对应的羊只ID"); throw new RuntimeException("未找到对应的羊只ID");
} }
if (StringUtils.isBlank(scChangeEar.getComment())) {
throw new RuntimeException("备注不能为空");
}
BasSheep sheep = basSheepService.selectBasSheepById(scChangeEar.getSheepId()); BasSheep sheep = basSheepService.selectBasSheepById(scChangeEar.getSheepId());
if (sheep == null) { if (sheep == null) {
@ -113,8 +121,13 @@ public class ScChangeEarServiceImpl implements IScChangeEarService
} else if (scChangeEar.getEarType() == 1) { } else if (scChangeEar.getEarType() == 1) {
sheep.setManageTags(scChangeEar.getNewTag()); sheep.setManageTags(scChangeEar.getNewTag());
} }
basSheepService.updateBasSheep(sheep);
// 同步更新羊只主表备注
if (StringUtils.isNotBlank(scChangeEar.getComment())) {
sheep.setComment(scChangeEar.getComment());
}
basSheepService.updateBasSheep(sheep);
return rows; return rows;
} }

View File

@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.zhyc.common.utils.SecurityUtils; import com.zhyc.common.utils.SecurityUtils;
import com.zhyc.common.utils.StringUtils;
import com.zhyc.module.base.domain.BasSheep; import com.zhyc.module.base.domain.BasSheep;
import com.zhyc.module.base.domain.BasSheepVariety; import com.zhyc.module.base.domain.BasSheepVariety;
import com.zhyc.module.base.service.IBasSheepService; import com.zhyc.module.base.service.IBasSheepService;
@ -66,6 +67,14 @@ public class ScChangeVarietyServiceImpl implements IScChangeVarietyService
{ {
scChangeVariety.setCreateTime(new Date()); scChangeVariety.setCreateTime(new Date());
scChangeVariety.setCreateBy(SecurityUtils.getUsername()); scChangeVariety.setCreateBy(SecurityUtils.getUsername());
if (StringUtils.isBlank(scChangeVariety.getTechnician())) {
throw new RuntimeException("技术员不能为空");
}
if (scChangeVariety.getEventDate() == null) {
throw new RuntimeException("事件日期不能为空");
}
int rows = scChangeVarietyMapper.insertScChangeVariety(scChangeVariety); int rows = scChangeVarietyMapper.insertScChangeVariety(scChangeVariety);
if (rows <= 0) { if (rows <= 0) {
return rows; return rows;

View File

@ -87,7 +87,6 @@ public class ScTransGroupServiceImpl implements IScTransGroupService {
} }
} }
return rows; return rows;
// return scTransGroupMapper.insertScTransGroup(scTransGroup);
} }
/** /**

View File

@ -114,9 +114,9 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
Date now = DateUtils.getNowDate(); Date now = DateUtils.getNowDate();
for (ScTransitionInfo info : transitionInfoList) { for (ScTransitionInfo info : transitionInfoList) {
info.setCreateBy(username); // 设置创建人 info.setCreateBy(username);
info.setCreateTime(now); // 设置创建时间 info.setCreateTime(now);
info.setStatus(0); // 设置默认状态 info.setStatus(0);
} }
return scTransitionInfoMapper.insertScTransitionInfoBatch(transitionInfoList); return scTransitionInfoMapper.insertScTransitionInfoBatch(transitionInfoList);
} }
@ -127,12 +127,10 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int approveScTransitionInfo(ScTransitionInfo scTransitionInfo) { public int approveScTransitionInfo(ScTransitionInfo scTransitionInfo) {
// 1. 查询当前记录的原始状态
ScTransitionInfo existing = scTransitionInfoMapper.selectScTransitionInfoById(scTransitionInfo.getId()); ScTransitionInfo existing = scTransitionInfoMapper.selectScTransitionInfoById(scTransitionInfo.getId());
if (existing == null) { if (existing == null) {
throw new RuntimeException("转场记录不存在"); throw new RuntimeException("转场记录不存在");
} }
// 2. 校验状态仅允许审批待审批的记录
if (existing.getStatus() != 0) { if (existing.getStatus() != 0) {
throw new RuntimeException("该记录已完成审批,无法重复操作"); throw new RuntimeException("该记录已完成审批,无法重复操作");
} }

View File

@ -1,5 +1,6 @@
package com.zhyc.module.produce.other.domain; package com.zhyc.module.produce.other.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -64,7 +65,12 @@ public class ScCastrate extends BaseEntity {
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/**
* 事件日期
*/
@Excel(name = "事件日期", width = 15, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private String eventDate;
} }

View File

@ -1,5 +1,6 @@
package com.zhyc.module.produce.other.domain; package com.zhyc.module.produce.other.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -55,4 +56,10 @@ public class ScFixHoof extends BaseEntity
@Excel(name = "技术员") @Excel(name = "技术员")
private String technician; private String technician;
/**
* 事件日期新增字段
*/
@Excel(name = "事件日期", width = 15, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private String eventDate;
} }

View File

@ -111,6 +111,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where medi_usage = #{medi_usage} where medi_usage = #{medi_usage}
</select> </select>
<select id="selectSwMedicineUsageDetailsById" resultMap="SwMedicineUsageDetailsResult">
SELECT
smud.id,
smud.medi_usage,
smud.medi_id,
smud.dosage,
smud.usetime,
smud.manufacturer,
smud.batch_number,
sm.name AS name,
su.name AS usageId,
sunit.unit AS unit
FROM
sw_medicine_usage_details smud
JOIN sw_medicine sm ON smud.medi_id = sm.id
LEFT JOIN sw_usage su ON smud.usageId = su.id
LEFT JOIN sw_unit sunit ON smud.unit = sunit.id
WHERE
smud.medi_usage = #{id}
</select>
<insert id="insertSwMedicineUsage" parameterType="SwMedicineUsage" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSwMedicineUsage" parameterType="SwMedicineUsage" useGeneratedKeys="true" keyProperty="id">
insert into sw_medicine_usage insert into sw_medicine_usage
@ -173,10 +193,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from sw_medicine_usage_details where medi_usage = #{mediUsage} delete from sw_medicine_usage_details where medi_usage = #{mediUsage}
</delete> </delete>
<insert id="batchSwMedicineUsageDetails">
insert into sw_medicine_usage_details( id, medi_usage, medi_id, dosage, unit, usageId,usetime, manufacturer, batch_number) values <!-- 修改后的正确SQL -->
<foreach item="item" index="index" collection="list" separator=","> <insert id="batchSwMedicineUsageDetails" parameterType="java.util.List">
( #{item.id}, #{item.mediUsage}, #{item.mediId}, #{item.dosage}, #{item.unit}, #{item.usageId}, #{item.usetime},#{item.manufacturer}, #{item.batchNumber}) insert into sw_medicine_usage_details(id, medi_usage, medi_id, dosage, unit, usageId, usetime, manufacturer, batch_number)
values
<foreach collection="list" item="item" separator=",">
(#{item.id}, #{item.mediUsage}, #{item.mediId}, #{item.dosage},
#{item.unit}, #{item.usageId}, #{item.usetime},
#{item.manufacturer}, #{item.batchNumber})
</foreach> </foreach>
</insert> </insert>
</mapper> </mapper>

View File

@ -102,7 +102,30 @@
and sm.create_time between #{params.beginCreateTime} and #{params.endCreateTime} and sm.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if> </if>
</where> </where>
ORDER BY sm.create_time DESC <if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''">
ORDER BY
<choose>
<when test="orderBy == 'weaningWeight'">bs.weaning_weight</when>
<when test="orderBy == 'bodyLength'">sm.body_length</when>
<when test="orderBy == 'birthWeight'">bs.birth_weight</when>
<when test="orderBy == 'currentWeight'">bs.current_weight</when>
<when test="orderBy == 'lactationDay'">bs.lactation_day</when>
<when test="orderBy == 'gestationDay'">bs.gestation_day</when>
<when test="orderBy == 'postMatingDay'">post_mating_day</when>
<when test="orderBy == 'parity'">bs.parity</when>
<when test="orderBy == 'height'">sm.height</when>
<when test="orderBy == 'bust'">sm.bust</when>
<when test="orderBy == 'pipeLength'">sm.pipe_length</when>
<when test="orderBy == 'chestDepth'">sm.chest_depth</when>
<when test="orderBy == 'hipHeight'">sm.hip_height</when>
<when test="orderBy == 'rumpWidth'">sm.rump_width</when>
<when test="orderBy == 'rumpHeignt'">sm.rump_heignt</when>
<when test="orderBy == 'hipWidth'">sm.hip_width</when>
<when test="orderBy == 'hipCrossHeight'">sm.hip_cross_height</when>
<otherwise>${orderBy}</otherwise>
</choose>
${sortDirection}
</if>
</select> </select>
<select id="selectScBodyMeasureById" parameterType="Long" resultMap="ScBodyMeasureResult"> <select id="selectScBodyMeasureById" parameterType="Long" resultMap="ScBodyMeasureResult">

View File

@ -58,7 +58,12 @@
and bs.manage_tags like concat('%', #{manageTags}, '%') and bs.manage_tags like concat('%', #{manageTags}, '%')
</if> </if>
</where> </where>
ORDER BY sbs.create_time DESC <if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''">
ORDER BY sbs.${orderBy} ${sortDirection}
</if>
<if test="(orderBy == null or orderBy == '') or (sortDirection == null or sortDirection == '')">
ORDER BY sbs.create_time DESC
</if>
</select> </select>
<select id="selectScBodyScoreById" parameterType="Long" resultMap="ScBodyScoreResult"> <select id="selectScBodyScoreById" parameterType="Long" resultMap="ScBodyScoreResult">

View File

@ -56,7 +56,13 @@
and sbr.create_time between #{params.beginCreateTime} and #{params.endCreateTime} and sbr.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if> </if>
</where> </where>
ORDER BY sbr.create_time DESC <if test="orderBy != null and orderBy != '' and sortDirection != null and sortDirection != ''">
ORDER BY sbr.${orderBy} ${sortDirection}
</if>
<if test="(orderBy == null or orderBy == '') or (sortDirection == null or sortDirection == '')">
ORDER BY sbr.create_time DESC
</if>
</select> </select>
<select id="selectScBreastRatingById" parameterType="Long" resultMap="ScBreastRatingResult"> <select id="selectScBreastRatingById" parameterType="Long" resultMap="ScBreastRatingResult">

View File

@ -14,6 +14,8 @@
<result property="oldComment" column="old_comment"/> <result property="oldComment" column="old_comment"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="eventDate" column="event_date"/>
<result property="technician" column="technician"/>
</resultMap> </resultMap>
<sql id="selectScChangeCommentVo"> <sql id="selectScChangeCommentVo">
@ -25,7 +27,9 @@
scc.new_comment, scc.new_comment,
scc.old_comment, scc.old_comment,
scc.create_by, scc.create_by,
scc.create_time scc.create_time,
scc.event_date,
scc.technician
from sc_change_comment scc from sc_change_comment scc
left join bas_sheep bs on scc.sheep_id = bs.id left join bas_sheep bs on scc.sheep_id = bs.id
left join da_sheepfold sf on bs.sheepfold_id = sf.id left join da_sheepfold sf on bs.sheepfold_id = sf.id
@ -48,6 +52,10 @@
and params.endCreateTime != null and params.endCreateTime != ''"> and params.endCreateTime != null and params.endCreateTime != ''">
and scc.create_time between #{params.beginCreateTime} and #{params.endCreateTime} and scc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if> </if>
<if test="params.beginEventDate != null and params.beginEventDate != ''
and params.endEventDate != null and params.endEventDate != ''">
and scc.event_date between #{params.beginEventDate} and #{params.endEventDate}
</if>
</where> </where>
ORDER BY scc.create_time DESC ORDER BY scc.create_time DESC
</select> </select>
@ -65,6 +73,8 @@
<if test="oldComment != null and oldComment != ''">old_comment,</if> <if test="oldComment != null and oldComment != ''">old_comment,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="eventDate != null">event_date,</if>
<if test="technician != null and technician != ''">technician,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null and sheepId != ''">#{sheepId},</if> <if test="sheepId != null and sheepId != ''">#{sheepId},</if>
@ -72,6 +82,8 @@
<if test="oldComment != null and oldComment != ''">#{oldComment},</if> <if test="oldComment != null and oldComment != ''">#{oldComment},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="eventDate != null">#{eventDate},</if>
<if test="technician != null and technician != ''">#{technician},</if>
</trim> </trim>
</insert> </insert>

View File

@ -16,24 +16,28 @@
<result property="comment" column="comment"/> <result property="comment" column="comment"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="eventDate" column="event_date"/>
<result property="technician" column="technician"/>
</resultMap> </resultMap>
<sql id="selectScChangeEarVo"> <sql id="selectScChangeEarVo">
select sce.id as sce_id, select sce.id as sce_id,
sce.sheep_id, sce.sheep_id,
bs.manage_tags as manage_tags, bs.manage_tags as manage_tags,
sf.sheepfold_name as sheepfold_name, sf.sheepfold_name as sheepfold_name,
case case
when sce.ear_type = 0 then '改电子耳号' when sce.ear_type = 0 then '改电子耳号'
when sce.ear_type = 1 then '改管理耳号' when sce.ear_type = 1 then '改管理耳号'
else '' else ''
end as event_type, end as event_type,
sce.ear_type, sce.ear_type,
sce.newTag, sce.newTag,
sce.oldTag as oldTag, sce.oldTag as oldTag,
sce.comment, sce.comment,
sce.create_by, sce.create_by,
sce.create_time sce.create_time,
sce.event_date,
sce.technician
from sc_change_ear sce from sc_change_ear sce
LEFT JOIN bas_sheep bs ON sce.sheep_id = bs.id LEFT JOIN bas_sheep bs ON sce.sheep_id = bs.id
LEFT JOIN da_sheepfold sf ON bs.sheepfold_id = sf.id LEFT JOIN da_sheepfold sf ON bs.sheepfold_id = sf.id
@ -44,7 +48,11 @@
<where> <where>
<if test="sheepId != null">and sce.sheep_id = #{sheepId}</if> <if test="sheepId != null">and sce.sheep_id = #{sheepId}</if>
<if test="manageTags != null and manageTags != ''"> <if test="manageTags != null and manageTags != ''">
and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%') and (
bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%')
OR
bs.electronic_tags LIKE CONCAT('%', #{manageTags}, '%')
)
</if> </if>
<if test="sheepfoldId != null">and bs.sheepfold_id = #{sheepfoldId}</if> <if test="sheepfoldId != null">and bs.sheepfold_id = #{sheepfoldId}</if>
<if test="sheepfoldName != null and sheepfoldName != ''"> <if test="sheepfoldName != null and sheepfoldName != ''">
@ -60,6 +68,10 @@
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and sce.create_time between #{params.beginCreateTime} and #{params.endCreateTime} and sce.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if> </if>
<if test="params.beginEventDate != null and params.beginEventDate != ''
and params.endEventDate != null and params.endEventDate != ''">
and sce.event_date between #{params.beginEventDate} and #{params.endEventDate}
</if>
</where> </where>
ORDER BY sce.create_time DESC ORDER BY sce.create_time DESC
</select> </select>
@ -79,6 +91,8 @@
<if test="comment != null">comment,</if> <if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="eventDate != null">event_date,</if>
<if test="technician != null and technician != ''">technician,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if> <if test="sheepId != null">#{sheepId},</if>
@ -88,6 +102,8 @@
<if test="comment != null">#{comment},</if> <if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="eventDate != null">#{eventDate},</if>
<if test="technician != null and technician != ''">#{technician},</if>
</trim> </trim>
</insert> </insert>

View File

@ -15,6 +15,8 @@
<result property="comment" column="comment"/> <result property="comment" column="comment"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="technician" column="technician"/>
<result property="eventDate" column="event_date"/>
</resultMap> </resultMap>
<sql id="selectScChangeVarietyVo"> <sql id="selectScChangeVarietyVo">
@ -27,7 +29,9 @@
scv.variety_new, scv.variety_new,
scv.comment, scv.comment,
scv.create_by, scv.create_by,
scv.create_time scv.create_time,
scv.technician,
scv.event_date
from sc_change_variety scv from sc_change_variety scv
left join bas_sheep bs on scv.sheep_id = bs.id left join bas_sheep bs on scv.sheep_id = bs.id
left join da_sheepfold sf on bs.sheepfold_id = sf.id left join da_sheepfold sf on bs.sheepfold_id = sf.id
@ -51,6 +55,10 @@
and params.endCreateTime != null and params.endCreateTime != ''"> and params.endCreateTime != null and params.endCreateTime != ''">
and scv.create_time between #{params.beginCreateTime} and #{params.endCreateTime} and scv.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if> </if>
<if test="params.beginEventDate != null and params.beginEventDate != ''
and params.endEventDate != null and params.endEventDate != ''">
and scv.event_date between #{params.beginEventDate} and #{params.endEventDate}
</if>
</where> </where>
ORDER BY scv.create_time DESC ORDER BY scv.create_time DESC
</select> </select>
@ -69,6 +77,8 @@
<if test="comment != null">comment,</if> <if test="comment != null">comment,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="technician != null and technician != ''">technician,</if> <!-- 新增 -->
<if test="eventDate != null">event_date,</if> <!-- 新增 -->
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if> <if test="sheepId != null">#{sheepId},</if>
@ -77,6 +87,8 @@
<if test="comment != null">#{comment},</if> <if test="comment != null">#{comment},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="technician != null and technician != ''">#{technician},</if> <!-- 新增 -->
<if test="eventDate != null">#{eventDate},</if> <!-- 新增 -->
</trim> </trim>
</insert> </insert>

View File

@ -58,7 +58,7 @@
<if test="manageTags != null and manageTags != ''"> <if test="manageTags != null and manageTags != ''">
and s.manage_tags like concat('%', #{manageTags}, '%') and s.manage_tags like concat('%', #{manageTags}, '%')
</if> </if>
<if test="eventType != null">and tg.event_type = #{eventType}</if> <!-- <if test="eventType != null">and tg.event_type = #{eventType}</if>-->
<if test="params.beginTransDate != null and params.beginTransDate != '' and params.endTransDate != null and params.endTransDate != ''"> <if test="params.beginTransDate != null and params.beginTransDate != '' and params.endTransDate != null and params.endTransDate != ''">
and tg.trans_date between #{params.beginTransDate} and #{params.endTransDate} and tg.trans_date between #{params.beginTransDate} and #{params.endTransDate}
</if> </if>
@ -67,9 +67,9 @@
<if test="status != null">and status = #{status}</if> <if test="status != null">and status = #{status}</if>
<if test="varietyId != null">and tg.variety_id = #{varietyId}</if> <if test="varietyId != null">and tg.variety_id = #{varietyId}</if>
<if test="sheepTypeId != null">and st.id = #{sheepTypeId}</if> <if test="sheepTypeId != null">and st.id = #{sheepTypeId}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> <!-- <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">-->
and tg.create_time between #{params.beginCreateTime} and #{params.endCreateTime} <!-- and tg.create_time between #{params.beginCreateTime} and #{params.endCreateTime}-->
</if> <!-- </if>-->
</where> </where>
ORDER BY tg.create_time DESC ORDER BY tg.create_time DESC
</select> </select>

View File

@ -51,9 +51,9 @@
<if test="manageTags != null and manageTags != ''"> <if test="manageTags != null and manageTags != ''">
and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%') and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%')
</if> </if>
<if test="eventType != null and eventType != ''"> <!-- <if test="eventType != null and eventType != ''">-->
and t.event_type = #{eventType} <!-- and t.event_type = #{eventType}-->
</if> <!-- </if>-->
<if test="transType != null">and t.trans_type = #{transType}</if> <if test="transType != null">and t.trans_type = #{transType}</if>
<if test="params.beginTransitionDate != null and params.beginTransitionDate != '' <if test="params.beginTransitionDate != null and params.beginTransitionDate != ''
and params.endTransitionDate != null and params.endTransitionDate != ''"> and params.endTransitionDate != null and params.endTransitionDate != ''">
@ -63,9 +63,9 @@
<if test="transTo != null and transTo != ''">and trans_to = #{transTo}</if> <if test="transTo != null and transTo != ''">and trans_to = #{transTo}</if>
<if test="transFrom != null and transFrom != ''">and trans_from = #{transFrom}</if> <if test="transFrom != null and transFrom != ''">and trans_from = #{transFrom}</if>
<if test="status != null ">and status = #{status}</if> <if test="status != null ">and status = #{status}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> <!-- <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">-->
and t.create_time between #{params.beginCreateTime} and #{params.endCreateTime} <!-- and t.create_time between #{params.beginCreateTime} and #{params.endCreateTime}-->
</if> <!-- </if>-->
</where> </where>
ORDER BY t.create_time DESC ORDER BY t.create_time DESC
</select> </select>

View File

@ -17,6 +17,7 @@
<result property="technician" column="technician"/> <result property="technician" column="technician"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="eventDate" column="eventDate"/>
</resultMap> </resultMap>
<sql id="selectScCastrateVo"> <sql id="selectScCastrateVo">
@ -31,7 +32,8 @@
sc.comment, sc.comment,
sc.technician, sc.technician,
sc.create_by, sc.create_by,
sc.create_time sc.create_time,
sc.event_date as eventDate
from sc_castrate sc from sc_castrate sc
left join bas_sheep bs on sc.sheep_id = bs.id left join bas_sheep bs on sc.sheep_id = bs.id
left join da_sheepfold sf on bs.sheepfold_id = sf.id left join da_sheepfold sf on bs.sheepfold_id = sf.id
@ -51,6 +53,9 @@
<if test="params.beginCreateTime != null and params.endCreateTime != null"> <if test="params.beginCreateTime != null and params.endCreateTime != null">
and sc.create_time between #{params.beginCreateTime} and #{params.endCreateTime} and sc.create_time between #{params.beginCreateTime} and #{params.endCreateTime}
</if> </if>
<if test="params.beginEventDate != null and params.endEventDate != null">
and sc.event_date between #{params.beginEventDate} and #{params.endEventDate}
</if>
</where> </where>
ORDER BY sc.create_time DESC ORDER BY sc.create_time DESC
</select> </select>
@ -70,6 +75,7 @@
<if test="technician != null">technician,</if> <if test="technician != null">technician,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="eventDate != null">event_date,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sheepId != null">#{sheepId},</if> <if test="sheepId != null">#{sheepId},</if>
@ -79,6 +85,7 @@
<if test="technician != null">#{technician},</if> <if test="technician != null">#{technician},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="eventDate != null">#{eventDate},</if>
</trim> </trim>
</insert> </insert>

View File

@ -15,6 +15,7 @@
<result property="technician" column="technician"/> <result property="technician" column="technician"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="eventDate" column="eventDate"/>
</resultMap> </resultMap>
<sql id="selectScFixHoofVo"> <sql id="selectScFixHoofVo">
@ -28,7 +29,8 @@
fh.comment, fh.comment,
fh.technician, fh.technician,
fh.create_by, fh.create_by,
fh.create_time fh.create_time,
fh.event_date as eventDate
from sc_fix_hoof fh from sc_fix_hoof fh
left join bas_sheep bs on fh.sheep_id = bs.id left join bas_sheep bs on fh.sheep_id = bs.id
left join da_sheepfold sf on bs.sheepfold_id = sf.id left join da_sheepfold sf on bs.sheepfold_id = sf.id
@ -47,6 +49,10 @@
<if test="manageTags != null and manageTags != ''"> <if test="manageTags != null and manageTags != ''">
and bs.manage_tags like concat('%', #{manageTags}, '%') and bs.manage_tags like concat('%', #{manageTags}, '%')
</if> </if>
<if test="params.beginEventDate != null and params.beginEventDate != ''
and params.endEventDate != null and params.endEventDate != ''">
and fh.event_date between #{params.beginEventDate} and #{params.endEventDate}
</if>
</where> </where>
ORDER BY fh.create_time DESC ORDER BY fh.create_time DESC
</select> </select>
@ -64,6 +70,7 @@
variety_id, variety_id,
<if test="comment != null">comment,</if> <if test="comment != null">comment,</if>
<if test="technician != null and technician != ''">technician,</if> <if test="technician != null and technician != ''">technician,</if>
<if test="eventDate != null and eventDate != ''">event_date,</if>
create_by, create_by,
create_time) create_time)
VALUES VALUES
@ -72,6 +79,7 @@
<if test="varietyId != null">#{varietyId},</if> <if test="varietyId != null">#{varietyId},</if>
<if test="comment != null">#{comment},</if> <if test="comment != null">#{comment},</if>
<if test="technician != null and technician != ''">#{technician},</if> <if test="technician != null and technician != ''">#{technician},</if>
<if test="eventDate != null and eventDate != ''">#{eventDate},</if>
#{createBy}, #{createBy},
#{createTime}) #{createTime})
</insert> </insert>