From a4bc0c1724c8f9618fd62d284925e7a885da174a Mon Sep 17 00:00:00 2001 From: zyh <2066096076@qq.com> Date: Tue, 19 Aug 2025 17:07:16 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E9=83=A8=E5=88=86bug=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E5=88=9B=E5=BB=BA=E6=97=A5=E6=9C=9F=E7=B2=BE=E7=A1=AE?= =?UTF-8?q?=E5=88=B0=E5=87=A0=E7=82=B9=E5=87=A0=E5=88=86=EF=BC=8C=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E6=94=BE=E6=9C=80=E5=89=8D=E9=9D=A2=EF=BC=8C=E8=BD=AC?= =?UTF-8?q?=E5=9C=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ScAddSheepController.java | 15 ++++++-- .../ScTransitionInfoController.java | 3 ++ .../manage_sheep/domain/ScAddSheep.java | 5 +++ .../manage_sheep/domain/ScChangeComment.java | 14 +++++++- .../manage_sheep/domain/ScChangeEar.java | 9 +++++ .../manage_sheep/domain/ScChangeVariety.java | 16 ++++++--- .../manage_sheep/domain/ScTransGroup.java | 24 +++++++++---- .../manage_sheep/domain/ScTransitionInfo.java | 34 +++++++++++++------ .../mapper/ScTransitionInfoMapper.java | 17 +++++----- .../service/IScTransitionInfoService.java | 1 + .../service/impl/ScAddSheepServiceImpl.java | 31 +++++++++++++---- .../service/impl/ScTransGroupServiceImpl.java | 17 ++++++++++ .../impl/ScTransitionInfoServiceImpl.java | 19 ++++++++++- .../produce/other/domain/ScCastrate.java | 6 ++++ .../produce/other/domain/ScFixHoof.java | 7 +++- .../resources/mapper/base/BasSheepMapper.xml | 2 +- .../produce/manage_sheep/ScAddSheepMapper.xml | 14 ++++++-- .../manage_sheep/ScChangeCommentMapper.xml | 8 ++++- .../manage_sheep/ScChangeEarMapper.xml | 13 +++++++ .../manage_sheep/ScChangeVarietyMapper.xml | 8 ++++- .../manage_sheep/ScTransGroupMapper.xml | 17 +++++++++- .../manage_sheep/ScTransitionInfoMapper.xml | 33 ++++++++++++++---- .../mapper/produce/other/ScCastrateMapper.xml | 4 ++- .../mapper/produce/other/ScFixHoofMapper.xml | 4 ++- 24 files changed, 265 insertions(+), 56 deletions(-) diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScAddSheepController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScAddSheepController.java index 6d2f7f9..5721eee 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScAddSheepController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScAddSheepController.java @@ -5,7 +5,9 @@ import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.common.enums.BusinessType; import com.zhyc.common.exception.ServiceException; import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.module.base.domain.BasSheepType; import com.zhyc.module.base.domain.BasSheepVariety; +import com.zhyc.module.base.service.IBasSheepTypeService; import com.zhyc.module.base.service.IBasSheepVarietyService; import com.zhyc.module.produce.manage_sheep.domain.ScAddSheep; import com.zhyc.module.produce.manage_sheep.service.IScAddSheepService; @@ -36,6 +38,8 @@ public class ScAddSheepController { private IDaSheepfoldService daSheepfoldMapper; @Autowired private IBasSheepVarietyService basSheepVarietyMapper; + @Autowired + private IBasSheepTypeService basSheepTypeService; //新增羊只验证 @PreAuthorize("@ss.hasPermi('produce:add_sheep:add')") @Log(title = "新增", businessType = BusinessType.INSERT) @@ -79,8 +83,7 @@ public class ScAddSheepController { public void exportForm(HttpServletResponse response, @RequestBody ScAddSheep scAddSheep) throws IOException { ExcelUtil util = new ExcelUtil<>(ScAddSheep.class); List list = new ArrayList<>(); - - // 处理羊舍名称(原有逻辑) + // 处理羊舍名称 if (scAddSheep.getSheepfold() != null) { DaSheepfold fold = daSheepfoldMapper.selectDaSheepfoldById(scAddSheep.getSheepfold().longValue()); if (fold != null) { @@ -88,6 +91,7 @@ public class ScAddSheepController { } } + //处理羊只品种名称 if (scAddSheep.getVarietyId() != null) { BasSheepVariety variety = basSheepVarietyMapper.selectBasSheepVarietyById(scAddSheep.getVarietyId().longValue()); if (variety != null) { @@ -95,6 +99,13 @@ public class ScAddSheepController { } } + //处理羊只类型名称 + if (scAddSheep.getTypeId() != null) { + BasSheepType sheepType = basSheepTypeService.selectBasSheepTypeById(scAddSheep.getTypeId().intValue()); + if (sheepType != null) { + scAddSheep.setTypeName(sheepType.getName()); + } + } list.add(scAddSheep); util.exportExcel(response, list, "羊只信息"); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScTransitionInfoController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScTransitionInfoController.java index f41c044..6307706 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScTransitionInfoController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScTransitionInfoController.java @@ -110,6 +110,9 @@ public class ScTransitionInfoController extends BaseController { @PutMapping("/approve") public AjaxResult approveScTransitionInfo(@RequestBody ScTransitionInfo scTransitionInfo) { + if ("转场转入".equals(scTransitionInfo.getEventType()) && scTransitionInfo.getSheepfoldId() == null) { + return AjaxResult.error("转场转入时,接收羊舍ID不能为空"); + } int rows = scTransitionInfoService.approveScTransitionInfo(scTransitionInfo); return toAjax(rows); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScAddSheep.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScAddSheep.java index 7bdf7ad..310cd52 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScAddSheep.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScAddSheep.java @@ -68,6 +68,11 @@ public class ScAddSheep extends BaseEntity { @Excel(name = "品种") private String varietyName; + /** 羊只类别 */ + private Long typeId; + @Excel(name = "羊只类型") + private String typeName; + /** 入群日期 */ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @Excel(name = "入群日期", dateFormat = "yyyy-MM-dd") diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScChangeComment.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScChangeComment.java index 2243411..2a513be 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScChangeComment.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScChangeComment.java @@ -29,8 +29,20 @@ public class ScChangeComment extends BaseEntity { * 羊只id */ private String sheepId; - @Excel(name = "管理耳号") + private String manageTags; + + /** 羊舍 */ + private Long sheepfoldId; + @Excel(name = "羊舍") + private String sheepfoldName; + + /** + * 事件类型 + */ + @Excel(name = "事件类型") + private String eventType; + /** * 新备注 */ diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScChangeEar.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScChangeEar.java index f2ef13f..47eec0a 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScChangeEar.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScChangeEar.java @@ -30,6 +30,15 @@ public class ScChangeEar extends BaseEntity @Excel(name = "管理耳号") private String manageTags; + /** 羊舍 */ + private Long sheepfoldId; + @Excel(name = "羊舍") + private String sheepfoldName; + + /** 事件类型(改管理耳号/改电子耳号) */ + @Excel(name = "事件类型") + private String eventType; + /** 选择更改耳号类型(0电子耳号1管理耳号) */ @Excel(name = "耳号类型", readConverterExp = "0=电子耳号,1=管理耳号") private Integer earType; diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScChangeVariety.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScChangeVariety.java index 5f5e8ee..ce4f52a 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScChangeVariety.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScChangeVariety.java @@ -31,6 +31,17 @@ public class ScChangeVariety extends BaseEntity @Excel(name = "耳号") private String manageTags; + /** 羊舍 */ + private Long sheepfoldId; + @Excel(name = "羊舍") + private String sheepfoldName; + + /** + * 事件类型 + */ + @Excel(name = "事件类型") + private String eventType; + /** 原品种 */ @Excel(name = "原品种") private String varietyOld; @@ -43,10 +54,5 @@ public class ScChangeVariety extends BaseEntity @Excel(name = "备注") private String comment; - /** 创建日期 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd") - private Date createTime; - } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScTransGroup.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScTransGroup.java index ba62557..8568e8a 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScTransGroup.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScTransGroup.java @@ -33,6 +33,14 @@ public class ScTransGroup extends BaseEntity { @Excel(name = "耳号") private String manageTags; + + /** + * 事件类型(1-围产转群,2-普通转群,3-育肥转群,4-预售转群) + */ + private Integer eventType; + @Excel(name = "事件类型") + private String eventTypeText; + /** * 转入羊舍 */ @@ -43,18 +51,19 @@ public class ScTransGroup extends BaseEntity { */ private String foldFrom; + /** + * 羊只类型 + */ + private Integer sheepTypeId; + @Excel(name = "羊只类型") + private String sheepTypeName; + /** * 转出羊舍名称 */ @Excel(name = "转出羊舍") private String foldFromName; - /** - * 羊只类型ID - */ - private Integer sheepTypeId; - // 羊只类型名称 - private String sheepTypeName; /** * 转入羊舍名称 */ @@ -80,6 +89,9 @@ public class ScTransGroup extends BaseEntity { @Excel(name = "转群原因") private String reasonText; + /** 转群日期 */ + @Excel(name = "转群日期") + private String transDate; /** * 技术员 */ diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScTransitionInfo.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScTransitionInfo.java index 554bf4d..eaeec95 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScTransitionInfo.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScTransitionInfo.java @@ -8,6 +8,8 @@ import org.apache.commons.lang3.builder.ToStringStyle; import com.zhyc.common.annotation.Excel; import com.zhyc.common.core.domain.BaseEntity; +import java.time.LocalDate; + /** * 转场对象 sc_transition_info * @@ -29,9 +31,27 @@ public class ScTransitionInfo extends BaseEntity { * 羊只id */ private Integer sheepId; - @Excel(name = "耳号") private String manageTags; + + /** + * 事件类型 + */ + @Excel(name = "事件类型") + private String eventType; + + + /** + * 转场类型 + */ + private Integer transType; + @Excel(name = "转场类型") + private String transTypeText; + + /** 转场日期 */ + @Excel(name = "转场日期") + private LocalDate transitionDate; + /** * 品种id */ @@ -56,16 +76,9 @@ public class ScTransitionInfo extends BaseEntity { private String transFrom; /** - * 转场类型 + * 接收羊舍 */ - private Integer transType; - - /** - * 转场类型名称 只用于导出 - */ - @Excel(name = "转场类型") - private String transTypeText; - + private Long sheepfoldId; /** * 技术员 */ @@ -78,6 +91,7 @@ public class ScTransitionInfo extends BaseEntity { private Integer status; @Excel(name = "状态") private String statusText; + /** * 备注 */ diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScTransitionInfoMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScTransitionInfoMapper.java index a095246..ce67176 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScTransitionInfoMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScTransitionInfoMapper.java @@ -7,15 +7,15 @@ import org.apache.ibatis.annotations.Param; /** * 转场Mapper接口 - * + * * @author ruoyi * @date 2025-07-10 */ -public interface ScTransitionInfoMapper +public interface ScTransitionInfoMapper { /** * 查询转场 - * + * * @param id 转场主键 * @return 转场 */ @@ -23,7 +23,7 @@ public interface ScTransitionInfoMapper /** * 查询转场列表 - * + * * @param scTransitionInfo 转场 * @return 转场集合 */ @@ -31,7 +31,7 @@ public interface ScTransitionInfoMapper /** * 新增转场 - * + * * @param scTransitionInfo 转场 * @return 结果 */ @@ -39,7 +39,7 @@ public interface ScTransitionInfoMapper /** * 修改转场 - * + * * @param scTransitionInfo 转场 * @return 结果 */ @@ -47,7 +47,7 @@ public interface ScTransitionInfoMapper /** * 删除转场 - * + * * @param id 转场主键 * @return 结果 */ @@ -55,7 +55,7 @@ public interface ScTransitionInfoMapper /** * 批量删除转场 - * + * * @param ids 需要删除的数据主键集合 * @return 结果 */ @@ -63,4 +63,5 @@ public interface ScTransitionInfoMapper //批量转场 int insertScTransitionInfoBatch(@Param("list") List transitionInfoList); + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScTransitionInfoService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScTransitionInfoService.java index b578491..c9cb5c5 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScTransitionInfoService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScTransitionInfoService.java @@ -70,4 +70,5 @@ public interface IScTransitionInfoService { //审批转场 public int approveScTransitionInfo(ScTransitionInfo scTransitionInfo); + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScAddSheepServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScAddSheepServiceImpl.java index b6ed6b4..e2819ee 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScAddSheepServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScAddSheepServiceImpl.java @@ -2,7 +2,9 @@ package com.zhyc.module.produce.manage_sheep.service.impl; import com.zhyc.common.exception.ServiceException; import com.zhyc.common.utils.StringUtils; +import com.zhyc.module.base.domain.BasSheepType; import com.zhyc.module.base.mapper.BasSheepVarietyMapper; +import com.zhyc.module.base.service.IBasSheepTypeService; import com.zhyc.module.produce.manage_sheep.domain.ScAddSheep; import com.zhyc.module.produce.manage_sheep.mapper.ScAddSheepMapper; import com.zhyc.module.produce.manage_sheep.service.IScAddSheepService; @@ -32,6 +34,8 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { @Autowired private BasSheepVarietyMapper basSheepVarietyMapper; + @Autowired + private IBasSheepTypeService basSheepTypeService; //新增 @Override @Transactional(rollbackFor = Exception.class) @@ -64,7 +68,10 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { bs.setComment(scAddSheep.getComment()); bs.setCreateBy(scAddSheep.getCreateBy()); bs.setCreateTime(new Date()); - + if (scAddSheep.getTypeId() != null) { + bs.setTypeId(scAddSheep.getTypeId().longValue()); + } + bs.setStatusId(1L); basSheepService.insertBasSheep(bs); return true; } @@ -101,7 +108,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { for (int i = 0; i < list.size(); i++) { ScAddSheep sheep = list.get(i); try { - // 处理品种名称转换为品种ID if (StringUtils.isNotBlank(sheep.getVarietyName())) { Long varietyId = basSheepVarietyMapper.selectIdByName(sheep.getVarietyName()); if (varietyId == null) { @@ -122,7 +128,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { continue; } - // 处理羊舍名称转换为羊舍ID if (StringUtils.isNotBlank(sheep.getSheepfoldNameExcel())) { DaSheepfold param = new DaSheepfold(); param.setSheepfoldName(sheep.getSheepfoldNameExcel()); @@ -139,7 +144,23 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { sheep.setSheepfold(foldList.get(0).getId().intValue()); } - // 校验耳号是否为空 + if (StringUtils.isNotBlank(sheep.getTypeName())) { + BasSheepType typeQuery = new BasSheepType(); + typeQuery.setName(sheep.getTypeName().trim()); + List typeList = basSheepTypeService.selectBasSheepTypeList(typeQuery); + + if (typeList == null || typeList.isEmpty()) { + failure++; + failureMsg.append("
第") + .append(i + 1) + .append("行:羊只类型名称不存在【") + .append(sheep.getTypeName()) + .append("】"); + continue; + } + sheep.setTypeId(typeList.get(0).getId().longValue()); + } + if (StringUtils.isBlank(sheep.getEarNumber())) { failure++; failureMsg.append("
第") @@ -148,7 +169,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { continue; } - // 核心校验:判断羊只基本信息表中是否存在未删除的同名耳号 BasSheep existSheep = basSheepService.selectBasSheepByManageTags(sheep.getEarNumber().trim()); if (existSheep != null) { failure++; @@ -160,7 +180,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { continue; } - // 执行导入(新增或更新) if (updateSupport && sheep.getId() != null) { sheep.setUpdateBy(operName); updateScAddSheep(sheep); diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransGroupServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransGroupServiceImpl.java index 3604f92..e52185e 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransGroupServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransGroupServiceImpl.java @@ -31,6 +31,7 @@ public class ScTransGroupServiceImpl implements IScTransGroupService { private BasSheepMapper basSheepMapper; @Autowired private IBasSheepService basSheepService; + /** * 查询转群记录 * @@ -42,6 +43,7 @@ public class ScTransGroupServiceImpl implements IScTransGroupService { ScTransGroup group = scTransGroupMapper.selectScTransGroupById(id); group.setReasonText(convertReason(group.getReason())); group.setStatusText(convertStatus(group.getStatus())); + group.setEventTypeText(convertEventType(group.getEventType())); return group; } @@ -58,6 +60,7 @@ public class ScTransGroupServiceImpl implements IScTransGroupService { list.forEach(group -> { group.setReasonText(convertReason(group.getReason())); group.setStatusText(convertStatus(group.getStatus())); + group.setEventTypeText(convertEventType(group.getEventType())); }); return list; } @@ -177,4 +180,18 @@ public class ScTransGroupServiceImpl implements IScTransGroupService { return statusMap.getOrDefault(statusCode, "未知状态"); } + /** + * 转换事件类型(1-围产转群,2-普通转群,3-育肥转群,4-预售转群) + */ + private String convertEventType(Integer eventType) { + if (eventType == null) { + return "未知"; + } + Map eventTypeMap = new HashMap<>(); + eventTypeMap.put(1, "围产转群"); + eventTypeMap.put(2, "普通转群"); + eventTypeMap.put(3, "育肥转群"); + eventTypeMap.put(4, "预售转群"); + return eventTypeMap.getOrDefault(eventType, "未知"); + } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransitionInfoServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransitionInfoServiceImpl.java index cd8a96b..d5df328 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransitionInfoServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScTransitionInfoServiceImpl.java @@ -128,8 +128,16 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService @Override @Transactional(rollbackFor = Exception.class) public int approveScTransitionInfo(ScTransitionInfo scTransitionInfo) { + // 1. 查询当前记录的原始状态 + ScTransitionInfo existing = scTransitionInfoMapper.selectScTransitionInfoById(scTransitionInfo.getId()); + if (existing == null) { + throw new RuntimeException("转场记录不存在"); + } + // 2. 校验状态:仅允许审批“待审批”的记录 + if (existing.getStatus() != 0) { + throw new RuntimeException("该记录已完成审批,无法重复操作"); + } int rows = scTransitionInfoMapper.updateScTransitionInfo(scTransitionInfo); - if (rows > 0 && scTransitionInfo.getStatus() == 1) { updateSheepRanch(scTransitionInfo); } @@ -158,6 +166,12 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService } Long targetRanchId = matchedRanch.get().getId(); + //获取接收羊舍 + Long targetSheepfoldId = transitionInfo.getSheepfoldId(); + if ("转场转入".equals(transitionInfo.getEventType()) && targetSheepfoldId == null) { + throw new RuntimeException("转场转入时,接收羊舍不能为空"); + } + String manageTags = transitionInfo.getManageTags(); if (StringUtils.isBlank(manageTags)) { throw new RuntimeException("耳号不能为空"); @@ -173,6 +187,9 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService BasSheep updateSheep = new BasSheep(); updateSheep.setId(sheep.getId()); updateSheep.setRanchId(targetRanchId); + if ("转场转入".equals(transitionInfo.getEventType())) { + updateSheep.setSheepfoldId(targetSheepfoldId); + } basSheepMapper.updateBasSheep(updateSheep); } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/domain/ScCastrate.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/domain/ScCastrate.java index 1ebab6d..be6afda 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/domain/ScCastrate.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/domain/ScCastrate.java @@ -33,6 +33,12 @@ public class ScCastrate extends BaseEntity { @Excel(name = "耳号") private String manageTags; + /** + * 事件类型 + */ + @Excel(name = "事件类型") + private String eventType; + /** * 羊舍id */ diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/domain/ScFixHoof.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/domain/ScFixHoof.java index 60a92a8..9adbc9c 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/domain/ScFixHoof.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/domain/ScFixHoof.java @@ -26,10 +26,15 @@ public class ScFixHoof extends BaseEntity /** 羊只id */ private Integer sheepId; - /** 管理耳号(仅用于接收参数/返回视图) */ @Excel(name = "管理耳号") private String manageTags; + /** + * 事件类型 + */ + @Excel(name = "事件类型") + private String eventType; + /** 羊舍id */ private Integer sheepfold; diff --git a/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml b/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml index f42546a..a035e60 100644 --- a/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml +++ b/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml @@ -328,7 +328,7 @@ SELECT COUNT(*) FROM bas_sheep WHERE manage_tags = #{tag} - AND s.is_delete = 0 + AND is_delete = 0 @@ -55,10 +62,10 @@ INSERT INTO sc_add_sheep (ear_number, sheepfold, father, mother, born_weight, birthday, - gender, parity, variety_id, join_date, comment, technician, + gender, parity, variety_id, type_id, join_date, comment, technician, create_by, create_time) VALUES (#{earNumber}, #{sheepfold}, #{father}, #{mother}, #{bornWeight}, - #{birthday}, #{gender}, #{parity}, #{varietyId}, #{joinDate}, + #{birthday}, #{gender}, #{parity}, #{varietyId}, #{typeId}, #{joinDate}, #{comment}, #{technician}, #{createBy}, #{createTime}) @@ -74,6 +81,7 @@ gender = #{gender}, parity = #{parity}, variety_id = #{varietyId}, + type_id = #{typeId}, join_date = #{joinDate}, comment = #{comment}, technician = #{technician}, diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeCommentMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeCommentMapper.xml index df4eaa6..e931054 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeCommentMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeCommentMapper.xml @@ -8,6 +8,8 @@ + + @@ -17,13 +19,16 @@ select scc.id, scc.sheep_id, - bs.manage_tags as manage_tags, + bs.manage_tags as manage_tags, + sf.sheepfold_name as sheepfold_name, + '改备注' as event_type, scc.new_comment, scc.old_comment, scc.create_by, scc.create_time from sc_change_comment scc left join bas_sheep bs on scc.sheep_id = bs.id + left join da_sheepfold sf on bs.sheepfold_id = sf.id @@ -37,6 +46,10 @@ and bs.manage_tags LIKE CONCAT('%', #{manageTags}, '%') + and bs.sheepfold_id = #{sheepfoldId} + + and sf.sheepfold_name LIKE CONCAT('%', #{sheepfoldName}, '%') + and sce.ear_type = #{earType} and sce.newTag LIKE CONCAT('%', #{newTag}, '%') diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeVarietyMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeVarietyMapper.xml index 77cf67f..680ce6d 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeVarietyMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeVarietyMapper.xml @@ -8,6 +8,8 @@ + + @@ -18,7 +20,9 @@ select scv.id, scv.sheep_id, - bs.manage_tags as manage_tags, + bs.manage_tags as manage_tags, + sf.sheepfold_name as sheepfold_name, + '改品种' as event_type, scv.variety_old, scv.variety_new, scv.comment, @@ -26,6 +30,7 @@ scv.create_time from sc_change_variety scv left join bas_sheep bs on scv.sheep_id = bs.id + left join da_sheepfold sf on bs.sheepfold_id = sf.id + + + and formula_id = #{formulaId} + and zookeeper = #{zookeeper} + and deploy_date = #{deployDate} + + + + + + + insert into sg_feed_list + + formula_id, + formula_batch_id, + zookeeper, + deploy_date, + + + #{formulaId}, + #{formulaBatchId}, + #{zookeeper}, + #{deployDate}, + + + + + update sg_feed_list + + formula_id = #{formulaId}, + formula_batch_id = #{formulaBatchId}, + zookeeper = #{zookeeper}, + deploy_date = #{deployDate}, + + where id = #{id} + + + + delete from sg_feed_list where id = #{id} + + + + delete from sg_feed_list where id in + + #{id} + + + \ No newline at end of file From 6c67094c0d0852a2e3a579260c3d5152001bfe4e Mon Sep 17 00:00:00 2001 From: HashMap Date: Wed, 20 Aug 2025 12:38:20 +0800 Subject: [PATCH 4/5] =?UTF-8?q?perf(module=20feed/FeedList):=20=E4=B8=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=90=8C=E6=AD=A5=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在配料清单部分增加了缓存机制: 所有对数据库的请求通过Map缓存 仅当配方管理出现修改 || 饲喂计划出现增删改操作时通过标志位通知配料清单表下一次请求刷新缓存 减少对数据库的重复请求操作 --- .../feed/controller/SgFeedListController.java | 35 ++++++++++++++----- .../feed/controller/SgFeedPlanController.java | 9 +++-- .../SgFormulaManagementController.java | 6 ++++ 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFeedListController.java b/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFeedListController.java index f806ea9..446327d 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFeedListController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFeedListController.java @@ -10,6 +10,7 @@ import com.zhyc.module.feed.domain.SgFeedPlan; import com.zhyc.module.feed.domain.SgFormulaManagement; import com.zhyc.module.feed.service.ISgFeedPlanService; import com.zhyc.module.feed.service.ISgFormulaManagementService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.GetMapping; @@ -46,6 +47,9 @@ public class SgFeedListController extends BaseController { private final Map sgFeedListMap = new HashMap<>(); + public static boolean refresh = true; + + @Autowired public SgFeedListController(ISgFeedListService sgFeedListService, ISgFormulaManagementService sgFormulaManagementService, ISgFeedPlanService sgFeedPlanService) { this.sgFeedListService = sgFeedListService; this.sgFormulaManagementService = sgFormulaManagementService; @@ -59,7 +63,14 @@ public class SgFeedListController extends BaseController { @GetMapping("/list") @Transactional(rollbackFor = Exception.class) public TableDataInfo list(SgFeedList sgFeedList) { - SyncFeedList(); + /* + 刷新缓存 + 当配方管理表出现更新 或 饲喂计划表出现增删改时会将refresh置为true 通知此处进行刷新 + */ + if (refresh) { + SyncFeedList(); + refresh = false; + } startPage(); List list = sgFeedListService.selectSgFeedListList(sgFeedList); // 用 map 中已有的数据替换 list 中的元素 @@ -164,17 +175,20 @@ public class SgFeedListController extends BaseController { rootPlanQuery.setFormulaId(sgFormulaManagement.getFormulaId()); rootPlanQuery.setBatchId(sgFormulaManagement.getBatchId()); List sgFeedPlans = sgFeedPlanService.selectSgFeedPlanList(rootPlanQuery); - // 为空则标识当前配方不在饲喂计划中 + // 为空则标识当前配方不在饲喂计划中 && 不在缓存中设置 if (sgFeedPlans.isEmpty()) { isPlan = false; - } - // rootPlan中存储的是该配方批号的总量 - SgFeedPlan rootPlan = computePlanTotal(sgFeedPlans); + } else { + // rootPlan中存储的是该配方批号的总量 + SgFeedPlan rootPlan = computePlanTotal(sgFeedPlans); + + // 将计划实体对象设置到配料清单中 + sgFeedList.setRootPlan(rootPlan); + + // 完整的配料清单对象加入缓存 + sgFeedListMap.put(sgFormulaManagement.getFormulaId() + "_" + sgFormulaManagement.getBatchId(), sgFeedList); + } - // 将计划实体对象设置到配料清单中 - sgFeedList.setRootPlan(rootPlan); - // 完整的配料清单对象加入缓存 - sgFeedListMap.put(sgFormulaManagement.getFormulaId() + "_" + sgFormulaManagement.getBatchId(), sgFeedList); // 不存在则插入 if (!isExist && isPlan) { sgFeedListService.insertSgFeedList(sgFeedList); @@ -213,6 +227,9 @@ public class SgFeedListController extends BaseController { rootPlan.setPlanNoonSize(planFeedNoonSize); rootPlan.setPlanAfternoonSize(planFeedAfternoonSize); rootPlan.setPlanFeedTotal(planFeedTotalSize); + + // 设置计划日期 + rootPlan.setPlanDate(sgFeedPlans.get(0).getPlanDate()); } return rootPlan; } diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFeedPlanController.java b/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFeedPlanController.java index 4661361..39bde43 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFeedPlanController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFeedPlanController.java @@ -82,6 +82,8 @@ public class SgFeedPlanController extends BaseController { sgFeedPlan.setCreateDate(new Date()); // 计算其他字段值 setPlan(sgFeedPlan); + // 通知配料清单刷新数据 + SgFeedListController.refresh = true; return toAjax(sgFeedPlanService.insertSgFeedPlan(sgFeedPlan)); } @@ -94,6 +96,8 @@ public class SgFeedPlanController extends BaseController { public AjaxResult edit(@RequestBody SgFeedPlan sgFeedPlan) { // 根据修改后的值重新计算 setPlan(sgFeedPlan); + // 通知配料清单刷新数据 + SgFeedListController.refresh = true; return toAjax(sgFeedPlanService.updateSgFeedPlan(sgFeedPlan)); } @@ -104,6 +108,8 @@ public class SgFeedPlanController extends BaseController { @Log(title = "饲喂计划", businessType = BusinessType.DELETE) @DeleteMapping("/{createDates}") public AjaxResult remove(@PathVariable Date[] createDates) { + // 通知配料清单刷新数据 + SgFeedListController.refresh = true; return toAjax(sgFeedPlanService.deleteSgFeedPlanByCreateDates(createDates)); } @@ -111,7 +117,7 @@ public class SgFeedPlanController extends BaseController { * 设定计划值 * 用于添加和修改 */ - private SgFeedPlan setPlan(SgFeedPlan sgFeedPlan) { + private void setPlan(SgFeedPlan sgFeedPlan) { // 根据羊舍ID获取羊只数量 int countByFoldId = sgFeedPlanService.getSheepCountByFoldId(sgFeedPlan.getSheepHouseId()); sgFeedPlan.setSheepCount(countByFoldId); @@ -121,6 +127,5 @@ public class SgFeedPlanController extends BaseController { sgFeedPlan.setPlanMorningSize(sgFeedPlan.getPlanFeedTotal() * (sgFeedPlan.getRatioMorning() / 100)); sgFeedPlan.setPlanNoonSize(sgFeedPlan.getPlanFeedTotal() * (sgFeedPlan.getRatioNoon() / 100)); sgFeedPlan.setPlanAfternoonSize(sgFeedPlan.getPlanFeedTotal() * (sgFeedPlan.getRatioAfternoon() / 100)); - return sgFeedPlan; } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFormulaManagementController.java b/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFormulaManagementController.java index 3f33ae2..9284c7a 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFormulaManagementController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/feed/controller/SgFormulaManagementController.java @@ -143,6 +143,9 @@ public class SgFormulaManagementController extends BaseController { sgFormulaListItem.setFormulaId(sgFormulaManagement.getFormulaId()); sgFormulaListService.insertSgFormulaList(sgFormulaListItem); } + + // 通知配料清单刷新数据 + SgFeedListController.refresh = true; return toAjax(sgFormulaManagementService.updateSgFormulaManagement(sgFormulaManagement)); } @@ -167,6 +170,9 @@ public class SgFormulaManagementController extends BaseController { } // 前置检查完毕 执行删除 sgFormulaManagement.setBatchId(batchId); + + // 通知配料清单刷新数据 + SgFeedListController.refresh = true; return toAjax(sgFormulaManagementService.deleteSgFormulaManagement(sgFormulaManagement)); } } From a1972a86eb60837d9744439df225893132b750fe Mon Sep 17 00:00:00 2001 From: zyh <2066096076@qq.com> Date: Wed, 20 Aug 2025 13:15:17 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BE=8A=E5=8F=AA?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ScAddSheepController.java | 17 +++++++++++++ .../manage_sheep/domain/ScAddSheep.java | 5 ++++ .../service/impl/ScAddSheepServiceImpl.java | 24 +++++++++++++++++++ .../produce/manage_sheep/ScAddSheepMapper.xml | 13 +++++----- 4 files changed, 53 insertions(+), 6 deletions(-) diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScAddSheepController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScAddSheepController.java index 5721eee..4f56d3b 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScAddSheepController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScAddSheepController.java @@ -7,8 +7,10 @@ import com.zhyc.common.exception.ServiceException; import com.zhyc.common.utils.poi.ExcelUtil; import com.zhyc.module.base.domain.BasSheepType; import com.zhyc.module.base.domain.BasSheepVariety; +import com.zhyc.module.base.domain.DaRanch; import com.zhyc.module.base.service.IBasSheepTypeService; import com.zhyc.module.base.service.IBasSheepVarietyService; +import com.zhyc.module.base.service.IDaRanchService; import com.zhyc.module.produce.manage_sheep.domain.ScAddSheep; import com.zhyc.module.produce.manage_sheep.service.IScAddSheepService; import com.zhyc.module.base.domain.DaSheepfold; @@ -40,6 +42,9 @@ public class ScAddSheepController { private IBasSheepVarietyService basSheepVarietyMapper; @Autowired private IBasSheepTypeService basSheepTypeService; + @Autowired + private IDaRanchService daRanchService; + //新增羊只验证 @PreAuthorize("@ss.hasPermi('produce:add_sheep:add')") @Log(title = "新增", businessType = BusinessType.INSERT) @@ -48,6 +53,9 @@ public class ScAddSheepController { if (scAddSheep.getEarNumber() == null || scAddSheep.getEarNumber().isEmpty()) { return AjaxResult.error("耳号不能为空"); } + if (scAddSheep.getRanchId() == null || scAddSheep.getRanchId() == 0) { + return AjaxResult.error("牧场不能为空"); + } if (scAddSheep.getSheepfold() == null || scAddSheep.getSheepfold() == 0) { return AjaxResult.error("羊舍不能为空"); } @@ -83,6 +91,14 @@ public class ScAddSheepController { public void exportForm(HttpServletResponse response, @RequestBody ScAddSheep scAddSheep) throws IOException { ExcelUtil util = new ExcelUtil<>(ScAddSheep.class); List list = new ArrayList<>(); + //处理牧场名称 + if (scAddSheep.getRanchId() != null) { + // 根据牧场ID查询牧场信息 + DaRanch ranch = daRanchService.selectDaRanchById(scAddSheep.getRanchId().longValue()); + if (ranch != null) { + scAddSheep.setRanchName(ranch.getRanch()); // 将牧场名称设置到实体中 + } + } // 处理羊舍名称 if (scAddSheep.getSheepfold() != null) { DaSheepfold fold = daSheepfoldMapper.selectDaSheepfoldById(scAddSheep.getSheepfold().longValue()); @@ -109,6 +125,7 @@ public class ScAddSheepController { list.add(scAddSheep); util.exportExcel(response, list, "羊只信息"); } + //导入 @PostMapping("/importData") @PreAuthorize("@ss.hasPermi('produce:add_sheep:import')") diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScAddSheep.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScAddSheep.java index 310cd52..bae1352 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScAddSheep.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScAddSheep.java @@ -27,6 +27,11 @@ public class ScAddSheep extends BaseEntity { @Excel(name = "耳号") private String earNumber; + /** 牧场 */ + private Integer ranchId; + @Excel(name = "牧场名称") + private String ranchName; + /** 羊舍编号 */ private Integer sheepfold; diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScAddSheepServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScAddSheepServiceImpl.java index e2819ee..4f3b0f2 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScAddSheepServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScAddSheepServiceImpl.java @@ -3,8 +3,10 @@ package com.zhyc.module.produce.manage_sheep.service.impl; import com.zhyc.common.exception.ServiceException; import com.zhyc.common.utils.StringUtils; import com.zhyc.module.base.domain.BasSheepType; +import com.zhyc.module.base.domain.DaRanch; import com.zhyc.module.base.mapper.BasSheepVarietyMapper; import com.zhyc.module.base.service.IBasSheepTypeService; +import com.zhyc.module.base.service.IDaRanchService; import com.zhyc.module.produce.manage_sheep.domain.ScAddSheep; import com.zhyc.module.produce.manage_sheep.mapper.ScAddSheepMapper; import com.zhyc.module.produce.manage_sheep.service.IScAddSheepService; @@ -36,6 +38,9 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { @Autowired private IBasSheepTypeService basSheepTypeService; + + @Autowired + private IDaRanchService daRanchService; //新增 @Override @Transactional(rollbackFor = Exception.class) @@ -51,6 +56,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { BasSheep bs = new BasSheep(); bs.setManageTags(scAddSheep.getEarNumber()); // bs.setElectronicTags(scAddSheep.getEarNumber()); + bs.setRanchId(scAddSheep.getRanchId().longValue()); bs.setSheepfoldId(scAddSheep.getSheepfold().longValue()); bs.setFatherId(null); bs.setMotherId(null); @@ -108,6 +114,23 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { for (int i = 0; i < list.size(); i++) { ScAddSheep sheep = list.get(i); try { + if (StringUtils.isBlank(sheep.getRanchName())) { + failure++; + failureMsg.append("
第").append(i + 1).append("行:牧场名称不能为空"); + continue; + } + DaRanch ranchParam = new DaRanch(); + ranchParam.setRanch(sheep.getRanchName().trim()); + List ranchList = daRanchService.selectDaRanchList(ranchParam); + + if (ranchList == null || ranchList.isEmpty()) { + failure++; + failureMsg.append("
第").append(i + 1) + .append("行:牧场名称不存在【").append(sheep.getRanchName()).append("】"); + continue; + } + sheep.setRanchId(ranchList.get(0).getId().intValue()); + if (StringUtils.isNotBlank(sheep.getVarietyName())) { Long varietyId = basSheepVarietyMapper.selectIdByName(sheep.getVarietyName()); if (varietyId == null) { @@ -131,6 +154,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { if (StringUtils.isNotBlank(sheep.getSheepfoldNameExcel())) { DaSheepfold param = new DaSheepfold(); param.setSheepfoldName(sheep.getSheepfoldNameExcel()); + param.setRanchId(sheep.getRanchId().longValue()); List foldList = daSheepfoldMapper.selectDaSheepfoldList(param); if (foldList == null || foldList.isEmpty()) { failure++; diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScAddSheepMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScAddSheepMapper.xml index 29a68fd..6c0b7b9 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScAddSheepMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScAddSheepMapper.xml @@ -61,18 +61,19 @@ INSERT INTO sc_add_sheep - (ear_number, sheepfold, father, mother, born_weight, birthday, - gender, parity, variety_id, type_id, join_date, comment, technician, - create_by, create_time) - VALUES (#{earNumber}, #{sheepfold}, #{father}, #{mother}, #{bornWeight}, - #{birthday}, #{gender}, #{parity}, #{varietyId}, #{typeId}, #{joinDate}, - #{comment}, #{technician}, #{createBy}, #{createTime}) + (ear_number, sheepfold, ranch_id, father, mother, born_weight, birthday, + gender, parity, variety_id, type_id, join_date, comment, technician, + create_by, create_time) + VALUES (#{earNumber}, #{sheepfold}, #{ranchId}, #{father}, #{mother}, #{bornWeight}, + #{birthday}, #{gender}, #{parity}, #{varietyId}, #{typeId}, #{joinDate}, + #{comment}, #{technician}, #{createBy}, #{createTime}) UPDATE sc_add_sheep ear_number = #{earNumber}, + ranch_id = #{ranchId}, sheepfold = #{sheepfold}, father = #{father}, mother = #{mother},