diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/controller/ScAddSheepController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/controller/ScAddSheepController.java index d205ae0..8602dce 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/controller/ScAddSheepController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/controller/ScAddSheepController.java @@ -3,9 +3,12 @@ package com.zhyc.module.produce.manage_sheep.add_sheep.controller; import com.zhyc.common.annotation.Log; 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.produce.manage_sheep.add_sheep.domain.ScAddSheep; import com.zhyc.module.produce.manage_sheep.add_sheep.service.IScAddSheepService; +import com.zhyc.module.sheepfold_management.domain.DaSheepfold; +import com.zhyc.module.sheepfold_management.service.IDaSheepfoldService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.PostMapping; @@ -27,14 +30,16 @@ import static com.zhyc.common.utils.SecurityUtils.getUsername; public class ScAddSheepController { @Autowired private IScAddSheepService scAddSheepService; + @Autowired + private IDaSheepfoldService daSheepfoldMapper; //新增羊只验证 @PreAuthorize("@ss.hasPermi('produce:add_sheep:add')") @Log(title = "新增", businessType = BusinessType.INSERT) @PostMapping public AjaxResult addSheep(@RequestBody ScAddSheep scAddSheep) { - if (scAddSheep.getSheepId() == null || scAddSheep.getSheepId().isEmpty()) { - return AjaxResult.error("羊只id不能为空"); + if (scAddSheep.getEarNumber() == null || scAddSheep.getEarNumber().isEmpty()) { + return AjaxResult.error("耳号不能为空"); } if (scAddSheep.getSheepfold() == null || scAddSheep.getSheepfold() == 0) { return AjaxResult.error("羊舍不能为空"); @@ -52,20 +57,33 @@ public class ScAddSheepController { return AjaxResult.error("品种不能为空"); } - boolean success = scAddSheepService.insertScAddSheep(scAddSheep); - if (success) { - return success("新增成功"); - } else { - return AjaxResult.error("新增失败"); + try { + boolean success = scAddSheepService.insertScAddSheep(scAddSheep); + if (success) { + return success("新增成功"); + } else { + return AjaxResult.error("新增失败"); + } + } catch (ServiceException e) { + return AjaxResult.error(e.getMessage()); } } - //导出表单 + @PostMapping("/exportForm") @Log(title = "羊只信息", businessType = BusinessType.EXPORT) 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) { + scAddSheep.setSheepfoldNameExcel(fold.getSheepfoldName()); + } + } + list.add(scAddSheep); util.exportExcel(response, list, "羊只信息"); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/domain/ScAddSheep.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/domain/ScAddSheep.java index dd3f662..9ac2465 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/domain/ScAddSheep.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/domain/ScAddSheep.java @@ -2,10 +2,16 @@ package com.zhyc.module.produce.manage_sheep.add_sheep.domain; import com.zhyc.common.annotation.Excel; import com.zhyc.common.core.domain.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import java.math.BigDecimal; import java.util.Date; +@Data +@AllArgsConstructor +@NoArgsConstructor public class ScAddSheep extends BaseEntity { /** * 羊只 @@ -15,15 +21,21 @@ public class ScAddSheep extends BaseEntity { */ private static final long serialVersionUID = 1L; @Excel(name = "主键") - private Long id; // 如果数据库主键叫 id,就加这一行 - /** 羊只ID */ - @Excel(name = "羊只ID") - private String sheepId; + private Integer id; // 如果数据库主键叫 id,就加这一行 + /** 羊只耳号 */ + @Excel(name = "耳号") + private String earNumber; /** 羊舍编号 */ - @Excel(name = "羊舍") private Integer sheepfold; +// @Excel(name = "羊舍名称") + private String sheepfoldName; + + // 导出时生成“羊舍名称”列 ,仅 Excel 用,不映射到数据库 + @Excel(name = "羊舍名称") + private String sheepfoldNameExcel; + /** 父号 */ @Excel(name = "父号") private String father; @@ -68,125 +80,6 @@ public class ScAddSheep extends BaseEntity { private String createBy; private Date createTime; - // Getters and Setters - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - public String getSheepId() { - return sheepId; - } - - public void setSheepId(String sheepId) { - this.sheepId = sheepId; - } - - public Integer getSheepfold() { - return sheepfold; - } - - public void setSheepfold(Integer sheepfold) { - this.sheepfold = sheepfold; - } - - public String getFather() { - return father; - } - - public void setFather(String father) { - this.father = father; - } - - public String getMother() { - return mother; - } - - public void setMother(String mother) { - this.mother = mother; - } - - public BigDecimal getBornWeight() { - return bornWeight; - } - - public void setBornWeight(BigDecimal bornWeight) { - this.bornWeight = bornWeight; - } - - public Date getBirthday() { - return birthday; - } - - public void setBirthday(Date birthday) { - this.birthday = birthday; - } - - public Integer getGender() { - return gender; - } - - public void setGender(Integer gender) { - this.gender = gender; - } - - public Integer getParity() { - return parity; - } - - public void setParity(Integer parity) { - this.parity = parity; - } - - public Integer getVarietyId() { - return varietyId; - } - - public void setVarietyId(Integer varietyId) { - this.varietyId = varietyId; - } - - public Date getJoinDate() { - return joinDate; - } - - public void setJoinDate(Date joinDate) { - this.joinDate = joinDate; - } - - public String getComment() { - return comment; - } - - public void setComment(String comment) { - this.comment = comment; - } - - public String getTechnician() { - return technician; - } - - public void setTechnician(String technician) { - this.technician = technician; - } - - public String getCreateBy() { - return createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/mapper/ScAddSheepMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/mapper/ScAddSheepMapper.java index 877b8eb..87ed239 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/mapper/ScAddSheepMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/mapper/ScAddSheepMapper.java @@ -10,6 +10,8 @@ public interface ScAddSheepMapper { int insert(ScAddSheep scAddSheep); List selectScAddSheepList(ScAddSheep scAddSheep); int updateScAddSheep(ScAddSheep scAddSheep); - int deleteScAddSheepByIds(Long[] ids); + int deleteScAddSheepByIds(Integer[] ids); + + ScAddSheep selectByEarNumber(String earNumber); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/service/IScAddSheepService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/service/IScAddSheepService.java index 8381335..eadecb8 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/service/IScAddSheepService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/service/IScAddSheepService.java @@ -7,11 +7,14 @@ import java.util.List; public interface IScAddSheepService { + boolean insertScAddSheep(ScAddSheep scAddSheep); List selectScAddSheepList(ScAddSheep scAddSheep); boolean updateScAddSheep(ScAddSheep scAddSheep); - boolean deleteScAddSheepByIds(Long[] ids); + boolean deleteScAddSheepByIds(Integer[] ids); String importSheep(List list, boolean updateSupport, String operName); + + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/service/impl/ScAddSheepServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/service/impl/ScAddSheepServiceImpl.java index 6829169..bd6a247 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/service/impl/ScAddSheepServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/add_sheep/service/impl/ScAddSheepServiceImpl.java @@ -5,22 +5,63 @@ import com.zhyc.common.utils.StringUtils; import com.zhyc.module.produce.manage_sheep.add_sheep.domain.ScAddSheep; import com.zhyc.module.produce.manage_sheep.add_sheep.mapper.ScAddSheepMapper; import com.zhyc.module.produce.manage_sheep.add_sheep.service.IScAddSheepService; +import com.zhyc.module.produce.sheep.domain.BasSheep; +import com.zhyc.module.produce.sheep.mapper.BasSheepMapper; +import com.zhyc.module.produce.sheep.service.IBasSheepService; +import com.zhyc.module.produce.sheep.service.impl.BasSheepServiceImpl; +import com.zhyc.module.sheepfold_management.domain.DaSheepfold; +import com.zhyc.module.sheepfold_management.mapper.DaSheepfoldMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Date; import java.util.List; @Service public class ScAddSheepServiceImpl implements IScAddSheepService { + @Autowired private ScAddSheepMapper scAddSheepMapper; + @Autowired + private DaSheepfoldMapper daSheepfoldMapper; + + @Autowired + private IBasSheepService basSheepService; + @Override public boolean insertScAddSheep(ScAddSheep scAddSheep) { - return scAddSheepMapper.insert(scAddSheep) > 0; + // 1. 重复校验 + ScAddSheep exist = scAddSheepMapper.selectByEarNumber(scAddSheep.getEarNumber()); + if (exist != null) { + throw new ServiceException("添加失败,耳号重复"); + } + + // 2. 写入 sc_add_sheep + boolean ok = scAddSheepMapper.insert(scAddSheep) > 0; + if (!ok) return false; + + // 3. 字段映射 → BasSheep + BasSheep bs = new BasSheep(); + bs.setManageTags(scAddSheep.getEarNumber()); // 管理耳号 + bs.setElectronicTags(scAddSheep.getEarNumber()); // 电子耳号 + bs.setSheepfoldId(scAddSheep.getSheepfold().longValue()); // 羊舍 + bs.setFatherId(null); // 父号/母号可后续补全 + bs.setMotherId(null); + bs.setBirthWeight(scAddSheep.getBornWeight().longValue()); + bs.setBirthday(scAddSheep.getBirthday()); + bs.setGender(scAddSheep.getGender().longValue()); + bs.setParity(scAddSheep.getParity().longValue()); + bs.setVarietyId(scAddSheep.getVarietyId().longValue()); + bs.setSourceDate(scAddSheep.getJoinDate()); + bs.setComment(scAddSheep.getComment()); + bs.setCreateBy(scAddSheep.getCreateBy()); + bs.setCreateTime(new Date()); + + // 4. 写入 bas_sheep + basSheepService.insertBasSheep(bs); + return true; } - - @Override public List selectScAddSheepList(ScAddSheep scAddSheep) { return scAddSheepMapper.selectScAddSheepList(scAddSheep); @@ -32,22 +73,63 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { } @Override - public boolean deleteScAddSheepByIds(Long[] ids) { + public boolean deleteScAddSheepByIds(Integer[] ids) { return scAddSheepMapper.deleteScAddSheepByIds(ids) > 0; } + /* ------------------ 导入:羊舍名称 → ID ------------------ */ @Override public String importSheep(List list, boolean updateSupport, String operName) { if (list == null || list.isEmpty()) { throw new ServiceException("导入数据不能为空!"); } + int success = 0, failure = 0; StringBuilder failureMsg = new StringBuilder(); - for (ScAddSheep sheep : list) { + + for (int i = 0; i < list.size(); i++) { + ScAddSheep sheep = list.get(i); try { - if (StringUtils.isBlank(sheep.getSheepId())) { - failure++; failureMsg.append("
第").append(success + failure + 1).append("行:羊只ID不能为空"); continue; + /* 1. 羊舍名称 → ID */ + if (StringUtils.isNotBlank(sheep.getSheepfoldNameExcel())) { + DaSheepfold param = new DaSheepfold(); + param.setSheepfoldName(sheep.getSheepfoldNameExcel()); + List foldList = daSheepfoldMapper.selectDaSheepfoldList(param); + + if (foldList == null || foldList.isEmpty()) { + failure++; + failureMsg.append("
第") + .append(i + 1) + .append("行:羊舍名称不存在【") + .append(sheep.getSheepfoldNameExcel()) + .append("】"); + continue; + } + sheep.setSheepfold(foldList.get(0).getId().intValue()); } + + /* 2. 耳号非空校验 */ + if (StringUtils.isBlank(sheep.getEarNumber())) { + failure++; + failureMsg.append("
第") + .append(i + 1) + .append("行:耳号不能为空"); + continue; + } + + /* 3. 耳号重复校验(增量导入核心) */ + ScAddSheep exist = scAddSheepMapper.selectByEarNumber(sheep.getEarNumber()); + if (exist != null) { + failure++; + failureMsg.append("
第") + .append(i + 1) + .append("行:耳号已存在【") + .append(sheep.getEarNumber()) + .append("】"); + continue; + } + + /* 4. 插入或更新 */ if (updateSupport && sheep.getId() != null) { sheep.setUpdateBy(operName); updateScAddSheep(sheep); @@ -57,11 +139,19 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { } success++; } catch (Exception e) { - failure++; failureMsg.append("
第").append(success + failure + 1).append("行:").append(e.getMessage()); + failure++; + failureMsg.append("
第") + .append(i + 1) + .append("行:") + .append(e.getMessage()); } } - if (failure > 0) throw new ServiceException("导入失败!共 " + failure + " 条:" + failureMsg); + + if (failure > 0) { + throw new ServiceException("导入失败!共 " + failure + " 条:" + failureMsg); + } return "导入成功!共 " + success + " 条"; } -} + +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/controller/ScTransGroupController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/controller/ScTransGroupController.java index fd89b5b..44b8ccf 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/controller/ScTransGroupController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/controller/ScTransGroupController.java @@ -1,5 +1,6 @@ package com.zhyc.module.produce.manage_sheep.trans_group.controller; +import java.io.IOException; import java.util.List; import javax.servlet.http.HttpServletResponse; @@ -53,10 +54,9 @@ public class ScTransGroupController extends BaseController @PreAuthorize("@ss.hasPermi('produce:trans_group:export')") @Log(title = "转群记录", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, ScTransGroup scTransGroup) - { + public void export(HttpServletResponse response, ScTransGroup scTransGroup) throws IOException { List list = scTransGroupService.selectScTransGroupList(scTransGroup); - ExcelUtil util = new ExcelUtil(ScTransGroup.class); + ExcelUtil util = new ExcelUtil<>(ScTransGroup.class); util.exportExcel(response, list, "转群记录数据"); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/domain/ScTransGroup.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/domain/ScTransGroup.java index e25278a..13d5d35 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/domain/ScTransGroup.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/domain/ScTransGroup.java @@ -1,9 +1,13 @@ package com.zhyc.module.produce.manage_sheep.trans_group.domain; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.zhyc.common.annotation.Excel; import com.zhyc.common.core.domain.BaseEntity; +import org.springframework.beans.factory.annotation.Autowired; /** * 转群记录对象 sc_trans_group @@ -11,6 +15,9 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-10 */ +@Data +@AllArgsConstructor +@NoArgsConstructor public class ScTransGroup extends BaseEntity { private static final long serialVersionUID = 1L; @@ -23,122 +30,40 @@ public class ScTransGroup extends BaseEntity private Integer sheepId; /** 转入羊舍 */ - @Excel(name = "转入羊舍") private String foldTo; /** 转出羊舍 */ - @Excel(name = "转出羊舍") private String foldFrom; + /** 转出羊舍名称 */ + @Excel(name = "转出羊舍") + private String foldFromName; + + /** 转入羊舍名称 */ + @Excel(name = "转入羊舍") + private String foldToName; /** 转群原因 */ + + private Integer reason; + /** 转群原因描述 用于导出*/ @Excel(name = "转群原因") - private String reason; + private String reasonText; /** 技术员 */ @Excel(name = "技术员") private String technician; /** 状态 */ - @Excel(name = "状态") + private Integer status; + /** 状态描述 用于导出*/ + @Excel(name = "状态") + private String statusText; /** 备注 */ @Excel(name = "备注") private String comment; - public void setId(Integer id) - { - this.id = id; - } - public Integer getId() - { - return id; - } - public void setSheepId(Integer sheepId) - { - this.sheepId = sheepId; - } - - public Integer getSheepId() - { - return sheepId; - } - - public void setFoldTo(String foldTo) - { - this.foldTo = foldTo; - } - - public String getFoldTo() - { - return foldTo; - } - - public void setFoldFrom(String foldFrom) - { - this.foldFrom = foldFrom; - } - - public String getFoldFrom() - { - return foldFrom; - } - - public void setReason(String reason) - { - this.reason = reason; - } - - public String getReason() - { - return reason; - } - - public void setTechnician(String technician) - { - this.technician = technician; - } - - public String getTechnician() - { - return technician; - } - - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - public void setComment(String comment) - { - this.comment = comment; - } - - public String getComment() - { - return comment; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("sheepId", getSheepId()) - .append("foldTo", getFoldTo()) - .append("foldFrom", getFoldFrom()) - .append("reason", getReason()) - .append("technician", getTechnician()) - .append("status", getStatus()) - .append("comment", getComment()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/service/impl/ScTransGroupServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/service/impl/ScTransGroupServiceImpl.java index f38d30c..4354dd7 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/service/impl/ScTransGroupServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/service/impl/ScTransGroupServiceImpl.java @@ -1,6 +1,9 @@ package com.zhyc.module.produce.manage_sheep.trans_group.service.impl; +import java.util.HashMap; import java.util.List; +import java.util.Map; + import com.zhyc.common.utils.DateUtils; import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup; import com.zhyc.module.produce.manage_sheep.trans_group.mapper.ScTransGroupMapper; @@ -10,49 +13,57 @@ import org.springframework.stereotype.Service; /** * 转群记录Service业务层处理 - * + * * @author ruoyi * @date 2025-07-10 */ @Service -public class ScTransGroupServiceImpl implements IScTransGroupService -{ +public class ScTransGroupServiceImpl implements IScTransGroupService { @Autowired private ScTransGroupMapper scTransGroupMapper; /** * 查询转群记录 - * + * * @param id 转群记录主键 * @return 转群记录 */ @Override - public ScTransGroup selectScTransGroupById(Integer id) - { - return scTransGroupMapper.selectScTransGroupById(id); + public ScTransGroup selectScTransGroupById(Integer id) { + ScTransGroup group = scTransGroupMapper.selectScTransGroupById(id); + group.setReasonText(convertReason(group.getReason())); + group.setStatusText(convertStatus(group.getStatus())); + return group; } + /** * 查询转群记录列表 - * + * * @param scTransGroup 转群记录 * @return 转群记录 */ @Override - public List selectScTransGroupList(ScTransGroup scTransGroup) - { - return scTransGroupMapper.selectScTransGroupList(scTransGroup); + public List selectScTransGroupList(ScTransGroup scTransGroup) { + List list = scTransGroupMapper.selectScTransGroupList(scTransGroup); + list.forEach(group -> { + group.setReasonText(convertReason(group.getReason())); + group.setStatusText(convertStatus(group.getStatus())); + }); + return list; +// return scTransGroupMapper.selectScTransGroupList(scTransGroup); + } /** * 新增转群记录 - * + * * @param scTransGroup 转群记录 * @return 结果 */ + @Override - public int insertScTransGroup(ScTransGroup scTransGroup) - { + public int insertScTransGroup(ScTransGroup scTransGroup) { scTransGroup.setStatus(0); scTransGroup.setCreateTime(DateUtils.getNowDate()); return scTransGroupMapper.insertScTransGroup(scTransGroup); @@ -60,37 +71,57 @@ public class ScTransGroupServiceImpl implements IScTransGroupService /** * 修改转群记录 - * + * * @param scTransGroup 转群记录 * @return 结果 */ @Override - public int updateScTransGroup(ScTransGroup scTransGroup) - { + public int updateScTransGroup(ScTransGroup scTransGroup) { return scTransGroupMapper.updateScTransGroup(scTransGroup); } /** * 批量删除转群记录 - * + * * @param ids 需要删除的转群记录主键 * @return 结果 */ @Override - public int deleteScTransGroupByIds(Integer[] ids) - { + public int deleteScTransGroupByIds(Integer[] ids) { return scTransGroupMapper.deleteScTransGroupByIds(ids); } /** * 删除转群记录信息 - * + * * @param id 转群记录主键 * @return 结果 */ @Override - public int deleteScTransGroupById(Integer id) - { + public int deleteScTransGroupById(Integer id) { return scTransGroupMapper.deleteScTransGroupById(id); } + + /** + * 转换转群原因 + */ + private String convertReason(Integer reasonCode) { + Map reasonMap = new HashMap<>(); + reasonMap.put(0, "新产羊过抗转群"); + reasonMap.put(1, "治愈转群"); + reasonMap.put(2, "病羊过抗转群"); + return reasonMap.getOrDefault(reasonCode, "未知原因"); + } + + /** + * 转换状态 + */ + private String convertStatus(Integer statusCode) { + Map statusMap = new HashMap<>(); + statusMap.put(0, "待批准"); + statusMap.put(1, "通过"); + statusMap.put(2, "驳回"); + return statusMap.getOrDefault(statusCode, "未知状态"); + } + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/transition_info/domain/ScTransitionInfo.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/transition_info/domain/ScTransitionInfo.java index 1636a5f..bce520a 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/transition_info/domain/ScTransitionInfo.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/transition_info/domain/ScTransitionInfo.java @@ -1,5 +1,8 @@ package com.zhyc.module.produce.manage_sheep.transition_info.domain; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.zhyc.common.annotation.Excel; @@ -11,6 +14,9 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-10 */ +@Data +@AllArgsConstructor +@NoArgsConstructor public class ScTransitionInfo extends BaseEntity { private static final long serialVersionUID = 1L; @@ -32,7 +38,7 @@ public class ScTransitionInfo extends BaseEntity /** 转场类型 */ @Excel(name = "转场类型") - private Long transType; + private Integer transType; /** 技术员 */ @Excel(name = "技术员") @@ -46,99 +52,5 @@ public class ScTransitionInfo extends BaseEntity @Excel(name = "备注") private String comment; - public void setId(Integer id) - { - this.id = id; - } - public Integer getId() - { - return id; - } - - public void setSheepId(Integer sheepId) - { - this.sheepId = sheepId; - } - - public Integer getSheepId() - { - return sheepId; - } - - public void setTransTo(String transTo) - { - this.transTo = transTo; - } - - public String getTransTo() - { - return transTo; - } - - public void setTransFrom(String transFrom) - { - this.transFrom = transFrom; - } - - public String getTransFrom() - { - return transFrom; - } - - public void setTransType(Long transType) - { - this.transType = transType; - } - - public Long getTransType() - { - return transType; - } - - public void setTechnician(String technician) - { - this.technician = technician; - } - - public String getTechnician() - { - return technician; - } - - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - public void setComment(String comment) - { - this.comment = comment; - } - - public String getComment() - { - return comment; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("sheepId", getSheepId()) - .append("transTo", getTransTo()) - .append("transFrom", getTransFrom()) - .append("transType", getTransType()) - .append("technician", getTechnician()) - .append("status", getStatus()) - .append("comment", getComment()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/controller/ScFixHoofController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/controller/ScFixHoofController.java index 3e9a227..fe6de0d 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/controller/ScFixHoofController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/controller/ScFixHoofController.java @@ -66,7 +66,7 @@ public class ScFixHoofController extends BaseController */ @PreAuthorize("@ss.hasPermi('produce:fixHoof:query')") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) + public AjaxResult getInfo(@PathVariable("id") Integer id) { return success(scFixHoofService.selectScFixHoofById(id)); } @@ -99,7 +99,7 @@ public class ScFixHoofController extends BaseController @PreAuthorize("@ss.hasPermi('produce:fixHoof:remove')") @Log(title = "修蹄", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) + public AjaxResult remove(@PathVariable Integer[] ids) { return toAjax(scFixHoofService.deleteScFixHoofByIds(ids)); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/domain/ScFixHoof.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/domain/ScFixHoof.java index a1d445c..7dabc59 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/domain/ScFixHoof.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/domain/ScFixHoof.java @@ -1,5 +1,8 @@ package com.zhyc.module.produce.other.fixHoof.domain; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.zhyc.common.annotation.Excel; @@ -11,20 +14,26 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-10 */ +@Data +@AllArgsConstructor +@NoArgsConstructor public class ScFixHoof extends BaseEntity { private static final long serialVersionUID = 1L; /** $column.columnComment */ - private Long id; + private Integer id; /** 羊只id */ @Excel(name = "羊只id") - private Long sheepId; + private Integer sheepId; /** 羊舍id */ - @Excel(name = "羊舍id") - private Long sheepfold; + private Integer sheepfold; + + /** 羊舍名称 */ + @Excel(name = "羊舍名称") + private String sheepfoldName; /** 备注 */ @Excel(name = "备注") @@ -34,66 +43,4 @@ public class ScFixHoof extends BaseEntity @Excel(name = "技术员") private String technician; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setSheepId(Long sheepId) - { - this.sheepId = sheepId; - } - - public Long getSheepId() - { - return sheepId; - } - - public void setSheepfold(Long sheepfold) - { - this.sheepfold = sheepfold; - } - - public Long getSheepfold() - { - return sheepfold; - } - - public void setComment(String comment) - { - this.comment = comment; - } - - public String getComment() - { - return comment; - } - - public void setTechnician(String technician) - { - this.technician = technician; - } - - public String getTechnician() - { - return technician; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("sheepId", getSheepId()) - .append("sheepfold", getSheepfold()) - .append("comment", getComment()) - .append("technician", getTechnician()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/mapper/ScFixHoofMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/mapper/ScFixHoofMapper.java index 75e27ee..a5d71a1 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/mapper/ScFixHoofMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/mapper/ScFixHoofMapper.java @@ -17,7 +17,7 @@ public interface ScFixHoofMapper * @param id 修蹄主键 * @return 修蹄 */ - public ScFixHoof selectScFixHoofById(Long id); + public ScFixHoof selectScFixHoofById(Integer id); /** * 查询修蹄列表 @@ -49,7 +49,7 @@ public interface ScFixHoofMapper * @param id 修蹄主键 * @return 结果 */ - public int deleteScFixHoofById(Long id); + public int deleteScFixHoofById(Integer id); /** * 批量删除修蹄 @@ -57,5 +57,5 @@ public interface ScFixHoofMapper * @param ids 需要删除的数据主键集合 * @return 结果 */ - public int deleteScFixHoofByIds(Long[] ids); + public int deleteScFixHoofByIds(Integer[] ids); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/IScFixHoofService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/IScFixHoofService.java index 8092f8f..01a2272 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/IScFixHoofService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/IScFixHoofService.java @@ -17,7 +17,7 @@ public interface IScFixHoofService * @param id 修蹄主键 * @return 修蹄 */ - public ScFixHoof selectScFixHoofById(Long id); + public ScFixHoof selectScFixHoofById(Integer id); /** * 查询修蹄列表 @@ -49,7 +49,7 @@ public interface IScFixHoofService * @param ids 需要删除的修蹄主键集合 * @return 结果 */ - public int deleteScFixHoofByIds(Long[] ids); + public int deleteScFixHoofByIds(Integer[] ids); /** * 删除修蹄信息 @@ -57,5 +57,5 @@ public interface IScFixHoofService * @param id 修蹄主键 * @return 结果 */ - public int deleteScFixHoofById(Long id); + public int deleteScFixHoofById(Integer id); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/impl/ScFixHoofServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/impl/ScFixHoofServiceImpl.java index 68a68ff..5bf5e2a 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/impl/ScFixHoofServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/impl/ScFixHoofServiceImpl.java @@ -27,7 +27,7 @@ public class ScFixHoofServiceImpl implements IScFixHoofService * @return 修蹄 */ @Override - public ScFixHoof selectScFixHoofById(Long id) + public ScFixHoof selectScFixHoofById(Integer id) { return scFixHoofMapper.selectScFixHoofById(id); } @@ -76,7 +76,7 @@ public class ScFixHoofServiceImpl implements IScFixHoofService * @return 结果 */ @Override - public int deleteScFixHoofByIds(Long[] ids) + public int deleteScFixHoofByIds(Integer[] ids) { return scFixHoofMapper.deleteScFixHoofByIds(ids); } @@ -88,7 +88,7 @@ public class ScFixHoofServiceImpl implements IScFixHoofService * @return 结果 */ @Override - public int deleteScFixHoofById(Long id) + public int deleteScFixHoofById(Integer id) { return scFixHoofMapper.deleteScFixHoofById(id); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/controller/BasSheepController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/controller/BasSheepController.java new file mode 100644 index 0000000..7efd886 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/controller/BasSheepController.java @@ -0,0 +1,105 @@ +package com.zhyc.module.produce.sheep.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.zhyc.module.produce.sheep.domain.BasSheep; +import com.zhyc.module.produce.sheep.service.IBasSheepService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.zhyc.common.annotation.Log; +import com.zhyc.common.core.controller.BaseController; +import com.zhyc.common.core.domain.AjaxResult; +import com.zhyc.common.enums.BusinessType; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 羊只基本信息Controller + * + * @author ruoyi + * @date 2025-07-15 + */ +@RestController +@RequestMapping("/sheep/sheep") +public class BasSheepController extends BaseController +{ + @Autowired + private IBasSheepService basSheepService; + + /** + * 查询羊只基本信息列表 + */ + @PreAuthorize("@ss.hasPermi('sheep:sheep:list')") + @GetMapping("/list") + public TableDataInfo list(BasSheep basSheep) + { + startPage(); + List list = basSheepService.selectBasSheepList(basSheep); + return getDataTable(list); + } + + /** + * 导出羊只基本信息列表 + */ + @PreAuthorize("@ss.hasPermi('sheep:sheep:export')") + @Log(title = "羊只基本信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, BasSheep basSheep) + { + List list = basSheepService.selectBasSheepList(basSheep); + ExcelUtil util = new ExcelUtil(BasSheep.class); + util.exportExcel(response, list, "羊只基本信息数据"); + } + + /** + * 获取羊只基本信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('sheep:sheep:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(basSheepService.selectBasSheepById(id)); + } + + /** + * 新增羊只基本信息 + */ + @PreAuthorize("@ss.hasPermi('sheep:sheep:add')") + @Log(title = "羊只基本信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody BasSheep basSheep) + { + return toAjax(basSheepService.insertBasSheep(basSheep)); + } + + /** + * 修改羊只基本信息 + */ + @PreAuthorize("@ss.hasPermi('sheep:sheep:edit')") + @Log(title = "羊只基本信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody BasSheep basSheep) + { + return toAjax(basSheepService.updateBasSheep(basSheep)); + } + + /** + * 删除羊只基本信息 + */ + @PreAuthorize("@ss.hasPermi('sheep:sheep:remove')") + @Log(title = "羊只基本信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(basSheepService.deleteBasSheepByIds(ids)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/domain/BasSheep.java b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/domain/BasSheep.java new file mode 100644 index 0000000..84e2ac6 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/domain/BasSheep.java @@ -0,0 +1,178 @@ +package com.zhyc.module.produce.sheep.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.zhyc.common.annotation.Excel; +import com.zhyc.common.core.domain.BaseEntity; + +/** + * 羊只基本信息对象 bas_sheep + * + * @author ruoyi + * @date 2025-07-15 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class BasSheep extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** 管理耳号 */ + @Excel(name = "管理耳号") + private String manageTags; + + /** 牧场id */ + @Excel(name = "牧场id") + private Long ranchId; + + /** 羊舍id */ + @Excel(name = "羊舍id") + private Long sheepfoldId; + + /** 电子耳号 */ + @Excel(name = "电子耳号") + private String electronicTags; + + /** 品种id */ + @Excel(name = "品种id") + private Long varietyId; + + /** 家系 */ + @Excel(name = "家系") + private String family; + + /** 羊只类别 */ + @Excel(name = "羊只类别") + private Long typeId; + + /** 性别 */ + @Excel(name = "性别") + private Long gender; + + /** 出生日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "出生日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date birthday; + + /** 出生体重 */ + @Excel(name = "出生体重") + private Long birthWeight; + + /** 胎次 */ + @Excel(name = "胎次") + private Long parity; + + /** 羊只状态 */ + @Excel(name = "羊只状态") + private Long statusId; + + /** 断奶日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "断奶日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date weaningDate; + + /** 断奶体重 */ + @Excel(name = "断奶体重") + private Long weaningWeight; + + /** 繁育状态id */ + @Excel(name = "繁育状态id") + private Long breedStatusId; + + /** 父号id */ + @Excel(name = "父号id") + private Long fatherId; + + /** 母号id */ + @Excel(name = "母号id") + private Long motherId; + + /** 受体id */ + @Excel(name = "受体id") + private Long receptorId; + + /** 配种日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "配种日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date matingDate; + + /** 配种类型 */ + @Excel(name = "配种类型") + private Long matingTypeId; + + /** 孕检日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "孕检日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date pregDate; + + /** 产羔日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "产羔日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date lambingDate; + + /** 产羔时怀孕天数 */ + @Excel(name = "产羔时怀孕天数") + private Long lambingDay; + + /** 预产日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "预产日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date expectedDate; + + /** 是否性控 */ + @Excel(name = "是否性控") + private Long controlled; + + /** 配种次数 */ + @Excel(name = "配种次数") + private Long matingCounts; + + /** $column.columnComment */ + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private Long matingTotal; + + /** 累计流产次数 */ + @Excel(name = "累计流产次数") + private Long miscarriageCounts; + + /** 体况评分 */ + @Excel(name = "体况评分") + private Long body; + + /** 乳房评分 */ + @Excel(name = "乳房评分") + private Long breast; + + /** 入群来源 */ + @Excel(name = "入群来源") + private String source; + + /** 入群日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "入群日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date sourceDate; + + /** 来源牧场id */ + @Excel(name = "来源牧场id") + private Long sourceRanchId; + + /** 备注 */ + @Excel(name = "备注") + private String comment; + + /** 是否删除 */ + @Excel(name = "是否删除") + private Long isDelete; + + +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/mapper/BasSheepMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/mapper/BasSheepMapper.java new file mode 100644 index 0000000..e223d22 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/mapper/BasSheepMapper.java @@ -0,0 +1,61 @@ +package com.zhyc.module.produce.sheep.mapper; + +import java.util.List; +import com.zhyc.module.produce.sheep.domain.BasSheep; + +/** + * 羊只基本信息Mapper接口 + * + * @author ruoyi + * @date 2025-07-15 + */ +public interface BasSheepMapper +{ + /** + * 查询羊只基本信息 + * + * @param id 羊只基本信息主键 + * @return 羊只基本信息 + */ + public BasSheep selectBasSheepById(Long id); + + /** + * 查询羊只基本信息列表 + * + * @param basSheep 羊只基本信息 + * @return 羊只基本信息集合 + */ + public List selectBasSheepList(BasSheep basSheep); + + /** + * 新增羊只基本信息 + * + * @param basSheep 羊只基本信息 + * @return 结果 + */ + public int insertBasSheep(BasSheep basSheep); + + /** + * 修改羊只基本信息 + * + * @param basSheep 羊只基本信息 + * @return 结果 + */ + public int updateBasSheep(BasSheep basSheep); + + /** + * 删除羊只基本信息 + * + * @param id 羊只基本信息主键 + * @return 结果 + */ + public int deleteBasSheepById(Long id); + + /** + * 批量删除羊只基本信息 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBasSheepByIds(Long[] ids); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/service/IBasSheepService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/service/IBasSheepService.java new file mode 100644 index 0000000..76efcf7 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/service/IBasSheepService.java @@ -0,0 +1,61 @@ +package com.zhyc.module.produce.sheep.service; + +import java.util.List; +import com.zhyc.module.produce.sheep.domain.BasSheep; + +/** + * 羊只基本信息Service接口 + * + * @author ruoyi + * @date 2025-07-15 + */ +public interface IBasSheepService +{ + /** + * 查询羊只基本信息 + * + * @param id 羊只基本信息主键 + * @return 羊只基本信息 + */ + public BasSheep selectBasSheepById(Long id); + + /** + * 查询羊只基本信息列表 + * + * @param basSheep 羊只基本信息 + * @return 羊只基本信息集合 + */ + public List selectBasSheepList(BasSheep basSheep); + + /** + * 新增羊只基本信息 + * + * @param basSheep 羊只基本信息 + * @return 结果 + */ + public int insertBasSheep(BasSheep basSheep); + + /** + * 修改羊只基本信息 + * + * @param basSheep 羊只基本信息 + * @return 结果 + */ + public int updateBasSheep(BasSheep basSheep); + + /** + * 批量删除羊只基本信息 + * + * @param ids 需要删除的羊只基本信息主键集合 + * @return 结果 + */ + public int deleteBasSheepByIds(Long[] ids); + + /** + * 删除羊只基本信息信息 + * + * @param id 羊只基本信息主键 + * @return 结果 + */ + public int deleteBasSheepById(Long id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/service/impl/BasSheepServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/service/impl/BasSheepServiceImpl.java new file mode 100644 index 0000000..cdc9cdd --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/service/impl/BasSheepServiceImpl.java @@ -0,0 +1,96 @@ +package com.zhyc.module.produce.sheep.service.impl; + +import java.util.List; +import com.zhyc.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.produce.sheep.mapper.BasSheepMapper; +import com.zhyc.module.produce.sheep.domain.BasSheep; +import com.zhyc.module.produce.sheep.service.IBasSheepService; + +/** + * 羊只基本信息Service业务层处理 + * + * @author ruoyi + * @date 2025-07-15 + */ +@Service +public class BasSheepServiceImpl implements IBasSheepService +{ + @Autowired + private BasSheepMapper basSheepMapper; + + /** + * 查询羊只基本信息 + * + * @param id 羊只基本信息主键 + * @return 羊只基本信息 + */ + @Override + public BasSheep selectBasSheepById(Long id) + { + return basSheepMapper.selectBasSheepById(id); + } + + /** + * 查询羊只基本信息列表 + * + * @param basSheep 羊只基本信息 + * @return 羊只基本信息 + */ + @Override + public List selectBasSheepList(BasSheep basSheep) + { + return basSheepMapper.selectBasSheepList(basSheep); + } + + /** + * 新增羊只基本信息 + * + * @param basSheep 羊只基本信息 + * @return 结果 + */ + @Override + public int insertBasSheep(BasSheep basSheep) + { + basSheep.setCreateTime(DateUtils.getNowDate()); + return basSheepMapper.insertBasSheep(basSheep); + } + + /** + * 修改羊只基本信息 + * + * @param basSheep 羊只基本信息 + * @return 结果 + */ + @Override + public int updateBasSheep(BasSheep basSheep) + { + basSheep.setUpdateTime(DateUtils.getNowDate()); + return basSheepMapper.updateBasSheep(basSheep); + } + + /** + * 批量删除羊只基本信息 + * + * @param ids 需要删除的羊只基本信息主键 + * @return 结果 + */ + @Override + public int deleteBasSheepByIds(Long[] ids) + { + return basSheepMapper.deleteBasSheepByIds(ids); + } + + /** + * 删除羊只基本信息信息 + * + * @param id 羊只基本信息主键 + * @return 结果 + */ + @Override + public int deleteBasSheepById(Long id) + { + return basSheepMapper.deleteBasSheepById(id); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/sheep_file/mapper/SheepFileMapper.java b/zhyc-module/src/main/java/com/zhyc/module/sheep_file/mapper/SheepFileMapper.java index 480d02e..76543f3 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/sheep_file/mapper/SheepFileMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/sheep_file/mapper/SheepFileMapper.java @@ -5,15 +5,15 @@ import com.zhyc.module.sheep_file.domain.SheepFile; /** * 羊只档案Mapper接口 - * + * * @author wyt * @date 2025-07-13 */ -public interface SheepFileMapper +public interface SheepFileMapper { /** * 查询羊只档案 - * + * * @param id 羊只档案主键 * @return 羊只档案 */ @@ -21,7 +21,7 @@ public interface SheepFileMapper /** * 查询羊只档案列表 - * + * * @param sheepFile 羊只档案 * @return 羊只档案集合 */ @@ -29,7 +29,7 @@ public interface SheepFileMapper /** * 新增羊只档案 - * + * * @param sheepFile 羊只档案 * @return 结果 */ @@ -37,7 +37,7 @@ public interface SheepFileMapper /** * 修改羊只档案 - * + * * @param sheepFile 羊只档案 * @return 结果 */ @@ -45,7 +45,7 @@ public interface SheepFileMapper /** * 删除羊只档案 - * + * * @param id 羊只档案主键 * @return 结果 */ @@ -53,9 +53,10 @@ public interface SheepFileMapper /** * 批量删除羊只档案 - * + * * @param ids 需要删除的数据主键集合 * @return 结果 */ public int deleteSheepFileByIds(Long[] ids); + } diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/add_sheep/ScAddSheepMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/add_sheep/ScAddSheepMapper.xml index d234d5c..9f4de89 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/add_sheep/ScAddSheepMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/add_sheep/ScAddSheepMapper.xml @@ -5,45 +5,52 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + INSERT INTO sc_add_sheep - (sheep_id, sheepfold, father, mother, born_weight, birthday, gender, parity, + (ear_number, sheepfold, father, mother, born_weight, birthday, gender, parity, variety_id, join_date, comment, technician, create_by, create_time) - VALUES - (#{sheepId}, #{sheepfold}, #{father}, #{mother}, #{bornWeight}, #{birthday}, - #{gender}, #{parity}, #{varietyId}, #{joinDate}, #{comment}, #{technician}, - #{createBy}, #{createTime}) + VALUES (#{earNumber}, #{sheepfold}, #{father}, #{mother}, #{bornWeight}, #{birthday}, + #{gender}, #{parity}, #{varietyId}, #{joinDate}, #{comment}, #{technician}, + #{createBy}, #{createTime}) + UPDATE sc_add_sheep - sheep_id = #{sheepId}, + ear_number = #{earNumber}, sheepfold = #{sheepfold}, father = #{father}, mother = #{mother}, @@ -68,4 +75,7 @@ + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/trans_group/ScTransGroupMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/trans_group/ScTransGroupMapper.xml index 20046c2..665ec43 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/trans_group/ScTransGroupMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/trans_group/ScTransGroupMapper.xml @@ -1,40 +1,57 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - - - - - - - - - - + + + + + + + + + + - select id, sheep_id, fold_to, fold_from, reason, technician, status, comment, create_by, create_time from sc_trans_group + SELECT tg.id, + tg.sheep_id, + tg.fold_to, + tg.fold_from, + tg.reason, + tg.technician, + tg.status, + tg.comment, + tg.create_by, + tg.create_time, + sf_from.sheepfold_name AS foldFromName, + sf_to.sheepfold_name AS foldToName + FROM sc_trans_group tg + LEFT JOIN da_sheepfold sf_from ON tg.fold_from = sf_from.id + LEFT JOIN da_sheepfold sf_to ON tg.fold_to = sf_to.id - + + @@ -49,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" comment, create_by, create_time, - + #{sheepId}, #{foldTo}, @@ -60,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{comment}, #{createBy}, #{createTime}, - + @@ -76,15 +93,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_by = #{createBy}, create_time = #{createTime}, - where id = #{id} + where sc_trans_group.id = #{id} - delete from sc_trans_group where id = #{id} + delete + from sc_trans_group + where tg.id = #{id} - delete from sc_trans_group where id in + delete from sc_trans_group where id in #{id} diff --git a/zhyc-module/src/main/resources/mapper/produce/other/fixHoof/ScFixHoofMapper.xml b/zhyc-module/src/main/resources/mapper/produce/other/fixHoof/ScFixHoofMapper.xml index 78eb85c..3ec4178 100644 --- a/zhyc-module/src/main/resources/mapper/produce/other/fixHoof/ScFixHoofMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/other/fixHoof/ScFixHoofMapper.xml @@ -1,47 +1,59 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - - - - - - - + + + + + + + + - select id, sheep_id, sheepfold, comment, technician, create_by, create_time from sc_fix_hoof + select fh.id, + fh.sheep_id, + fh.sheepfold, + sf.sheepfold_name as sheepfoldName, + fh.comment, + fh.technician, + fh.create_by, + fh.create_time + from sc_fix_hoof fh + left join da_sheepfold sf on fh.sheepfold = sf.id - - - where id = #{id} + where fh.id = #{id} insert into sc_fix_hoof - sheep_id, - sheepfold, + and fh.sheep_id like concat('%', #{sheepId}, '%') + and fh.sheepfold = #{sheepfold} comment, technician, create_by, create_time, - + #{sheepId}, #{sheepfold}, @@ -49,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{technician}, #{createBy}, #{createTime}, - + @@ -65,12 +77,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} - - delete from sc_fix_hoof where id = #{id} + + delete + from sc_fix_hoof + where id = #{id} - - delete from sc_fix_hoof where id in + + delete from sc_fix_hoof where id in #{id} diff --git a/zhyc-module/src/main/resources/mapper/produce/sheep/BasSheepMapper.xml b/zhyc-module/src/main/resources/mapper/produce/sheep/BasSheepMapper.xml new file mode 100644 index 0000000..18ece91 --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/produce/sheep/BasSheepMapper.xml @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, manage_tags, ranch_id, sheepfold_id, electronic_tags, variety_id, family, type_id, gender, birthday, birth_weight, parity, status_id, weaning_date, weaning_weight, breed_status_id, father_id, mother_id, receptor_id, mating_date, mating_type_id, preg_date, lambing_date, lambing_day, expected_date, controlled, mating_counts, mating_total, miscarriage_counts, body, breast, source, source_date, source_ranch_id, comment, update_by, update_time, create_by, create_time, is_delete from bas_sheep + + + + + + + + insert into bas_sheep + + manage_tags, + ranch_id, + sheepfold_id, + electronic_tags, + variety_id, + family, + type_id, + gender, + birthday, + birth_weight, + parity, + status_id, + weaning_date, + weaning_weight, + breed_status_id, + father_id, + mother_id, + receptor_id, + mating_date, + mating_type_id, + preg_date, + lambing_date, + lambing_day, + expected_date, + controlled, + mating_counts, + mating_total, + miscarriage_counts, + body, + breast, + source, + source_date, + source_ranch_id, + comment, + update_by, + update_time, + create_by, + create_time, + is_delete, + + + #{manageTags}, + #{ranchId}, + #{sheepfoldId}, + #{electronicTags}, + #{varietyId}, + #{family}, + #{typeId}, + #{gender}, + #{birthday}, + #{birthWeight}, + #{parity}, + #{statusId}, + #{weaningDate}, + #{weaningWeight}, + #{breedStatusId}, + #{fatherId}, + #{motherId}, + #{receptorId}, + #{matingDate}, + #{matingTypeId}, + #{pregDate}, + #{lambingDate}, + #{lambingDay}, + #{expectedDate}, + #{controlled}, + #{matingCounts}, + #{matingTotal}, + #{miscarriageCounts}, + #{body}, + #{breast}, + #{source}, + #{sourceDate}, + #{sourceRanchId}, + #{comment}, + #{updateBy}, + #{updateTime}, + #{createBy}, + #{createTime}, + #{isDelete}, + + + + + update bas_sheep + + manage_tags = #{manageTags}, + ranch_id = #{ranchId}, + sheepfold_id = #{sheepfoldId}, + electronic_tags = #{electronicTags}, + variety_id = #{varietyId}, + family = #{family}, + type_id = #{typeId}, + gender = #{gender}, + birthday = #{birthday}, + birth_weight = #{birthWeight}, + parity = #{parity}, + status_id = #{statusId}, + weaning_date = #{weaningDate}, + weaning_weight = #{weaningWeight}, + breed_status_id = #{breedStatusId}, + father_id = #{fatherId}, + mother_id = #{motherId}, + receptor_id = #{receptorId}, + mating_date = #{matingDate}, + mating_type_id = #{matingTypeId}, + preg_date = #{pregDate}, + lambing_date = #{lambingDate}, + lambing_day = #{lambingDay}, + expected_date = #{expectedDate}, + controlled = #{controlled}, + mating_counts = #{matingCounts}, + mating_total = #{matingTotal}, + miscarriage_counts = #{miscarriageCounts}, + body = #{body}, + breast = #{breast}, + source = #{source}, + source_date = #{sourceDate}, + source_ranch_id = #{sourceRanchId}, + comment = #{comment}, + update_by = #{updateBy}, + update_time = #{updateTime}, + create_by = #{createBy}, + create_time = #{createTime}, + is_delete = #{isDelete}, + + where id = #{id} + + + + delete from bas_sheep where id = #{id} + + + + delete from bas_sheep where id in + + #{id} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/sheep_file/SheepFileMapper.xml b/zhyc-module/src/main/resources/mapper/sheep_file/SheepFileMapper.xml index 5008631..40bd0ef 100644 --- a/zhyc-module/src/main/resources/mapper/sheep_file/SheepFileMapper.xml +++ b/zhyc-module/src/main/resources/mapper/sheep_file/SheepFileMapper.xml @@ -311,4 +311,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + \ No newline at end of file