diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/controller/BasSheepController.java b/zhyc-module/src/main/java/com/zhyc/module/base/controller/BasSheepController.java index 54f3003..fede094 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/controller/BasSheepController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/controller/BasSheepController.java @@ -1,11 +1,16 @@ package com.zhyc.module.base.controller; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletResponse; import com.zhyc.module.base.domain.BasSheep; +import com.zhyc.module.base.domain.BasSheepVariety; import com.zhyc.module.base.mapper.BasSheepMapper; import com.zhyc.module.base.service.IBasSheepService; +import com.zhyc.module.base.service.IBasSheepVarietyService; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -18,26 +23,25 @@ import com.zhyc.common.core.page.TableDataInfo; /** * 羊只基本信息Controller - * + * * @author ruoyi * @date 2025-07-15 */ @RestController @RequestMapping("/sheep/sheep") -public class BasSheepController extends BaseController -{ +public class BasSheepController extends BaseController { @Autowired private IBasSheepService basSheepService; @Autowired - private BasSheepMapper basSheepMapper; + private IBasSheepVarietyService basSheepVarietyService; + /** * 查询羊只基本信息列表 */ @PreAuthorize("@ss.hasPermi('sheep:sheep:list')") @GetMapping("/list") - public TableDataInfo list(BasSheep basSheep) - { + public TableDataInfo list(BasSheep basSheep) { startPage(); List list = basSheepService.selectBasSheepList(basSheep); return getDataTable(list); @@ -49,8 +53,7 @@ public class BasSheepController extends BaseController @PreAuthorize("@ss.hasPermi('sheep:sheep:export')") @Log(title = "羊只基本信息", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, BasSheep basSheep) - { + public void export(HttpServletResponse response, BasSheep basSheep) { List list = basSheepService.selectBasSheepList(basSheep); ExcelUtil util = new ExcelUtil(BasSheep.class); util.exportExcel(response, list, "羊只基本信息数据"); @@ -61,8 +64,7 @@ public class BasSheepController extends BaseController */ @PreAuthorize("@ss.hasPermi('sheep:sheep:query')") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { + public AjaxResult getInfo(@PathVariable("id") Long id) { return success(basSheepService.selectBasSheepById(id)); } @@ -72,8 +74,7 @@ public class BasSheepController extends BaseController @PreAuthorize("@ss.hasPermi('sheep:sheep:add')") @Log(title = "羊只基本信息", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody BasSheep basSheep) - { + public AjaxResult add(@RequestBody BasSheep basSheep) { return toAjax(basSheepService.insertBasSheep(basSheep)); } @@ -83,8 +84,7 @@ public class BasSheepController extends BaseController @PreAuthorize("@ss.hasPermi('sheep:sheep:edit')") @Log(title = "羊只基本信息", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody BasSheep basSheep) - { + public AjaxResult edit(@RequestBody BasSheep basSheep) { return toAjax(basSheepService.updateBasSheep(basSheep)); } @@ -93,19 +93,112 @@ public class BasSheepController extends BaseController */ @PreAuthorize("@ss.hasPermi('sheep:sheep:remove')") @Log(title = "羊只基本信息", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(basSheepService.deleteBasSheepByIds(ids)); } - + /** + * 根据耳号查询 + */ @GetMapping("/byManageTags/{manageTags}") - public AjaxResult byManageTags(@PathVariable String manageTags){ + public AjaxResult byManageTags(@PathVariable String manageTags) { BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim()); + if (sheep == null) { + return error("未找到对应的羊只"); + } + + // 补品种名称 + BasSheepVariety variety = basSheepVarietyService.selectBasSheepVarietyById(sheep.getVarietyId()); + sheep.setVarietyName(variety == null ? "" : variety.getVariety()); + return success(sheep); } + /** + * 根据羊只类型ID查询羊只列表 + */ + @PreAuthorize("@ss.hasPermi('sheep:sheep:query')") + @GetMapping("/listByTypeId") + public TableDataInfo listByTypeId(Integer typeId) { + if (typeId == null) { + return getDataTable(new ArrayList<>()); + } + BasSheep query = new BasSheep(); + query.setTypeId(typeId.longValue()); + startPage(); + List list = basSheepService.selectBasSheepList(query); + return getDataTable(list); + } + + /** + * 根据羊舍ID和羊只类型ID组合查询羊只列表 + */ + @PreAuthorize("@ss.hasPermi('sheep:sheep:query')") + @GetMapping("/listBySheepfoldAndType") + public TableDataInfo listBySheepfoldAndType(Integer sheepfoldId, Integer typeId) { + if (sheepfoldId == null || typeId == null) { + return getDataTable(new ArrayList<>()); + } + BasSheep query = new BasSheep(); + query.setSheepfoldId(sheepfoldId.longValue()); + query.setTypeId(typeId.longValue()); + startPage(); + List list = basSheepService.selectBasSheepList(query); + return getDataTable(list); + } + /** + * 根据耳号(管理耳号或电子耳号)+ 耳号类型 查询羊只信息 + * earType:0-电子耳号,1-管理耳号 + */ + @GetMapping("/byEarNumber") + public AjaxResult byEarNumber(@RequestParam String earNumber, @RequestParam Integer earType) { + BasSheep query = new BasSheep(); + query.setManageTags(earNumber); + List list = basSheepService.selectBasSheepList(query); + + if (list.isEmpty()) { + query.setManageTags(null); + query.setElectronicTags(earNumber); + list = basSheepService.selectBasSheepList(query); + } + + if (list.isEmpty()) { + return error("未找到对应的羊只"); + } + + BasSheep sheep = list.get(0); + + String oldTag = earType == 0 ? sheep.getElectronicTags() : sheep.getManageTags(); + + Map result = new HashMap<>(); + result.put("sheep", sheep); + result.put("oldTag", oldTag); + + return success(result); + } + + + /** + * 判断耳号是否存在(用于新增羊只时校验) + */ + @GetMapping("/existsByManageTags/{manageTags}") + public AjaxResult existsByManageTags(@PathVariable String manageTags) { + BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim()); + if (sheep != null) { + return success(true); + } + return success(false); + } + + + @GetMapping("/existsByTag") + public AjaxResult existsByTag(@RequestParam String tag, @RequestParam Integer earType) { + boolean exists = basSheepService.existsByTag(tag, earType); + Map result = new HashMap<>(); + result.put("exists", exists); + return success(result); + } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/controller/BasSheepGroupMappingController.java b/zhyc-module/src/main/java/com/zhyc/module/base/controller/BasSheepGroupMappingController.java index ae73bad..31196e4 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/controller/BasSheepGroupMappingController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/controller/BasSheepGroupMappingController.java @@ -18,6 +18,11 @@ import com.zhyc.module.base.service.IBasSheepGroupMappingService; import com.zhyc.common.utils.poi.ExcelUtil; import com.zhyc.common.core.page.TableDataInfo; +// 1. 导入 +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + /** * 羊只分组关联Controller * @@ -43,6 +48,10 @@ public class BasSheepGroupMappingController extends BaseController return getDataTable(list); } + // 2. 声明(放在类内部、方法外部) + private static final Logger log = LoggerFactory.getLogger(BasSheepGroupMappingController.class); + + @PreAuthorize("@ss.hasPermi('sheep_grouping:sheep_grouping:list')") @GetMapping("/listJoin") public TableDataInfo list( @@ -103,7 +112,11 @@ public class BasSheepGroupMappingController extends BaseController @PutMapping public AjaxResult edit(@RequestBody BasSheepGroupMapping basSheepGroupMapping) { - return toAjax(basSheepGroupMappingService.updateBasSheepGroupMapping(basSheepGroupMapping)); + try { + return toAjax(basSheepGroupMappingService.updateBasSheepGroupMapping(basSheepGroupMapping)); + } catch (RuntimeException e) { + return error(e.getMessage()); + } } /** @@ -116,4 +129,20 @@ public class BasSheepGroupMappingController extends BaseController { return toAjax(basSheepGroupMappingService.deleteBasSheepGroupMappingByIds(ids)); } + + + @PostMapping("/addByEarTags") + public AjaxResult addByEarTags(@RequestBody Map params) { + List earTags = (List) params.get("earTags"); + Long groupId = Long.valueOf(params.get("groupId").toString()); + + if (earTags == null || earTags.isEmpty()) { + return error("耳号列表不能为空"); + } + + return basSheepGroupMappingService.addByEarTags(earTags, groupId); + } + + + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/controller/BasSheepTypeController.java b/zhyc-module/src/main/java/com/zhyc/module/base/controller/BasSheepTypeController.java new file mode 100644 index 0000000..f847204 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/base/controller/BasSheepTypeController.java @@ -0,0 +1,114 @@ +package com.zhyc.module.base.controller; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletResponse; + +import com.zhyc.module.base.domain.BasSheep; +import com.zhyc.module.base.service.IBasSheepService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.zhyc.common.annotation.Log; +import com.zhyc.common.core.controller.BaseController; +import com.zhyc.common.core.domain.AjaxResult; +import com.zhyc.common.enums.BusinessType; +import com.zhyc.module.base.domain.BasSheepType; +import com.zhyc.module.base.service.IBasSheepTypeService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 羊只类型Controller + * + * @author ruoyi + * @date 2025-07-22 + */ +@RestController +@RequestMapping("/base/base") +public class BasSheepTypeController extends BaseController +{ + @Autowired + private IBasSheepTypeService basSheepTypeService; + + @Autowired + private IBasSheepService basSheepService; + /** + * 查询羊只类型列表 + */ + @PreAuthorize("@ss.hasPermi('base:base:list')") + @GetMapping("/list") + public TableDataInfo list(BasSheepType basSheepType) + { + startPage(); + List list = basSheepTypeService.selectBasSheepTypeList(basSheepType); + return getDataTable(list); + } + + /** + * 导出羊只类型列表 + */ + @PreAuthorize("@ss.hasPermi('base:base:export')") + @Log(title = "羊只类型", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, BasSheepType basSheepType) + { + List list = basSheepTypeService.selectBasSheepTypeList(basSheepType); + ExcelUtil util = new ExcelUtil(BasSheepType.class); + util.exportExcel(response, list, "羊只类型数据"); + } + + /** + * 获取羊只类型详细信息 + */ + @PreAuthorize("@ss.hasPermi('base:base:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Integer id) + { + return success(basSheepTypeService.selectBasSheepTypeById(id)); + } + + /** + * 新增羊只类型 + */ + @PreAuthorize("@ss.hasPermi('base:base:add')") + @Log(title = "羊只类型", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody BasSheepType basSheepType) + { + return toAjax(basSheepTypeService.insertBasSheepType(basSheepType)); + } + + /** + * 修改羊只类型 + */ + @PreAuthorize("@ss.hasPermi('base:base:edit')") + @Log(title = "羊只类型", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody BasSheepType basSheepType) + { + return toAjax(basSheepTypeService.updateBasSheepType(basSheepType)); + } + + /** + * 删除羊只类型 + */ + @PreAuthorize("@ss.hasPermi('base:base:remove')") + @Log(title = "羊只类型", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Integer[] ids) + { + return toAjax(basSheepTypeService.deleteBasSheepTypeByIds(ids)); + } + + +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/controller/DaRanchController.java b/zhyc-module/src/main/java/com/zhyc/module/base/controller/DaRanchController.java new file mode 100644 index 0000000..a519335 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/base/controller/DaRanchController.java @@ -0,0 +1,119 @@ +package com.zhyc.module.base.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.zhyc.module.base.domain.BasSheep; +import com.zhyc.module.base.service.IBasSheepService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.zhyc.common.annotation.Log; +import com.zhyc.common.core.controller.BaseController; +import com.zhyc.common.core.domain.AjaxResult; +import com.zhyc.common.enums.BusinessType; +import com.zhyc.module.base.domain.DaRanch; +import com.zhyc.module.base.service.IDaRanchService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 牧场管理Controller + * + * @author ruoyi + * @date 2025-07-22 + */ +@RestController +@RequestMapping("/ranch/ranch") +public class DaRanchController extends BaseController +{ + @Autowired + private IDaRanchService daRanchService; + + @Autowired + private IBasSheepService basSheepService; + /** + * 查询牧场管理列表 + */ + @PreAuthorize("@ss.hasPermi('ranch:ranch:list')") + @GetMapping("/list") + public TableDataInfo list(DaRanch daRanch) + { + startPage(); + List list = daRanchService.selectDaRanchList(daRanch); + return getDataTable(list); + } + + /** + * 导出牧场管理列表 + */ + @PreAuthorize("@ss.hasPermi('ranch:ranch:export')") + @Log(title = "牧场管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DaRanch daRanch) + { + List list = daRanchService.selectDaRanchList(daRanch); + ExcelUtil util = new ExcelUtil(DaRanch.class); + util.exportExcel(response, list, "牧场管理数据"); + } + + /** + * 获取牧场管理详细信息 + */ + @PreAuthorize("@ss.hasPermi('ranch:ranch:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(daRanchService.selectDaRanchById(id)); + } + + /** + * 获取指定牧场下的所有羊只耳号 + */ + @GetMapping("/getSheepByRanchId/{ranchId}") + public AjaxResult getSheepByRanchId(@PathVariable Long ranchId) { + List sheepList = basSheepService.getSheepByRanchId(ranchId); + return AjaxResult.success(sheepList); + } + + + /** + * 新增牧场管理 + */ + @PreAuthorize("@ss.hasPermi('ranch:ranch:add')") + @Log(title = "牧场管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DaRanch daRanch) + { + return toAjax(daRanchService.insertDaRanch(daRanch)); + } + + /** + * 修改牧场管理 + */ + @PreAuthorize("@ss.hasPermi('ranch:ranch:edit')") + @Log(title = "牧场管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DaRanch daRanch) + { + return toAjax(daRanchService.updateDaRanch(daRanch)); + } + + /** + * 删除牧场管理 + */ + @PreAuthorize("@ss.hasPermi('ranch:ranch:remove')") + @Log(title = "牧场管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(daRanchService.deleteDaRanchByIds(ids)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/controller/SheepFileController.java b/zhyc-module/src/main/java/com/zhyc/module/base/controller/SheepFileController.java index dc1c0c2..5046e7c 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/controller/SheepFileController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/controller/SheepFileController.java @@ -6,6 +6,7 @@ import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.common.core.page.TableDataInfo; import com.zhyc.common.enums.BusinessType; import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.module.base.domain.BasSheep; import com.zhyc.module.base.domain.SheepFile; import com.zhyc.module.base.service.ISheepFileService; import org.springframework.beans.factory.annotation.Autowired; @@ -63,36 +64,40 @@ public class SheepFileController extends BaseController return success(sheepFileService.selectSheepFileById(id)); } - /** - * 新增羊只档案 - */ - @PreAuthorize("@ss.hasPermi('sheep_file:sheep_file:add')") - @Log(title = "羊只档案", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody SheepFile sheepFile) - { - return toAjax(sheepFileService.insertSheepFile(sheepFile)); + /* + * 根据耳号查询是否存在羊舍 + * */ + @GetMapping("/byNo/{manageTags}") + public AjaxResult byManageTags(@PathVariable String manageTags){ + SheepFile sheep=sheepFileService.selectBasSheepByManageTags(manageTags.trim()); + return success(sheep); } - /** - * 修改羊只档案 - */ - @PreAuthorize("@ss.hasPermi('sheep_file:sheep_file:edit')") - @Log(title = "羊只档案", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody SheepFile sheepFile) - { - return toAjax(sheepFileService.updateSheepFile(sheepFile)); + + @GetMapping("/stat/sheepType") + public AjaxResult statSheepType() { + return success(sheepFileService.countBySheepType()); } - /** - * 删除羊只档案 - */ - @PreAuthorize("@ss.hasPermi('sheep_file:sheep_file:remove')") - @Log(title = "羊只档案", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(sheepFileService.deleteSheepFileByIds(ids)); + @GetMapping("/stat/breedStatus") + public AjaxResult statBreedStatus() { + return success(sheepFileService.countByBreedStatus()); } + + @GetMapping("/stat/variety") + public AjaxResult statVariety() { + return success(sheepFileService.countByVariety()); + } + + @GetMapping("/stat/lactationParity") + public AjaxResult statLactationParity() { + return success(sheepFileService.countParityOfLactation()); + } + + // 在群总数 + @GetMapping("/stat/inGroupCount") + public AjaxResult inGroupCount() { + return success(sheepFileService.countInGroup()); + } + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheep.java b/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheep.java index f202443..047d376 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheep.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheep.java @@ -48,6 +48,9 @@ public class BasSheep extends BaseEntity @Excel(name = "品种id") private Long varietyId; + //仅用于改品种页面的回显 + private String varietyName; + /** 家系 */ @Excel(name = "家系") private String family; diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheepGroup.java b/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheepGroup.java index bd1a9f4..810cad1 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheepGroup.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheepGroup.java @@ -2,6 +2,9 @@ package com.zhyc.module.base.domain; import com.zhyc.common.annotation.Excel; import com.zhyc.common.core.domain.TreeEntity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -11,6 +14,9 @@ import org.apache.commons.lang3.builder.ToStringStyle; * @author wyt * @date 2025-07-14 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class BasSheepGroup extends TreeEntity { private static final long serialVersionUID = 1L; @@ -35,79 +41,4 @@ public class BasSheepGroup extends TreeEntity @Excel(name = "祖级列表名称") private String ancestorNames; - public void setAncestorNames(String ancestorNames) { - this.ancestorNames = ancestorNames; - } - - public String getAncestorNames() { - return ancestorNames; - } - - @Override - public String getAncestors() { - return ancestors; - } - - @Override - public void setAncestors(String ancestors) { - this.ancestors = ancestors; - } - - /** 是否为叶子节点 */ - private Boolean isLeaf; - - // ... getter 和 setter - public Boolean getIsLeaf() { - return isLeaf; - } - - public void setIsLeaf(Boolean isLeaf) { - this.isLeaf = isLeaf; - } - - public void setGroupId(Long groupId) - { - this.groupId = groupId; - } - - public Long getGroupId() - { - return groupId; - } - - public void setGroupName(String groupName) - { - this.groupName = groupName; - } - - public String getGroupName() - { - return groupName; - } - - public void setStatus(String status) - { - this.status = status; - } - - public String getStatus() - { - return status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("groupId", getGroupId()) - .append("parentId", getParentId()) - .append("groupName", getGroupName()) - .append("ancestors", getAncestors()) - .append("ancestorNames", getAncestorNames()) // 新增这一行 - .append("status", getStatus()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheepGroupMapping.java b/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheepGroupMapping.java index 2dfdd71..eed7c36 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheepGroupMapping.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheepGroupMapping.java @@ -1,5 +1,8 @@ package com.zhyc.module.base.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 wyt * @date 2025-07-16 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class BasSheepGroupMapping extends BaseEntity { private static final long serialVersionUID = 1L; @@ -27,42 +33,4 @@ public class BasSheepGroupMapping extends BaseEntity @Excel(name = "分组ID") private Long groupId; - 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 setGroupId(Long groupId) - { - this.groupId = groupId; - } - - public Long getGroupId() - { - return groupId; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("sheepId", getSheepId()) - .append("groupId", getGroupId()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheepType.java b/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheepType.java new file mode 100644 index 0000000..edf709e --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheepType.java @@ -0,0 +1,31 @@ +package com.zhyc.module.base.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; + +/** + * 羊只类型对象 bas_sheep_type + * + * @author ruoyi + * @date 2025-07-22 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class BasSheepType extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Integer id; + + /** 羊只类型 */ + private String name; + + +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheepVariety.java b/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheepVariety.java index df8c797..56e8a36 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheepVariety.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/domain/BasSheepVariety.java @@ -1,5 +1,8 @@ package com.zhyc.module.base.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-15 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class BasSheepVariety extends BaseEntity { private static final long serialVersionUID = 1L; @@ -22,31 +28,4 @@ public class BasSheepVariety extends BaseEntity @Excel(name = "品种") private String variety; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setVariety(String variety) - { - this.variety = variety; - } - - public String getVariety() - { - return variety; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("variety", getVariety()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/domain/DaRanch.java b/zhyc-module/src/main/java/com/zhyc/module/base/domain/DaRanch.java new file mode 100644 index 0000000..ef3c938 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/base/domain/DaRanch.java @@ -0,0 +1,31 @@ +package com.zhyc.module.base.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; + +/** + * 牧场管理对象 da_ranch + * + * @author ruoyi + * @date 2025-07-22 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DaRanch extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** 牧场名称 */ + private String ranch; + + +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/domain/DaSheepfold.java b/zhyc-module/src/main/java/com/zhyc/module/base/domain/DaSheepfold.java index 75bf6c4..0216feb 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/domain/DaSheepfold.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/domain/DaSheepfold.java @@ -2,6 +2,9 @@ package com.zhyc.module.base.domain; import com.zhyc.common.annotation.Excel; import com.zhyc.common.core.domain.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -11,6 +14,9 @@ import org.apache.commons.lang3.builder.ToStringStyle; * @author wyt * @date 2025-07-11 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class DaSheepfold extends BaseEntity { private static final long serialVersionUID = 1L; @@ -47,97 +53,5 @@ public class DaSheepfold extends BaseEntity @Excel(name = "备注") private String comment; - public void setId(Long id) - { - this.id = id; - } - public Long getId() - { - return id; - } - - public void setRanchId(Long ranchId) - { - this.ranchId = ranchId; - } - - public Long getRanchId() - { - return ranchId; - } - - public void setSheepfoldName(String sheepfoldName) - { - this.sheepfoldName = sheepfoldName; - } - - public String getSheepfoldName() - { - return sheepfoldName; - } - - public void setSheepfoldTypeId(Long sheepfoldTypeId) - { - this.sheepfoldTypeId = sheepfoldTypeId; - } - - public Long getSheepfoldTypeId() - { - return sheepfoldTypeId; - } - - public void setSheepfoldNo(String sheepfoldNo) - { - this.sheepfoldNo = sheepfoldNo; - } - - public String getSheepfoldNo() - { - return sheepfoldNo; - } - - public void setRowNo(String rowNo) - { - this.rowNo = rowNo; - } - - public String getRowNo() - { - return rowNo; - } - - public void setColumns(String columns) - { - this.columns = columns; - } - - public String getColumns() - { - return columns; - } - - 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("ranchId", getRanchId()) - .append("sheepfoldName", getSheepfoldName()) - .append("sheepfoldTypeId", getSheepfoldTypeId()) - .append("sheepfoldNo", getSheepfoldNo()) - .append("rowNo", getRowNo()) - .append("columns", getColumns()) - .append("comment", getComment()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/domain/SheepFile.java b/zhyc-module/src/main/java/com/zhyc/module/base/domain/SheepFile.java index 8a2cf3a..acefce9 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/domain/SheepFile.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/domain/SheepFile.java @@ -3,7 +3,9 @@ package com.zhyc.module.base.domain; import com.fasterxml.jackson.annotation.JsonFormat; import com.zhyc.common.annotation.Excel; import com.zhyc.common.core.domain.BaseEntity; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -16,6 +18,8 @@ import java.util.Date; * @date 2025-07-13 */ @Data +@NoArgsConstructor +@AllArgsConstructor public class SheepFile extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepGroupMapper.java b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepGroupMapper.java index 575929b..52abe57 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepGroupMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepGroupMapper.java @@ -1,6 +1,7 @@ package com.zhyc.module.base.mapper; import com.zhyc.module.base.domain.BasSheepGroup; +import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -10,6 +11,7 @@ import java.util.List; * @author wyt * @date 2025-07-14 */ +@Mapper public interface BasSheepGroupMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepGroupMappingMapper.java b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepGroupMappingMapper.java index caf186e..2e4f1cc 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepGroupMappingMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepGroupMappingMapper.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Map; import com.zhyc.module.base.domain.BasSheepGroupMapping; +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; /** * 羊只分组关联Mapper接口 @@ -11,6 +12,7 @@ import org.apache.ibatis.annotations.Param; * @author wyt * @date 2025-07-16 */ +@Mapper public interface BasSheepGroupMappingMapper { /** @@ -76,4 +78,11 @@ public interface BasSheepGroupMappingMapper public int deleteBasSheepGroupMappingByIds(Long[] ids); + List> selectSheepIdsByEarTags(@Param("earTags") List earTags); + + int batchInsert(@Param("list") List list); + + + List selectListByGroupId(@Param("groupId") Long groupId); + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepMapper.java b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepMapper.java index 91febb6..1b16800 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepMapper.java @@ -3,6 +3,7 @@ package com.zhyc.module.base.mapper; import java.util.List; import com.zhyc.module.base.domain.BasSheep; +import org.apache.ibatis.annotations.Param; /** * 羊只基本信息Mapper接口 @@ -68,4 +69,13 @@ public interface BasSheepMapper List selectBasSheepBySheepfold(String id); + +// 根据牧场ID获取羊只列表 + List getSheepByRanchId(Long ranchId); + + List selectBasSheepListByIds(List ids); + + //用于校验改耳号部分新管理/电子耳号 + int existsByManageTag(@Param("tag") String tag); + int existsByElectronicTag(@Param("tag") String tag); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepTypeMapper.java b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepTypeMapper.java new file mode 100644 index 0000000..4afe2e9 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepTypeMapper.java @@ -0,0 +1,61 @@ +package com.zhyc.module.base.mapper; + +import java.util.List; +import com.zhyc.module.base.domain.BasSheepType; + +/** + * 羊只类型Mapper接口 + * + * @author ruoyi + * @date 2025-07-22 + */ +public interface BasSheepTypeMapper +{ + /** + * 查询羊只类型 + * + * @param id 羊只类型主键 + * @return 羊只类型 + */ + public BasSheepType selectBasSheepTypeById(Integer id); + + /** + * 查询羊只类型列表 + * + * @param basSheepType 羊只类型 + * @return 羊只类型集合 + */ + public List selectBasSheepTypeList(BasSheepType basSheepType); + + /** + * 新增羊只类型 + * + * @param basSheepType 羊只类型 + * @return 结果 + */ + public int insertBasSheepType(BasSheepType basSheepType); + + /** + * 修改羊只类型 + * + * @param basSheepType 羊只类型 + * @return 结果 + */ + public int updateBasSheepType(BasSheepType basSheepType); + + /** + * 删除羊只类型 + * + * @param id 羊只类型主键 + * @return 结果 + */ + public int deleteBasSheepTypeById(Integer id); + + /** + * 批量删除羊只类型 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBasSheepTypeByIds(Integer[] ids); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepVarietyMapper.java b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepVarietyMapper.java index 4135097..0802830 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepVarietyMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/BasSheepVarietyMapper.java @@ -3,6 +3,7 @@ package com.zhyc.module.base.mapper; import java.util.List; import com.zhyc.module.base.domain.BasSheepVariety; +import org.apache.ibatis.annotations.Mapper; /** * 羊只品种Mapper接口 @@ -10,6 +11,7 @@ import com.zhyc.module.base.domain.BasSheepVariety; * @author ruoyi * @date 2025-07-15 */ +@Mapper public interface BasSheepVarietyMapper { /** @@ -59,4 +61,15 @@ public interface BasSheepVarietyMapper * @return 结果 */ public int deleteBasSheepVarietyByIds(Long[] ids); + + + /** + * 根据品种名称查询品种 ID 用于导入羊只 + * + * @param varietyName 品种名称 + * @return 品种 ID + */ + Long selectIdByName(String varietyName); + + BasSheepVariety selectByVarietyName(String varietyName); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/DaRanchMapper.java b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/DaRanchMapper.java new file mode 100644 index 0000000..5e3c949 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/DaRanchMapper.java @@ -0,0 +1,61 @@ +package com.zhyc.module.base.mapper; + +import java.util.List; +import com.zhyc.module.base.domain.DaRanch; + +/** + * 牧场管理Mapper接口 + * + * @author ruoyi + * @date 2025-07-22 + */ +public interface DaRanchMapper +{ + /** + * 查询牧场管理 + * + * @param id 牧场管理主键 + * @return 牧场管理 + */ + public DaRanch selectDaRanchById(Long id); + + /** + * 查询牧场管理列表 + * + * @param daRanch 牧场管理 + * @return 牧场管理集合 + */ + public List selectDaRanchList(DaRanch daRanch); + + /** + * 新增牧场管理 + * + * @param daRanch 牧场管理 + * @return 结果 + */ + public int insertDaRanch(DaRanch daRanch); + + /** + * 修改牧场管理 + * + * @param daRanch 牧场管理 + * @return 结果 + */ + public int updateDaRanch(DaRanch daRanch); + + /** + * 删除牧场管理 + * + * @param id 牧场管理主键 + * @return 结果 + */ + public int deleteDaRanchById(Long id); + + /** + * 批量删除牧场管理 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDaRanchByIds(Long[] ids); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/DaSheepfoldMapper.java b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/DaSheepfoldMapper.java index 21bb2d0..9b690ce 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/DaSheepfoldMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/DaSheepfoldMapper.java @@ -1,6 +1,7 @@ package com.zhyc.module.base.mapper; import com.zhyc.module.base.domain.DaSheepfold; +import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -10,6 +11,7 @@ import java.util.List; * @author wyt * @date 2025-07-11 */ +@Mapper public interface DaSheepfoldMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/SheepFileMapper.java b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/SheepFileMapper.java index b4af8dc..9d4fc5a 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/mapper/SheepFileMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/mapper/SheepFileMapper.java @@ -1,8 +1,10 @@ package com.zhyc.module.base.mapper; import com.zhyc.module.base.domain.SheepFile; +import org.apache.ibatis.annotations.Mapper; import java.util.List; +import java.util.Map; /** * 羊只档案Mapper接口 @@ -10,6 +12,7 @@ import java.util.List; * @author wyt * @date 2025-07-13 */ +@Mapper public interface SheepFileMapper { /** @@ -28,36 +31,33 @@ public interface SheepFileMapper */ public List selectSheepFileList(SheepFile sheepFile); - /** - * 新增羊只档案 - * - * @param sheepFile 羊只档案 - * @return 结果 - */ - public int insertSheepFile(SheepFile sheepFile); /** - * 修改羊只档案 + * 根据管理耳号查询 * - * @param sheepFile 羊只档案 + * @param tags 管理耳号 * @return 结果 */ - public int updateSheepFile(SheepFile sheepFile); + SheepFile selectSheepByManageTags(String tags); + + + // 在群羊只总数 + Long countInGroup(); + + + // 羊只类别分布(按 name 分组) + List> countBySheepType(); + + // 繁育状态分布(按 breed 分组) + List> countByBreedStatus(); + + // 品种分布(按 variety 分组) + List> countByVariety(); + + // 泌乳羊胎次分布(name = '泌乳羊' 时按 parity 分组) + List> countParityOfLactation(); + - /** - * 删除羊只档案 - * - * @param id 羊只档案主键 - * @return 结果 - */ - public int deleteSheepFileById(Long id); - /** - * 批量删除羊只档案 - * - * @param ids 需要删除的数据主键集合 - * @return 结果 - */ - public int deleteSheepFileByIds(Long[] ids); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/service/IBasSheepGroupMappingService.java b/zhyc-module/src/main/java/com/zhyc/module/base/service/IBasSheepGroupMappingService.java index a9f08a1..d6b5c7a 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/service/IBasSheepGroupMappingService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/service/IBasSheepGroupMappingService.java @@ -3,6 +3,7 @@ package com.zhyc.module.base.service; import java.util.List; import java.util.Map; +import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.module.base.domain.BasSheepGroupMapping; /** @@ -67,4 +68,6 @@ public interface IBasSheepGroupMappingService * @return 结果 */ public int deleteBasSheepGroupMappingById(Long id); + + public AjaxResult addByEarTags(List earTags, Long groupId); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/service/IBasSheepService.java b/zhyc-module/src/main/java/com/zhyc/module/base/service/IBasSheepService.java index 5e87c22..18c7351 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/service/IBasSheepService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/service/IBasSheepService.java @@ -60,5 +60,18 @@ public interface IBasSheepService */ public int deleteBasSheepById(Long id); + /** + * 根据羊只耳号获取羊只 + */ BasSheep selectBasSheepByManageTags(String trim); + + /** + * 根据牧场ID获取羊只列表 + */ + List getSheepByRanchId(Long ranchId); + + List selectBasSheepListByIds(List ids); + + //校验新管理/电子耳号 + boolean existsByTag(String tag, Integer earType); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/service/IBasSheepTypeService.java b/zhyc-module/src/main/java/com/zhyc/module/base/service/IBasSheepTypeService.java new file mode 100644 index 0000000..5f9721d --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/base/service/IBasSheepTypeService.java @@ -0,0 +1,65 @@ +package com.zhyc.module.base.service; + +import java.util.List; + +import com.zhyc.module.base.domain.BasSheep; +import com.zhyc.module.base.domain.BasSheepType; + +/** + * 羊只类型Service接口 + * + * @author ruoyi + * @date 2025-07-22 + */ +public interface IBasSheepTypeService +{ + /** + * 查询羊只类型 + * + * @param id 羊只类型主键 + * @return 羊只类型 + */ + public BasSheepType selectBasSheepTypeById(Integer id); + + /** + * 查询羊只类型列表 + * + * @param basSheepType 羊只类型 + * @return 羊只类型集合 + */ + public List selectBasSheepTypeList(BasSheepType basSheepType); + + /** + * 新增羊只类型 + * + * @param basSheepType 羊只类型 + * @return 结果 + */ + public int insertBasSheepType(BasSheepType basSheepType); + + /** + * 修改羊只类型 + * + * @param basSheepType 羊只类型 + * @return 结果 + */ + public int updateBasSheepType(BasSheepType basSheepType); + + /** + * 批量删除羊只类型 + * + * @param ids 需要删除的羊只类型主键集合 + * @return 结果 + */ + public int deleteBasSheepTypeByIds(Integer[] ids); + + /** + * 删除羊只类型信息 + * + * @param id 羊只类型主键 + * @return 结果 + */ + public int deleteBasSheepTypeById(Integer id); + + +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/service/IBasSheepVarietyService.java b/zhyc-module/src/main/java/com/zhyc/module/base/service/IBasSheepVarietyService.java index 29b288f..04369a6 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/service/IBasSheepVarietyService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/service/IBasSheepVarietyService.java @@ -59,4 +59,9 @@ public interface IBasSheepVarietyService * @return 结果 */ public int deleteBasSheepVarietyById(Long id); + + + // 根据品种名称查询品种 + public BasSheepVariety selectByVarietyName(String varietyName); + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/service/IDaRanchService.java b/zhyc-module/src/main/java/com/zhyc/module/base/service/IDaRanchService.java new file mode 100644 index 0000000..5428460 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/base/service/IDaRanchService.java @@ -0,0 +1,61 @@ +package com.zhyc.module.base.service; + +import java.util.List; +import com.zhyc.module.base.domain.DaRanch; + +/** + * 牧场管理Service接口 + * + * @author ruoyi + * @date 2025-07-22 + */ +public interface IDaRanchService +{ + /** + * 查询牧场管理 + * + * @param id 牧场管理主键 + * @return 牧场管理 + */ + public DaRanch selectDaRanchById(Long id); + + /** + * 查询牧场管理列表 + * + * @param daRanch 牧场管理 + * @return 牧场管理集合 + */ + public List selectDaRanchList(DaRanch daRanch); + + /** + * 新增牧场管理 + * + * @param daRanch 牧场管理 + * @return 结果 + */ + public int insertDaRanch(DaRanch daRanch); + + /** + * 修改牧场管理 + * + * @param daRanch 牧场管理 + * @return 结果 + */ + public int updateDaRanch(DaRanch daRanch); + + /** + * 批量删除牧场管理 + * + * @param ids 需要删除的牧场管理主键集合 + * @return 结果 + */ + public int deleteDaRanchByIds(Long[] ids); + + /** + * 删除牧场管理信息 + * + * @param id 牧场管理主键 + * @return 结果 + */ + public int deleteDaRanchById(Long id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/service/ISheepFileService.java b/zhyc-module/src/main/java/com/zhyc/module/base/service/ISheepFileService.java index 9084727..8280603 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/service/ISheepFileService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/service/ISheepFileService.java @@ -3,6 +3,7 @@ package com.zhyc.module.base.service; import com.zhyc.module.base.domain.SheepFile; import java.util.List; +import java.util.Map; /** * 羊只档案Service接口 @@ -28,35 +29,13 @@ public interface ISheepFileService */ public List selectSheepFileList(SheepFile sheepFile); - /** - * 新增羊只档案 - * - * @param sheepFile 羊只档案 - * @return 结果 - */ - public int insertSheepFile(SheepFile sheepFile); - /** - * 修改羊只档案 - * - * @param sheepFile 羊只档案 - * @return 结果 - */ - public int updateSheepFile(SheepFile sheepFile); + SheepFile selectBasSheepByManageTags(String trim); - /** - * 批量删除羊只档案 - * - * @param ids 需要删除的羊只档案主键集合 - * @return 结果 - */ - public int deleteSheepFileByIds(Long[] ids); + Long countInGroup(); - /** - * 删除羊只档案信息 - * - * @param id 羊只档案主键 - * @return 结果 - */ - public int deleteSheepFileById(Long id); + List> countBySheepType(); + List> countByBreedStatus(); + List> countByVariety(); + List> countParityOfLactation(); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/BasSheepGroupMappingServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/BasSheepGroupMappingServiceImpl.java index b0b38ab..74418da 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/BasSheepGroupMappingServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/BasSheepGroupMappingServiceImpl.java @@ -1,8 +1,9 @@ package com.zhyc.module.base.service.impl; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; +import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.module.base.domain.BasSheepGroupMapping; import com.zhyc.module.base.mapper.BasSheepGroupMappingMapper; import com.zhyc.module.base.service.IBasSheepGroupMappingService; @@ -70,9 +71,21 @@ public class BasSheepGroupMappingServiceImpl implements IBasSheepGroupMappingSer * @param basSheepGroupMapping 羊只分组关联 * @return 结果 */ +// @Override +// public int updateBasSheepGroupMapping(BasSheepGroupMapping basSheepGroupMapping) +// { +// return basSheepGroupMappingMapper.updateBasSheepGroupMapping(basSheepGroupMapping); +// } @Override - public int updateBasSheepGroupMapping(BasSheepGroupMapping basSheepGroupMapping) - { + public int updateBasSheepGroupMapping(BasSheepGroupMapping basSheepGroupMapping) { + + Long SheepId = basSheepGroupMapping.getSheepId(); + Long GroupId = basSheepGroupMapping.getGroupId(); + existsInGroup(SheepId,GroupId); + + if (existsInGroup(basSheepGroupMapping.getSheepId(), basSheepGroupMapping.getGroupId())) { + throw new RuntimeException("该羊已在此分组,无需修改"); + } return basSheepGroupMappingMapper.updateBasSheepGroupMapping(basSheepGroupMapping); } @@ -100,4 +113,77 @@ public class BasSheepGroupMappingServiceImpl implements IBasSheepGroupMappingSer return basSheepGroupMappingMapper.deleteBasSheepGroupMappingById(id); } + + + @Override + public AjaxResult addByEarTags(List earTags, Long groupId) { + // 1. 参数判空 + if (earTags == null || earTags.isEmpty()) { + return AjaxResult.error("耳号列表不能为空"); + } + + // 2. 根据耳号查询羊只(manage_tags -> id) + List> sheepList = basSheepGroupMappingMapper.selectSheepIdsByEarTags(earTags); + Map tagToId = new HashMap<>(); + for (Map s : sheepList) { + tagToId.put((String) s.get("manage_tags"), ((Number) s.get("id")).longValue()); + } + + // 3. 不存在的耳号 + List missing = new ArrayList<>(); + for (String tag : earTags) { + if (!tagToId.containsKey(tag)) { + missing.add(tag); + } + } + if (!missing.isEmpty()) { + Map res = new HashMap<>(); + res.put("success", false); + res.put("missing", missing); + return AjaxResult.success(res); + } + + // 4. 查询该分组下已存在的羊只ID + List existingRows = basSheepGroupMappingMapper.selectListByGroupId(groupId); + System.out.println("🔍 existingRows 类型 = " + existingRows.getClass()); + + Set existingIds = existingRows.stream() + .map(BasSheepGroupMapping::getSheepId) + .collect(Collectors.toSet()); + + System.out.println("🔍 existingIds = " + existingIds); + + // 5. 过滤出未在该分组的羊只 + List toInsert = new ArrayList<>(); + for (Map.Entry e : tagToId.entrySet()) { + Long sheepId = e.getValue(); + if (!existingIds.contains(sheepId)) { + BasSheepGroupMapping m = new BasSheepGroupMapping(); + m.setSheepId(sheepId); + m.setGroupId(groupId); + toInsert.add(m); + } + } + + if (toInsert.isEmpty()) { + return AjaxResult.success("所选羊只已全部在该分组中"); + } + + // 6. 批量插入 + int rows = basSheepGroupMappingMapper.batchInsert(toInsert); + Map res = new HashMap<>(); + res.put("success", true); + res.put("inserted", rows); + return AjaxResult.success(res); + } + + private boolean existsInGroup(Long sheepId, Long groupId) { + BasSheepGroupMapping param = new BasSheepGroupMapping(); + List> list = basSheepGroupMappingMapper + .selectBasSheepGroupMappingList(sheepId, groupId, null); + return !list.isEmpty(); + } + + + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/BasSheepServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/BasSheepServiceImpl.java index 36c8897..7135f73 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/BasSheepServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/BasSheepServiceImpl.java @@ -99,4 +99,27 @@ public class BasSheepServiceImpl implements IBasSheepService public BasSheep selectBasSheepByManageTags(String manageTags){ return basSheepMapper.selectBasSheepByManageTags(manageTags); } + + @Override + public List getSheepByRanchId(Long ranchId) { + return basSheepMapper.getSheepByRanchId(ranchId); + } + + @Override + public List selectBasSheepListByIds(List ids) { + return basSheepMapper.selectBasSheepListByIds(ids); + } + + //校验新管理/电子耳号 + @Override + public boolean existsByTag(String tag, Integer earType) { + if (earType == 0) { + return basSheepMapper.existsByElectronicTag(tag) > 0; + } else if (earType == 1) { + return basSheepMapper.existsByManageTag(tag) > 0; + } + return false; + } + + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/BasSheepTypeServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/BasSheepTypeServiceImpl.java new file mode 100644 index 0000000..4c1a362 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/BasSheepTypeServiceImpl.java @@ -0,0 +1,89 @@ +package com.zhyc.module.base.service.impl; + +import java.util.List; + +import com.zhyc.module.base.domain.BasSheep; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.base.mapper.BasSheepTypeMapper; +import com.zhyc.module.base.domain.BasSheepType; +import com.zhyc.module.base.service.IBasSheepTypeService; + +/** + * 羊只类型Service业务层处理 + * + * @author ruoyi + * @date 2025-07-22 + */ +@Service +public class BasSheepTypeServiceImpl implements IBasSheepTypeService { + @Autowired + private BasSheepTypeMapper basSheepTypeMapper; + + /** + * 查询羊只类型 + * + * @param id 羊只类型主键 + * @return 羊只类型 + */ + @Override + public BasSheepType selectBasSheepTypeById(Integer id) { + return basSheepTypeMapper.selectBasSheepTypeById(id); + } + + /** + * 查询羊只类型列表 + * + * @param basSheepType 羊只类型 + * @return 羊只类型 + */ + @Override + public List selectBasSheepTypeList(BasSheepType basSheepType) { + return basSheepTypeMapper.selectBasSheepTypeList(basSheepType); + } + + /** + * 新增羊只类型 + * + * @param basSheepType 羊只类型 + * @return 结果 + */ + @Override + public int insertBasSheepType(BasSheepType basSheepType) { + return basSheepTypeMapper.insertBasSheepType(basSheepType); + } + + /** + * 修改羊只类型 + * + * @param basSheepType 羊只类型 + * @return 结果 + */ + @Override + public int updateBasSheepType(BasSheepType basSheepType) { + return basSheepTypeMapper.updateBasSheepType(basSheepType); + } + + /** + * 批量删除羊只类型 + * + * @param ids 需要删除的羊只类型主键 + * @return 结果 + */ + @Override + public int deleteBasSheepTypeByIds(Integer[] ids) { + return basSheepTypeMapper.deleteBasSheepTypeByIds(ids); + } + + /** + * 删除羊只类型信息 + * + * @param id 羊只类型主键 + * @return 结果 + */ + @Override + public int deleteBasSheepTypeById(Integer id) { + return basSheepTypeMapper.deleteBasSheepTypeById(id); + } + +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/BasSheepVarietyServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/BasSheepVarietyServiceImpl.java index 048930e..7a1285f 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/BasSheepVarietyServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/BasSheepVarietyServiceImpl.java @@ -91,4 +91,9 @@ public class BasSheepVarietyServiceImpl implements IBasSheepVarietyService { return basSheepVarietyMapper.deleteBasSheepVarietyById(id); } + + @Override + public BasSheepVariety selectByVarietyName(String varietyName) { + return basSheepVarietyMapper.selectByVarietyName(varietyName); + } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/DaRanchServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/DaRanchServiceImpl.java new file mode 100644 index 0000000..fbdf04c --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/DaRanchServiceImpl.java @@ -0,0 +1,93 @@ +package com.zhyc.module.base.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.base.mapper.DaRanchMapper; +import com.zhyc.module.base.domain.DaRanch; +import com.zhyc.module.base.service.IDaRanchService; + +/** + * 牧场管理Service业务层处理 + * + * @author ruoyi + * @date 2025-07-22 + */ +@Service +public class DaRanchServiceImpl implements IDaRanchService +{ + @Autowired + private DaRanchMapper daRanchMapper; + + /** + * 查询牧场管理 + * + * @param id 牧场管理主键 + * @return 牧场管理 + */ + @Override + public DaRanch selectDaRanchById(Long id) + { + return daRanchMapper.selectDaRanchById(id); + } + + /** + * 查询牧场管理列表 + * + * @param daRanch 牧场管理 + * @return 牧场管理 + */ + @Override + public List selectDaRanchList(DaRanch daRanch) + { + return daRanchMapper.selectDaRanchList(daRanch); + } + + /** + * 新增牧场管理 + * + * @param daRanch 牧场管理 + * @return 结果 + */ + @Override + public int insertDaRanch(DaRanch daRanch) + { + return daRanchMapper.insertDaRanch(daRanch); + } + + /** + * 修改牧场管理 + * + * @param daRanch 牧场管理 + * @return 结果 + */ + @Override + public int updateDaRanch(DaRanch daRanch) + { + return daRanchMapper.updateDaRanch(daRanch); + } + + /** + * 批量删除牧场管理 + * + * @param ids 需要删除的牧场管理主键 + * @return 结果 + */ + @Override + public int deleteDaRanchByIds(Long[] ids) + { + return daRanchMapper.deleteDaRanchByIds(ids); + } + + /** + * 删除牧场管理信息 + * + * @param id 牧场管理主键 + * @return 结果 + */ + @Override + public int deleteDaRanchById(Long id) + { + return daRanchMapper.deleteDaRanchById(id); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/SheepFileServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/SheepFileServiceImpl.java index 9402a6b..351a4ad 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/SheepFileServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/base/service/impl/SheepFileServiceImpl.java @@ -7,7 +7,7 @@ import com.zhyc.module.base.service.ISheepFileService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.List; +import java.util.List;import java.util.Map; /** * 羊只档案Service业务层处理 @@ -16,82 +16,59 @@ import java.util.List; * @date 2025-07-13 */ @Service -public class SheepFileServiceImpl implements ISheepFileService -{ +public class SheepFileServiceImpl implements ISheepFileService { @Autowired private SheepFileMapper sheepFileMapper; /** * 查询羊只档案 - * + * * @param id 羊只档案主键 * @return 羊只档案 */ @Override - public SheepFile selectSheepFileById(Long id) - { + public SheepFile selectSheepFileById(Long id) { return sheepFileMapper.selectSheepFileById(id); } /** * 查询羊只档案列表 - * + * * @param sheepFile 羊只档案 * @return 羊只档案 */ @Override - public List selectSheepFileList(SheepFile sheepFile) - { + public List selectSheepFileList(SheepFile sheepFile) { return sheepFileMapper.selectSheepFileList(sheepFile); } - /** - * 新增羊只档案 - * - * @param sheepFile 羊只档案 - * @return 结果 - */ @Override - public int insertSheepFile(SheepFile sheepFile) - { - sheepFile.setCreateTime(DateUtils.getNowDate()); - return sheepFileMapper.insertSheepFile(sheepFile); + public SheepFile selectBasSheepByManageTags(String tags) { + return sheepFileMapper.selectSheepByManageTags(tags); } - /** - * 修改羊只档案 - * - * @param sheepFile 羊只档案 - * @return 结果 - */ + @Override - public int updateSheepFile(SheepFile sheepFile) - { - sheepFile.setUpdateTime(DateUtils.getNowDate()); - return sheepFileMapper.updateSheepFile(sheepFile); + public List> countBySheepType() { + return sheepFileMapper.countBySheepType(); } - /** - * 批量删除羊只档案 - * - * @param ids 需要删除的羊只档案主键 - * @return 结果 - */ @Override - public int deleteSheepFileByIds(Long[] ids) - { - return sheepFileMapper.deleteSheepFileByIds(ids); + public List> countByBreedStatus() { + return sheepFileMapper.countByBreedStatus(); } - /** - * 删除羊只档案信息 - * - * @param id 羊只档案主键 - * @return 结果 - */ @Override - public int deleteSheepFileById(Long id) - { - return sheepFileMapper.deleteSheepFileById(id); + public List> countByVariety() { + return sheepFileMapper.countByVariety(); } + + @Override + public List> countParityOfLactation() { + return sheepFileMapper.countParityOfLactation(); + } + @Override + public Long countInGroup() { return sheepFileMapper.countInGroup(); } + + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/DewormController.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/DewormController.java index 6b88da7..6fb5fba 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/DewormController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/DewormController.java @@ -78,6 +78,7 @@ public class DewormController extends BaseController @PostMapping public AjaxResult add(@RequestBody Deworm deworm) { + System.out.println(deworm); return toAjax(dewormService.insertDeworm(deworm)); } @@ -97,7 +98,7 @@ public class DewormController extends BaseController */ @PreAuthorize("@ss.hasPermi('biosafety:deworm:remove')") @Log(title = "驱虫", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") + @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(dewormService.deleteDewormByIds(ids)); diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/DiagnosisController.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/DiagnosisController.java index d8138a2..39149cc 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/DiagnosisController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/DiagnosisController.java @@ -96,7 +96,7 @@ public class DiagnosisController extends BaseController */ @PreAuthorize("@ss.hasPermi('diagnosis:diagnosis:remove')") @Log(title = "诊疗结果", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") + @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(diagnosisService.deleteDiagnosisByIds(ids)); diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/QuarantineReportController.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/QuarantineReportController.java index 5c6847e..1c06745 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/QuarantineReportController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/QuarantineReportController.java @@ -29,7 +29,7 @@ import com.zhyc.common.core.page.TableDataInfo; * @date 2025-07-14 */ @RestController -@RequestMapping("/bisosafety/quarantine") +@RequestMapping("/biosafety/quarantine") public class QuarantineReportController extends BaseController { @Autowired @@ -38,7 +38,7 @@ public class QuarantineReportController extends BaseController /** * 查询检疫记录列表 */ - @PreAuthorize("@ss.hasPermi('bisosafety:quarantine:list')") + @PreAuthorize("@ss.hasPermi('biosafety:quarantine:list')") @GetMapping("/list") public TableDataInfo list(QuarantineReport quarantineReport) { @@ -50,7 +50,7 @@ public class QuarantineReportController extends BaseController /** * 导出检疫记录列表 */ - @PreAuthorize("@ss.hasPermi('bisosafety:quarantine:export')") + @PreAuthorize("@ss.hasPermi('biosafety:quarantine:export')") @Log(title = "检疫记录", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, QuarantineReport quarantineReport) @@ -73,7 +73,7 @@ public class QuarantineReportController extends BaseController /** * 新增检疫记录 */ - @PreAuthorize("@ss.hasPermi('bisosafety:quarantine:add')") + @PreAuthorize("@ss.hasPermi('biosafety:quarantine:add')") @Log(title = "检疫记录", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody QuarantineReport quarantineReport) @@ -84,7 +84,7 @@ public class QuarantineReportController extends BaseController /** * 修改检疫记录 */ - @PreAuthorize("@ss.hasPermi('bisosafety:quarantine:edit')") + @PreAuthorize("@ss.hasPermi('biosafety:quarantine:edit')") @Log(title = "检疫记录", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody QuarantineReport quarantineReport) @@ -95,7 +95,7 @@ public class QuarantineReportController extends BaseController /** * 删除检疫记录 */ - @PreAuthorize("@ss.hasPermi('bisosafety:quarantine:remove')") + @PreAuthorize("@ss.hasPermi('biosafety:quarantine:remove')") @Log(title = "检疫记录", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/SwMedicineUsageController.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/SwMedicineUsageController.java index fef0f3f..c3661aa 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/SwMedicineUsageController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/SwMedicineUsageController.java @@ -65,7 +65,7 @@ public class SwMedicineUsageController extends BaseController */ @PreAuthorize("@ss.hasPermi('biosafety:usageInfo:query')") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) + public AjaxResult getInfo(@PathVariable("id") Integer id) { return success(swMedicineUsageService.selectSwMedicineUsageById(id)); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Deworm.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Deworm.java index 89896da..c3b60c5 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Deworm.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Deworm.java @@ -1,7 +1,12 @@ package com.zhyc.module.biosafety.domain; import java.util.Date; +import java.util.List; + 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; @@ -13,6 +18,9 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-15 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class Deworm extends BaseEntity { private static final long serialVersionUID = 1L; @@ -20,34 +28,37 @@ public class Deworm extends BaseEntity /** $column.columnComment */ private Long id; - /** 羊只id */ - @Excel(name = "羊只id") private Long sheepId; - /** 药品使用记录 */ - @Excel(name = "药品使用记录") - private Long usageId; + private Integer[] sheepIds; - /** 品种 */ + /** 羊只id */ + @Excel(name = "羊只耳号") + private String sheepNo; @Excel(name = "品种") private String variety; - - /** 羊只类别 */ @Excel(name = "羊只类别") private String sheepType; - - /** 性别 */ - @Excel(name = "性别") + @Excel(name = "羊只性别") private String gender; - - /** 月龄 */ @Excel(name = "月龄") private Long monthAge; - + @Excel(name = "繁殖状态") + private String breed; /** 胎次 */ @Excel(name = "胎次") private Long parity; + + + /** 药品使用记录 */ + @Excel(name = "药品使用记录") + private Integer usageId; + + + // 药品使用 + private List usageDetails; + /** 驱虫日期 */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "驱虫日期", width = 30, dateFormat = "yyyy-MM-dd") @@ -61,134 +72,4 @@ public class Deworm extends BaseEntity @Excel(name = "备注") private String comment; - 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 setUsageId(Long usageId) - { - this.usageId = usageId; - } - - public Long getUsageId() - { - return usageId; - } - - public void setVariety(String variety) - { - this.variety = variety; - } - - public String getVariety() - { - return variety; - } - - public void setSheepType(String sheepType) - { - this.sheepType = sheepType; - } - - public String getSheepType() - { - return sheepType; - } - - public void setGender(String gender) - { - this.gender = gender; - } - - public String getGender() - { - return gender; - } - - public void setMonthAge(Long monthAge) - { - this.monthAge = monthAge; - } - - public Long getMonthAge() - { - return monthAge; - } - - public void setParity(Long parity) - { - this.parity = parity; - } - - public Long getParity() - { - return parity; - } - - public void setDatetime(Date datetime) - { - this.datetime = datetime; - } - - public Date getDatetime() - { - return datetime; - } - - public void setTechnical(String technical) - { - this.technical = technical; - } - - public String getTechnical() - { - return technical; - } - - 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("usageId", getUsageId()) - .append("variety", getVariety()) - .append("sheepType", getSheepType()) - .append("gender", getGender()) - .append("monthAge", getMonthAge()) - .append("parity", getParity()) - .append("datetime", getDatetime()) - .append("technical", getTechnical()) - .append("comment", getComment()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Diagnosis.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Diagnosis.java index 05f9a98..05fe6ad 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Diagnosis.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Diagnosis.java @@ -2,6 +2,9 @@ package com.zhyc.module.biosafety.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; @@ -13,6 +16,9 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-15 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class Diagnosis extends BaseEntity { private static final long serialVersionUID = 1L; @@ -21,11 +27,13 @@ public class Diagnosis extends BaseEntity private Long id; /** 治疗记录id */ - @Excel(name = "治疗记录id") + @Excel(name = "治疗记录") private Long treatId; /** 羊只id */ - @Excel(name = "羊只id") + @Excel(name = "羊只耳号") + private String sheepNo; + private Long sheepId; /** 时间日期 */ @@ -41,21 +49,30 @@ public class Diagnosis extends BaseEntity @Excel(name = "性别") private String gender; + /** 性别 */ + @Excel(name = "月龄") + private Long monthAge; + + /** 胎次 */ @Excel(name = "胎次") private String parity; /** 疾病类型 */ @Excel(name = "疾病类型") + private String diseasePName; + private Long diseasePid; /** 子疾病 */ @Excel(name = "子疾病") + private String diseaseName; + private Long diseaseId; /** 诊疗结果 */ @Excel(name = "诊疗结果") - private Long result; + private String result; /** 开始时间 */ @JsonFormat(pattern = "yyyy-MM-dd") @@ -72,168 +89,9 @@ public class Diagnosis extends BaseEntity private Long treatDay; /** 羊舍id */ - @Excel(name = "羊舍id") + @Excel(name = "羊舍") + private String sheepfold; + private Long sheepfoldId; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setTreatId(Long treatId) - { - this.treatId = treatId; - } - - public Long getTreatId() - { - return treatId; - } - - public void setSheepId(Long sheepId) - { - this.sheepId = sheepId; - } - - public Long getSheepId() - { - return sheepId; - } - - public void setDatetime(Date datetime) - { - this.datetime = datetime; - } - - public Date getDatetime() - { - return datetime; - } - - public void setSheepType(String sheepType) - { - this.sheepType = sheepType; - } - - public String getSheepType() - { - return sheepType; - } - - public void setGender(String gender) - { - this.gender = gender; - } - - public String getGender() - { - return gender; - } - - public void setParity(String parity) - { - this.parity = parity; - } - - public String getParity() - { - return parity; - } - - public void setDiseasePid(Long diseasePid) - { - this.diseasePid = diseasePid; - } - - public Long getDiseasePid() - { - return diseasePid; - } - - public void setDiseaseId(Long diseaseId) - { - this.diseaseId = diseaseId; - } - - public Long getDiseaseId() - { - return diseaseId; - } - - public void setResult(Long result) - { - this.result = result; - } - - public Long getResult() - { - return result; - } - - public void setBegindate(Date begindate) - { - this.begindate = begindate; - } - - public Date getBegindate() - { - return begindate; - } - - public void setEnddate(Date enddate) - { - this.enddate = enddate; - } - - public Date getEnddate() - { - return enddate; - } - - public void setTreatDay(Long treatDay) - { - this.treatDay = treatDay; - } - - public Long getTreatDay() - { - return treatDay; - } - - public void setSheepfoldId(Long sheepfoldId) - { - this.sheepfoldId = sheepfoldId; - } - - public Long getSheepfoldId() - { - return sheepfoldId; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("treatId", getTreatId()) - .append("sheepId", getSheepId()) - .append("datetime", getDatetime()) - .append("sheepType", getSheepType()) - .append("gender", getGender()) - .append("parity", getParity()) - .append("diseasePid", getDiseasePid()) - .append("diseaseId", getDiseaseId()) - .append("result", getResult()) - .append("begindate", getBegindate()) - .append("enddate", getEnddate()) - .append("treatDay", getTreatDay()) - .append("sheepfoldId", getSheepfoldId()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Disinfect.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Disinfect.java index 4b30dd3..773ec33 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Disinfect.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Disinfect.java @@ -1,7 +1,12 @@ package com.zhyc.module.biosafety.domain; import java.util.Date; +import java.util.List; + 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; @@ -13,6 +18,9 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-15 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class Disinfect extends BaseEntity { private static final long serialVersionUID = 1L; @@ -21,8 +29,12 @@ public class Disinfect extends BaseEntity private Long id; /** 羊舍id */ - @Excel(name = "羊舍id") - private Long sheepfoldId; + @Excel(name = "羊舍") + private String sheepfoldName; + + private Integer sheepfoldId; + + private Integer[] sheepfoldIds; /** 消毒日期 */ @JsonFormat(pattern = "yyyy-MM-dd") @@ -39,7 +51,7 @@ public class Disinfect extends BaseEntity /** 药品使用记录id */ @Excel(name = "药品使用记录id") - private Long usageId; + private Integer usageId; /** 比例 */ @Excel(name = "比例") @@ -49,101 +61,7 @@ public class Disinfect extends BaseEntity @Excel(name = "备注") private String comment; - public void setId(Long id) - { - this.id = id; - } + // 药品使用 + private List usageDetails; - public Long getId() - { - return id; - } - - public void setSheepfoldId(Long sheepfoldId) - { - this.sheepfoldId = sheepfoldId; - } - - public Long getSheepfoldId() - { - return sheepfoldId; - } - - public void setDatetime(Date datetime) - { - this.datetime = datetime; - } - - public Date getDatetime() - { - return datetime; - } - - public void setTechnician(String technician) - { - this.technician = technician; - } - - public String getTechnician() - { - return technician; - } - - public void setWay(String way) - { - this.way = way; - } - - public String getWay() - { - return way; - } - - public void setUsageId(Long usageId) - { - this.usageId = usageId; - } - - public Long getUsageId() - { - return usageId; - } - - public void setRatio(String ratio) - { - this.ratio = ratio; - } - - public String getRatio() - { - return ratio; - } - - 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("sheepfoldId", getSheepfoldId()) - .append("datetime", getDatetime()) - .append("technician", getTechnician()) - .append("way", getWay()) - .append("usageId", getUsageId()) - .append("ratio", getRatio()) - .append("comment", getComment()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Health.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Health.java index 2cd9347..05e591a 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Health.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Health.java @@ -1,9 +1,10 @@ package com.zhyc.module.biosafety.domain; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; +import lombok.Data; import com.zhyc.common.annotation.Excel; import com.zhyc.common.core.domain.BaseEntity; @@ -13,6 +14,7 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-15 */ +@Data public class Health extends BaseEntity { private static final long serialVersionUID = 1L; @@ -29,33 +31,29 @@ public class Health extends BaseEntity @Excel(name = "羊只id") private Long sheepId; - /** 用药记录 */ - @Excel(name = "用药记录") - private Long usageId; + private Integer[] sheepIds; - /** 品种 */ + /** 羊只id */ + @Excel(name = "羊只耳号") + private String sheepNo; @Excel(name = "品种") private String variety; - - /** 羊只类别 */ @Excel(name = "羊只类别") private String sheepType; - - /** 性别 */ - @Excel(name = "性别") + @Excel(name = "羊只性别") private String gender; - - /** 月龄 */ @Excel(name = "月龄") - private String monthAge; - + private Long monthAge; + @Excel(name = "繁殖状态") + private String breed; /** 胎次 */ @Excel(name = "胎次") private Long parity; - /** 羊舍id */ - @Excel(name = "羊舍id") - private Long sheepfoldId; + /** 用药记录 */ + @Excel(name = "用药记录") + private Integer usageId; + /** 技术员 */ @Excel(name = "技术员") @@ -65,145 +63,6 @@ public class Health extends BaseEntity @Excel(name = "备注") private String comment; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setDatetime(Date datetime) - { - this.datetime = datetime; - } - - public Date getDatetime() - { - return datetime; - } - - public void setSheepId(Long sheepId) - { - this.sheepId = sheepId; - } - - public Long getSheepId() - { - return sheepId; - } - - public void setUsageId(Long usageId) - { - this.usageId = usageId; - } - - public Long getUsageId() - { - return usageId; - } - - public void setVariety(String variety) - { - this.variety = variety; - } - - public String getVariety() - { - return variety; - } - - public void setSheepType(String sheepType) - { - this.sheepType = sheepType; - } - - public String getSheepType() - { - return sheepType; - } - - public void setGender(String gender) - { - this.gender = gender; - } - - public String getGender() - { - return gender; - } - - public void setMonthAge(String monthAge) - { - this.monthAge = monthAge; - } - - public String getMonthAge() - { - return monthAge; - } - - public void setParity(Long parity) - { - this.parity = parity; - } - - public Long getParity() - { - return parity; - } - - public void setSheepfoldId(Long sheepfoldId) - { - this.sheepfoldId = sheepfoldId; - } - - public Long getSheepfoldId() - { - return sheepfoldId; - } - - public void setTechnical(String technical) - { - this.technical = technical; - } - - public String getTechnical() - { - return technical; - } - - 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("datetime", getDatetime()) - .append("sheepId", getSheepId()) - .append("usageId", getUsageId()) - .append("variety", getVariety()) - .append("sheepType", getSheepType()) - .append("gender", getGender()) - .append("monthAge", getMonthAge()) - .append("parity", getParity()) - .append("sheepfoldId", getSheepfoldId()) - .append("technical", getTechnical()) - .append("comment", getComment()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .toString(); - } + // 药品使用 + private List usageDetails; } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Immunity.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Immunity.java index 6dda5ac..1a77298 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Immunity.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Immunity.java @@ -1,7 +1,12 @@ package com.zhyc.module.biosafety.domain; import java.util.Date; +import java.util.List; + 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; @@ -13,6 +18,9 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-15 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class Immunity extends BaseEntity { private static final long serialVersionUID = 1L; @@ -24,33 +32,33 @@ public class Immunity extends BaseEntity @Excel(name = "羊只id") private Long sheepId; - /** 使用记录 */ - @Excel(name = "使用记录") - private Long usageId; + private Integer[] sheepIds; - /** 品种 */ + /** 羊只id */ + @Excel(name = "羊只耳号") + private String sheepNo; @Excel(name = "品种") + private String variety; + @Excel(name = "羊只类别") + private String sheepType; - /** 羊只类型 */ - @Excel(name = "羊只类型") - private Long sheepType; - - /** 羊只性别 */ @Excel(name = "羊只性别") private String gender; - /** 月龄 */ @Excel(name = "月龄") private Long monthAge; + @Excel(name = "繁殖状态") + private String breed; /** 胎次 */ @Excel(name = "胎次") private Long parity; - /** 羊舍id */ - @Excel(name = "羊舍id") - private Long sheepfoldId; + /** 使用记录 */ + @Excel(name = "使用记录") + private Integer usageId; + /** 免疫日期 */ @JsonFormat(pattern = "yyyy-MM-dd") @@ -65,145 +73,7 @@ public class Immunity extends BaseEntity @Excel(name = "备注") private String comment; - public void setId(Long id) - { - this.id = id; - } + // 药品使用 + private List usageDetails; - public Long getId() - { - return id; - } - - public void setSheepId(Long sheepId) - { - this.sheepId = sheepId; - } - - public Long getSheepId() - { - return sheepId; - } - - public void setUsageId(Long usageId) - { - this.usageId = usageId; - } - - public Long getUsageId() - { - return usageId; - } - - public void setVariety(String variety) - { - this.variety = variety; - } - - public String getVariety() - { - return variety; - } - - public void setSheepType(Long sheepType) - { - this.sheepType = sheepType; - } - - public Long getSheepType() - { - return sheepType; - } - - public void setGender(String gender) - { - this.gender = gender; - } - - public String getGender() - { - return gender; - } - - public void setMonthAge(Long monthAge) - { - this.monthAge = monthAge; - } - - public Long getMonthAge() - { - return monthAge; - } - - public void setParity(Long parity) - { - this.parity = parity; - } - - public Long getParity() - { - return parity; - } - - public void setSheepfoldId(Long sheepfoldId) - { - this.sheepfoldId = sheepfoldId; - } - - public Long getSheepfoldId() - { - return sheepfoldId; - } - - public void setDatetime(Date datetime) - { - this.datetime = datetime; - } - - public Date getDatetime() - { - return datetime; - } - - public void setTechnical(String technical) - { - this.technical = technical; - } - - public String getTechnical() - { - return technical; - } - - 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("usageId", getUsageId()) - .append("variety", getVariety()) - .append("sheepType", getSheepType()) - .append("gender", getGender()) - .append("monthAge", getMonthAge()) - .append("parity", getParity()) - .append("sheepfoldId", getSheepfoldId()) - .append("datetime", getDatetime()) - .append("technical", getTechnical()) - .append("comment", getComment()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineItems.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineItems.java index eb57ab0..807962a 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineItems.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineItems.java @@ -1,5 +1,8 @@ package com.zhyc.module.biosafety.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-14 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class QuarantineItems extends BaseEntity { private static final long serialVersionUID = 1L; @@ -22,31 +28,4 @@ public class QuarantineItems extends BaseEntity @Excel(name = "名称") private String name; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineReport.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineReport.java index 9d3dd21..0fa8f88 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineReport.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineReport.java @@ -2,7 +2,9 @@ package com.zhyc.module.biosafety.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; @@ -16,6 +18,8 @@ import org.apache.ibatis.type.Alias; * @date 2025-07-14 */ @Data +@NoArgsConstructor +@AllArgsConstructor @Alias("QuarantineReport") public class QuarantineReport extends BaseEntity { diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineSample.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineSample.java index e9e3ba3..e128a0e 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineSample.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineSample.java @@ -1,5 +1,8 @@ package com.zhyc.module.biosafety.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-14 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class QuarantineSample extends BaseEntity { private static final long serialVersionUID = 1L; @@ -22,31 +28,4 @@ public class QuarantineSample extends BaseEntity @Excel(name = "样品类型") private String name; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwDisease.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwDisease.java index 5cb14ab..65ab2c1 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwDisease.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwDisease.java @@ -1,5 +1,8 @@ package com.zhyc.module.biosafety.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.TreeEntity; * @author ruoyi * @date 2025-07-09 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class SwDisease extends TreeEntity { private static final long serialVersionUID = 1L; @@ -30,53 +36,5 @@ public class SwDisease extends TreeEntity @Excel(name = "") private Long pid; - public void setId(Long id) - { - this.id = id; - } - public Long getId() - { - return id; - } - - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - - public void setComment(String comment) - { - this.comment = comment; - } - - public String getComment() - { - return comment; - } - - public void setPid(Long pid) - { - this.pid = pid; - } - - public Long getPid() - { - return pid; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("comment", getComment()) - .append("pid", getPid()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicType.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicType.java index 7bfcc56..46893c5 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicType.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicType.java @@ -1,5 +1,8 @@ package com.zhyc.module.biosafety.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-11 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class SwMedicType extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicine.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicine.java index 8536c1b..247ef20 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicine.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicine.java @@ -1,6 +1,8 @@ package com.zhyc.module.biosafety.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; @@ -14,6 +16,8 @@ import com.zhyc.common.core.domain.BaseEntity; */ @Data +@NoArgsConstructor +@AllArgsConstructor public class SwMedicine extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicineUsage.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicineUsage.java index bc442d0..95a6aea 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicineUsage.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicineUsage.java @@ -1,6 +1,10 @@ package com.zhyc.module.biosafety.domain; import java.util.List; + +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; @@ -12,12 +16,15 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-12 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class SwMedicineUsage extends BaseEntity { private static final long serialVersionUID = 1L; /** id */ - private Long id; + private Integer id; /** 使用名称 */ @Excel(name = "使用名称") @@ -30,57 +37,5 @@ public class SwMedicineUsage extends BaseEntity /** 药品使用记录详情信息 */ private List swMedicineUsageDetailsList; - public void setId(Long id) - { - this.id = id; - } - public Long getId() - { - return id; - } - - public void setName(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - - public void setUseType(String useType) - { - this.useType = useType; - } - - public String getUseType() - { - return useType; - } - - public List getSwMedicineUsageDetailsList() - { - return swMedicineUsageDetailsList; - } - - public void setSwMedicineUsageDetailsList(List swMedicineUsageDetailsList) - { - this.swMedicineUsageDetailsList = swMedicineUsageDetailsList; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("useType", getUseType()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("swMedicineUsageDetailsList", getSwMedicineUsageDetailsList()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicineUsageDetails.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicineUsageDetails.java index b3e24c6..86eb829 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicineUsageDetails.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwMedicineUsageDetails.java @@ -1,6 +1,8 @@ package com.zhyc.module.biosafety.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; @@ -13,6 +15,8 @@ import com.zhyc.common.core.domain.BaseEntity; * @date 2025-07-12 */ @Data +@NoArgsConstructor +@AllArgsConstructor public class SwMedicineUsageDetails extends BaseEntity { private static final long serialVersionUID = 1L; @@ -22,7 +26,7 @@ public class SwMedicineUsageDetails extends BaseEntity /** 药品使用记录id */ @Excel(name = "药品使用记录id") - private Long mediUsage; + private Integer mediUsage; /** 药品id */ @Excel(name = "药品id") diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwPresDetail.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwPresDetail.java index ba52c9e..e03540b 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwPresDetail.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwPresDetail.java @@ -1,6 +1,10 @@ package com.zhyc.module.biosafety.domain; import java.math.BigDecimal; + +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; @@ -12,6 +16,9 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-11 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class SwPresDetail extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwPrescription.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwPrescription.java index b8466e1..ae22e43 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwPrescription.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwPrescription.java @@ -1,6 +1,10 @@ package com.zhyc.module.biosafety.domain; import java.util.List; + +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; @@ -12,6 +16,9 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-11 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class SwPrescription extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwUnit.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwUnit.java index 2942b49..9820928 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwUnit.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwUnit.java @@ -1,6 +1,8 @@ package com.zhyc.module.biosafety.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; @@ -13,12 +15,14 @@ import com.zhyc.common.core.domain.BaseEntity; * @date 2025-07-11 */ @Data +@NoArgsConstructor +@AllArgsConstructor public class SwUnit extends BaseEntity { private static final long serialVersionUID = 1L; /** 编号 */ - private Long id; + private Integer id; /** 单位 */ @Excel(name = "单位") diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwUsage.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwUsage.java index 91c065f..450c220 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwUsage.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/SwUsage.java @@ -1,6 +1,8 @@ package com.zhyc.module.biosafety.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; @@ -13,25 +15,18 @@ import com.zhyc.common.core.domain.BaseEntity; * @date 2025-07-11 */ @Data +@NoArgsConstructor +@AllArgsConstructor public class SwUsage extends BaseEntity { private static final long serialVersionUID = 1L; /** 编号 */ - private Long id; + private Integer id; /** 使用方法 */ @Excel(name = "使用方法") private String name; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Treatment.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Treatment.java index 67777b8..e4217fc 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Treatment.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/Treatment.java @@ -5,7 +5,9 @@ import java.util.Date; import java.util.List; 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; @@ -18,11 +20,12 @@ import com.zhyc.common.core.domain.BaseEntity; * @date 2025-07-15 */ @Data +@NoArgsConstructor +@AllArgsConstructor public class Treatment extends BaseEntity { private static final long serialVersionUID = 1L; - /** $column.columnComment */ private Long id; /** 诊疗记录id */ @@ -30,7 +33,11 @@ public class Treatment extends BaseEntity /** 羊只耳号 */ @Excel(name = "羊只耳号") + private String sheepNo; + private Long sheepId; +// 用于批量新增 + private List sheepIds; /** 品种 */ @Excel(name = "品种") @@ -71,11 +78,16 @@ public class Treatment extends BaseEntity /** 疾病类型 */ @Excel(name = "疾病类型") + private String diseaseName; + private Long diseaseId; + /** 父疾病 */ @Excel(name = "父疾病") - private String diseasePid; + private String diseasePName; + + private Long diseasePid; /** 兽医 */ @Excel(name = "兽医") @@ -83,7 +95,7 @@ public class Treatment extends BaseEntity /** 药品使用记录id */ @Excel(name = "药品使用记录id") - private Long usageId; + private Integer usageId; // 药品使用 private List usageDetails; diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/DewormMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/DewormMapper.java index f346774..8ce542c 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/DewormMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/DewormMapper.java @@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.mapper; import java.util.List; import com.zhyc.module.biosafety.domain.Deworm; +import org.apache.ibatis.annotations.Mapper; /** * 驱虫Mapper接口 @@ -10,6 +11,7 @@ import com.zhyc.module.biosafety.domain.Deworm; * @author ruoyi * @date 2025-07-15 */ +@Mapper public interface DewormMapper { /** @@ -34,7 +36,7 @@ public interface DewormMapper * @param deworm 驱虫 * @return 结果 */ - public int insertDeworm(Deworm deworm); + public int insertDeworm(List deworm); /** * 修改驱虫 diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/DiagnosisMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/DiagnosisMapper.java index 47110b7..f9f8076 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/DiagnosisMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/DiagnosisMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.biosafety.mapper; import java.util.List; import com.zhyc.module.biosafety.domain.Diagnosis; +import org.apache.ibatis.annotations.Mapper; /** * 诊疗结果Mapper接口 @@ -9,6 +10,7 @@ import com.zhyc.module.biosafety.domain.Diagnosis; * @author ruoyi * @date 2025-07-15 */ +@Mapper public interface DiagnosisMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/DisinfectMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/DisinfectMapper.java index 4092405..885bf2e 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/DisinfectMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/DisinfectMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.biosafety.mapper; import java.util.List; import com.zhyc.module.biosafety.domain.Disinfect; +import org.apache.ibatis.annotations.Mapper; /** * 消毒记录Mapper接口 @@ -9,6 +10,7 @@ import com.zhyc.module.biosafety.domain.Disinfect; * @author ruoyi * @date 2025-07-15 */ +@Mapper public interface DisinfectMapper { /** @@ -33,7 +35,7 @@ public interface DisinfectMapper * @param disinfect 消毒记录 * @return 结果 */ - public int insertDisinfect(Disinfect disinfect); + public int insertDisinfect(List disinfect); /** * 修改消毒记录 diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/HealthMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/HealthMapper.java index 0fbfafc..bcdc175 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/HealthMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/HealthMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.biosafety.mapper; import java.util.List; import com.zhyc.module.biosafety.domain.Health; +import org.apache.ibatis.annotations.Mapper; /** * 保健Mapper接口 @@ -9,6 +10,7 @@ import com.zhyc.module.biosafety.domain.Health; * @author ruoyi * @date 2025-07-15 */ +@Mapper public interface HealthMapper { /** @@ -33,7 +35,7 @@ public interface HealthMapper * @param health 保健 * @return 结果 */ - public int insertHealth(Health health); + public int insertHealth(List health); /** * 修改保健 diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/ImmunityMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/ImmunityMapper.java index ea5161a..a500a9e 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/ImmunityMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/ImmunityMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.biosafety.mapper; import java.util.List; import com.zhyc.module.biosafety.domain.Immunity; +import org.apache.ibatis.annotations.Mapper; /** * 免疫Mapper接口 @@ -9,6 +10,7 @@ import com.zhyc.module.biosafety.domain.Immunity; * @author ruoyi * @date 2025-07-15 */ +@Mapper public interface ImmunityMapper { /** @@ -33,7 +35,7 @@ public interface ImmunityMapper * @param immunity 免疫 * @return 结果 */ - public int insertImmunity(Immunity immunity); + public int insertImmunity(List immunity); /** * 修改免疫 diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineItemsMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineItemsMapper.java index 3f4dd36..30b19d7 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineItemsMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineItemsMapper.java @@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.mapper; import java.util.List; import com.zhyc.module.biosafety.domain.QuarantineItems; +import org.apache.ibatis.annotations.Mapper; /** * 检疫项目Mapper接口 @@ -10,6 +11,7 @@ import com.zhyc.module.biosafety.domain.QuarantineItems; * @author ruoyi * @date 2025-07-14 */ +@Mapper public interface QuarantineItemsMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineReportMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineReportMapper.java index 5987f23..bc4c181 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineReportMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineReportMapper.java @@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.mapper; import java.util.List; import com.zhyc.module.biosafety.domain.QuarantineReport; +import org.apache.ibatis.annotations.Mapper; /** * 检疫记录Mapper接口 @@ -10,6 +11,7 @@ import com.zhyc.module.biosafety.domain.QuarantineReport; * @author ruoyi * @date 2025-07-14 */ +@Mapper public interface QuarantineReportMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineSampleMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineSampleMapper.java index 76ce1d7..5df4a8a 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineSampleMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineSampleMapper.java @@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.mapper; import java.util.List; import com.zhyc.module.biosafety.domain.QuarantineSample; +import org.apache.ibatis.annotations.Mapper; /** * 样品类型Mapper接口 @@ -10,6 +11,7 @@ import com.zhyc.module.biosafety.domain.QuarantineSample; * @author ruoyi * @date 2025-07-14 */ +@Mapper public interface QuarantineSampleMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwDiseaseMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwDiseaseMapper.java index 55f3351..ed5de79 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwDiseaseMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwDiseaseMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.biosafety.mapper; import java.util.List; import com.zhyc.module.biosafety.domain.SwDisease; +import org.apache.ibatis.annotations.Mapper; /** * 疾病Mapper接口 @@ -9,6 +10,7 @@ import com.zhyc.module.biosafety.domain.SwDisease; * @author ruoyi * @date 2025-07-09 */ +@Mapper public interface SwDiseaseMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwMedicTypeMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwMedicTypeMapper.java index 764c735..19e73c4 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwMedicTypeMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwMedicTypeMapper.java @@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.mapper; import java.util.List; import com.zhyc.module.biosafety.domain.SwMedicType; +import org.apache.ibatis.annotations.Mapper; /** * 药品类型Mapper接口 @@ -10,6 +11,7 @@ import com.zhyc.module.biosafety.domain.SwMedicType; * @author ruoyi * @date 2025-07-11 */ +@Mapper public interface SwMedicTypeMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwMedicineMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwMedicineMapper.java index fc44d44..dd1ed67 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwMedicineMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwMedicineMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.biosafety.mapper; import java.util.List; import com.zhyc.module.biosafety.domain.SwMedicine; +import org.apache.ibatis.annotations.Mapper; /** * 药品Mapper接口 @@ -9,6 +10,7 @@ import com.zhyc.module.biosafety.domain.SwMedicine; * @author ruoyi * @date 2025-07-11 */ +@Mapper public interface SwMedicineMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwMedicineUsageMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwMedicineUsageMapper.java index a58cdb8..3d60eb0 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwMedicineUsageMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwMedicineUsageMapper.java @@ -4,6 +4,7 @@ import java.util.List; import com.zhyc.module.biosafety.domain.SwMedicineUsage; import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails; +import org.apache.ibatis.annotations.Mapper; /** * 药品使用记录Mapper接口 @@ -11,6 +12,7 @@ import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails; * @author ruoyi * @date 2025-07-12 */ +@Mapper public interface SwMedicineUsageMapper { /** @@ -19,7 +21,7 @@ public interface SwMedicineUsageMapper * @param id 药品使用记录主键 * @return 药品使用记录 */ - public SwMedicineUsage selectSwMedicineUsageById(Long id); + public SwMedicineUsage selectSwMedicineUsageById(Integer id); /** * 查询药品使用记录列表 @@ -51,7 +53,7 @@ public interface SwMedicineUsageMapper * @param id 药品使用记录主键 * @return 结果 */ - public int deleteSwMedicineUsageById(Long id); + public int deleteSwMedicineUsageById(Integer id); /** * 批量删除药品使用记录 @@ -84,5 +86,5 @@ public interface SwMedicineUsageMapper * @param id 药品使用记录ID * @return 结果 */ - public int deleteSwMedicineUsageDetailsByMediUsage(Long id); + public int deleteSwMedicineUsageDetailsByMediUsage(Integer id); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwPrescriptionMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwPrescriptionMapper.java index ee1c462..35796dc 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwPrescriptionMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwPrescriptionMapper.java @@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.mapper; import java.util.List; import com.zhyc.module.biosafety.domain.SwPrescription; import com.zhyc.module.biosafety.domain.SwPresDetail; +import org.apache.ibatis.annotations.Mapper; /** * 处方Mapper接口 @@ -10,6 +11,7 @@ import com.zhyc.module.biosafety.domain.SwPresDetail; * @author ruoyi * @date 2025-07-11 */ +@Mapper public interface SwPrescriptionMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwUnitMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwUnitMapper.java index 2d3cf64..417b3aa 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwUnitMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwUnitMapper.java @@ -1,6 +1,7 @@ package com.zhyc.module.biosafety.mapper; import com.zhyc.module.biosafety.domain.SwUnit; +import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -10,6 +11,7 @@ import java.util.List; * @author ruoyi * @date 2025-07-11 */ +@Mapper public interface SwUnitMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwUsageMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwUsageMapper.java index cb0706d..a2b591b 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwUsageMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/SwUsageMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.biosafety.mapper; import java.util.List; import com.zhyc.module.biosafety.domain.SwUsage; +import org.apache.ibatis.annotations.Mapper; /** * 药品使用方法Mapper接口 @@ -9,6 +10,7 @@ import com.zhyc.module.biosafety.domain.SwUsage; * @author ruoyi * @date 2025-07-11 */ +@Mapper public interface SwUsageMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/TreatmentMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/TreatmentMapper.java index 1807ed0..643d9a0 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/TreatmentMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/TreatmentMapper.java @@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.mapper; import java.util.List; import com.zhyc.module.biosafety.domain.Treatment; +import org.apache.ibatis.annotations.Mapper; /** * 治疗记录Mapper接口 @@ -10,6 +11,7 @@ import com.zhyc.module.biosafety.domain.Treatment; * @author ruoyi * @date 2025-07-15 */ +@Mapper public interface TreatmentMapper { /** @@ -59,4 +61,6 @@ public interface TreatmentMapper * @return 结果 */ public int deleteTreatmentByIds(Long[] ids); + + int insertTreatmentList(List treatments); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ISwMedicineUsageService.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ISwMedicineUsageService.java index d10ee3a..70e3dd8 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ISwMedicineUsageService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ISwMedicineUsageService.java @@ -17,7 +17,7 @@ public interface ISwMedicineUsageService * @param id 药品使用记录主键 * @return 药品使用记录 */ - public SwMedicineUsage selectSwMedicineUsageById(Long id); + public SwMedicineUsage selectSwMedicineUsageById(Integer id); /** * 查询药品使用记录列表 @@ -57,5 +57,5 @@ public interface ISwMedicineUsageService * @param id 药品使用记录主键 * @return 结果 */ - public int deleteSwMedicineUsageById(Long id); + public int deleteSwMedicineUsageById(Integer id); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ITreatmentService.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ITreatmentService.java index 3d11b0a..ed72447 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ITreatmentService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/ITreatmentService.java @@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.service; import java.util.List; import com.zhyc.module.biosafety.domain.Treatment; +import org.springframework.transaction.annotation.Transactional; /** * 治疗记录Service接口 @@ -36,6 +37,7 @@ public interface ITreatmentService */ public int insertTreatment(Treatment treatment); + /** * 修改治疗记录 * diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/DewormServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/DewormServiceImpl.java index d0afd0e..c6f850c 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/DewormServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/DewormServiceImpl.java @@ -1,12 +1,22 @@ package com.zhyc.module.biosafety.service.impl; +import java.util.ArrayList; import java.util.List; import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; +import com.zhyc.common.utils.bean.BeanUtils; +import com.zhyc.module.base.domain.SheepFile; +import com.zhyc.module.base.mapper.SheepFileMapper; import com.zhyc.module.biosafety.domain.Deworm; +import com.zhyc.module.biosafety.domain.SwMedicineUsage; +import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails; +import com.zhyc.module.biosafety.domain.Treatment; +import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zhyc.module.biosafety.mapper.DewormMapper; import com.zhyc.module.biosafety.service.IDewormService; +import org.springframework.transaction.annotation.Transactional; /** * 驱虫Service业务层处理 @@ -19,6 +29,12 @@ public class DewormServiceImpl implements IDewormService { @Autowired private DewormMapper dewormMapper; + @Autowired + private SwMedicineUsageServiceImpl medicineUsageService; + @Autowired + private SwMedicineUsageMapper medicineUsageMapper; + @Autowired + private SheepFileMapper sheepFileMapper; /** * 查询驱虫 @@ -29,7 +45,10 @@ public class DewormServiceImpl implements IDewormService @Override public Deworm selectDewormById(Long id) { - return dewormMapper.selectDewormById(id); + Deworm deworm = dewormMapper.selectDewormById(id); + SwMedicineUsage swMedicineUsage = medicineUsageMapper.selectSwMedicineUsageById(deworm.getUsageId()); + deworm.setUsageDetails(swMedicineUsage.getSwMedicineUsageDetailsList()); + return deworm; } /** @@ -51,10 +70,40 @@ public class DewormServiceImpl implements IDewormService * @return 结果 */ @Override + @Transactional public int insertDeworm(Deworm deworm) { - deworm.setCreateTime(DateUtils.getNowDate()); - return dewormMapper.insertDeworm(deworm); + String username = SecurityUtils.getUsername(); + // 使用记录的文件 + SwMedicineUsage medicineUsage = new SwMedicineUsage(); + medicineUsage.setSwMedicineUsageDetailsList(deworm.getUsageDetails()); + medicineUsage.setName("羊只驱虫"); + medicineUsage.setUseType("1"); + + List deworms = new ArrayList<>(); + + deworm.setCreateBy(username); + deworm.setCreateTime(DateUtils.getNowDate()); + for (Integer sheepId : deworm.getSheepIds()) { + SheepFile sheepFile = sheepFileMapper.selectSheepFileById(Long.valueOf(sheepId)); + + Deworm dew = new Deworm(); + BeanUtils.copyProperties(deworm, dew); + dew.setSheepId(Long.valueOf(sheepId)); + dew.setVariety(sheepFile.getVariety()); + dew.setSheepType(sheepFile.getName()); + dew.setMonthAge(sheepFile.getMonthAge()); + dew.setGender(String.valueOf(sheepFile.getGender())); + dew.setBreed(sheepFile.getBreed()); + dew.setParity(sheepFile.getParity()); +// 获取药品使用记录的id + Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage); + dew.setUsageId(usageId); + deworms.add(dew); + } + + + return dewormMapper.insertDeworm(deworms); } /** @@ -64,8 +113,23 @@ public class DewormServiceImpl implements IDewormService * @return 结果 */ @Override + @Transactional public int updateDeworm(Deworm deworm) { + String username = SecurityUtils.getUsername(); + for (SwMedicineUsageDetails usageDetail : deworm.getUsageDetails()) { + usageDetail.setMediUsage(deworm.getUsageId()); + } + medicineUsageMapper.deleteSwMedicineUsageDetailsByMediUsage(deworm.getUsageId()); + SwMedicineUsage swMedicineUsage = new SwMedicineUsage(); + + swMedicineUsage.setId(deworm.getUsageId()); + swMedicineUsage.setUpdateBy(username); + swMedicineUsage.setUpdateTime(DateUtils.getNowDate()); + medicineUsageMapper.updateSwMedicineUsage(swMedicineUsage); + + medicineUsageMapper.batchSwMedicineUsageDetails(deworm.getUsageDetails()); + deworm.setUpdateBy(username); deworm.setUpdateTime(DateUtils.getNowDate()); return dewormMapper.updateDeworm(deworm); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/DiagnosisServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/DiagnosisServiceImpl.java index 319a658..c17e8ec 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/DiagnosisServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/DiagnosisServiceImpl.java @@ -1,12 +1,20 @@ package com.zhyc.module.biosafety.service.impl; import java.util.List; +import java.util.Objects; + import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; +import com.zhyc.module.base.domain.BasSheep; +import com.zhyc.module.base.domain.SheepFile; +import com.zhyc.module.base.mapper.BasSheepMapper; +import com.zhyc.module.base.mapper.SheepFileMapper; import com.zhyc.module.biosafety.mapper.DiagnosisMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zhyc.module.biosafety.domain.Diagnosis; import com.zhyc.module.biosafety.service.IDiagnosisService; +import org.springframework.transaction.annotation.Transactional; /** * 诊疗结果Service业务层处理 @@ -19,6 +27,10 @@ public class DiagnosisServiceImpl implements IDiagnosisService { @Autowired private DiagnosisMapper diagnosisMapper; + @Autowired + private SheepFileMapper sheepFileMapper; + @Autowired + private BasSheepMapper sheepMapper; /** * 查询诊疗结果 @@ -51,9 +63,25 @@ public class DiagnosisServiceImpl implements IDiagnosisService * @return 结果 */ @Override + @Transactional public int insertDiagnosis(Diagnosis diagnosis) { + SheepFile sheepFile = sheepFileMapper.selectSheepFileById(diagnosis.getSheepId()); + diagnosis.setSheepType(sheepFile.getName()); + diagnosis.setParity(String.valueOf(sheepFile.getParity())); + diagnosis.setGender(String.valueOf(sheepFile.getGender())); + diagnosis.setMonthAge(sheepFile.getMonthAge()); + + String username = SecurityUtils.getUsername(); + diagnosis.setCreateBy(username); diagnosis.setCreateTime(DateUtils.getNowDate()); + if (!Objects.equals(sheepFile.getSheepfoldId(), diagnosis.getSheepfoldId())){ + BasSheep basSheep = new BasSheep(); + basSheep.setId(diagnosis.getSheepId()); + basSheep.setSheepfoldId(diagnosis.getSheepfoldId()); + sheepMapper.updateBasSheep(basSheep); + } +// 转入其他羊舍 return diagnosisMapper.insertDiagnosis(diagnosis); } @@ -64,8 +92,18 @@ public class DiagnosisServiceImpl implements IDiagnosisService * @return 结果 */ @Override + @Transactional public int updateDiagnosis(Diagnosis diagnosis) { + BasSheep basSheep = new BasSheep(); + basSheep.setId(diagnosis.getSheepId()); + basSheep.setSheepfoldId(diagnosis.getSheepfoldId()); + String username = SecurityUtils.getUsername(); + basSheep.setUpdateBy(username); + basSheep.setUpdateTime(DateUtils.getNowDate()); + diagnosis.setUpdateBy(username); + diagnosis.setUpdateTime(DateUtils.getNowDate()); + sheepMapper.updateBasSheep(basSheep); return diagnosisMapper.updateDiagnosis(diagnosis); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/DisinfectServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/DisinfectServiceImpl.java index 18a014e..24918ef 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/DisinfectServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/DisinfectServiceImpl.java @@ -1,12 +1,22 @@ package com.zhyc.module.biosafety.service.impl; +import java.util.ArrayList; import java.util.List; import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; +import com.zhyc.common.utils.bean.BeanUtils; +import com.zhyc.module.base.domain.SheepFile; +import com.zhyc.module.base.mapper.SheepFileMapper; +import com.zhyc.module.biosafety.domain.Deworm; +import com.zhyc.module.biosafety.domain.SwMedicineUsage; +import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails; +import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zhyc.module.biosafety.mapper.DisinfectMapper; import com.zhyc.module.biosafety.domain.Disinfect; import com.zhyc.module.biosafety.service.IDisinfectService; +import org.springframework.transaction.annotation.Transactional; /** * 消毒记录Service业务层处理 @@ -20,6 +30,15 @@ public class DisinfectServiceImpl implements IDisinfectService @Autowired private DisinfectMapper disinfectMapper; + @Autowired + private SwMedicineUsageServiceImpl medicineUsageService; + + @Autowired + private SwMedicineUsageMapper medicineUsageMapper; + + @Autowired + private SheepFileMapper sheepFileMapper; + /** * 查询消毒记录 * @@ -29,7 +48,10 @@ public class DisinfectServiceImpl implements IDisinfectService @Override public Disinfect selectDisinfectById(Long id) { - return disinfectMapper.selectDisinfectById(id); + Disinfect disinfect = disinfectMapper.selectDisinfectById(id); + SwMedicineUsage swMedicineUsage = medicineUsageService.selectSwMedicineUsageById(disinfect.getUsageId()); + disinfect.setUsageDetails(swMedicineUsage.getSwMedicineUsageDetailsList()); + return disinfect; } /** @@ -53,8 +75,30 @@ public class DisinfectServiceImpl implements IDisinfectService @Override public int insertDisinfect(Disinfect disinfect) { + String username = SecurityUtils.getUsername(); + // 使用记录的文件 + SwMedicineUsage medicineUsage = new SwMedicineUsage(); + medicineUsage.setSwMedicineUsageDetailsList(disinfect.getUsageDetails()); + medicineUsage.setName("羊舍消毒"); + medicineUsage.setUseType("3"); + + + List disinfects = new ArrayList<>(); + + disinfect.setCreateBy(username); disinfect.setCreateTime(DateUtils.getNowDate()); - return disinfectMapper.insertDisinfect(disinfect); + + for (Integer sheepfold : disinfect.getSheepfoldIds()) { + Disinfect dis = new Disinfect(); + BeanUtils.copyProperties(disinfect,dis); + dis.setSheepfoldId(sheepfold); +// 获取药品使用记录的id + Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage); + dis.setUsageId(usageId); + disinfects.add(dis); + } + + return disinfectMapper.insertDisinfect(disinfects); } /** @@ -64,8 +108,16 @@ public class DisinfectServiceImpl implements IDisinfectService * @return 结果 */ @Override + @Transactional public int updateDisinfect(Disinfect disinfect) { + for (SwMedicineUsageDetails usageDetail : disinfect.getUsageDetails()) { + usageDetail.setMediUsage(disinfect.getUsageId()); + } + medicineUsageMapper.deleteSwMedicineUsageDetailsByMediUsage(disinfect.getUsageId()); + medicineUsageMapper.batchSwMedicineUsageDetails(disinfect.getUsageDetails()); + String username = SecurityUtils.getUsername(); + disinfect.setUpdateBy(username); disinfect.setUpdateTime(DateUtils.getNowDate()); return disinfectMapper.updateDisinfect(disinfect); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/HealthServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/HealthServiceImpl.java index 7986bf7..bef0199 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/HealthServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/HealthServiceImpl.java @@ -1,7 +1,16 @@ package com.zhyc.module.biosafety.service.impl; +import java.util.ArrayList; import java.util.List; import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; +import com.zhyc.common.utils.bean.BeanUtils; +import com.zhyc.module.base.domain.SheepFile; +import com.zhyc.module.base.mapper.SheepFileMapper; +import com.zhyc.module.biosafety.domain.Health; +import com.zhyc.module.biosafety.domain.SwMedicineUsage; +import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails; +import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zhyc.module.biosafety.mapper.HealthMapper; @@ -20,6 +29,15 @@ public class HealthServiceImpl implements IHealthService @Autowired private HealthMapper healthMapper; + @Autowired + private SwMedicineUsageServiceImpl medicineUsageService; + + @Autowired + private SwMedicineUsageMapper medicineUsageMapper; + + @Autowired + private SheepFileMapper sheepFileMapper; + /** * 查询保健 * @@ -29,7 +47,10 @@ public class HealthServiceImpl implements IHealthService @Override public Health selectHealthById(Long id) { - return healthMapper.selectHealthById(id); + Health health = healthMapper.selectHealthById(id); + SwMedicineUsage swMedicineUsage = medicineUsageMapper.selectSwMedicineUsageById(health.getUsageId()); + health.setUsageDetails(swMedicineUsage.getSwMedicineUsageDetailsList()); + return health; } /** @@ -53,8 +74,36 @@ public class HealthServiceImpl implements IHealthService @Override public int insertHealth(Health health) { + String username = SecurityUtils.getUsername(); + + // 使用记录的文件 + SwMedicineUsage medicineUsage = new SwMedicineUsage(); + medicineUsage.setSwMedicineUsageDetailsList(health.getUsageDetails()); + medicineUsage.setName("羊只保健"); + medicineUsage.setUseType("2"); + + List healths = new ArrayList<>(); + health.setCreateBy(username); health.setCreateTime(DateUtils.getNowDate()); - return healthMapper.insertHealth(health); + for (Integer sheepId : health.getSheepIds()) { + SheepFile sheepFile = sheepFileMapper.selectSheepFileById(Long.valueOf(sheepId)); + Health heal = new Health(); + BeanUtils.copyProperties(health, heal); + heal.setSheepId(Long.valueOf(sheepId)); + heal.setVariety(sheepFile.getVariety()); + heal.setSheepType(sheepFile.getName()); + heal.setMonthAge(sheepFile.getMonthAge()); + heal.setGender(String.valueOf(sheepFile.getGender())); + heal.setBreed(sheepFile.getBreed()); + heal.setParity(sheepFile.getParity()); + +// 获取药品使用记录的id + Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage); + + heal.setUsageId(usageId); + healths.add(heal); + } + return healthMapper.insertHealth(healths); } /** @@ -66,6 +115,13 @@ public class HealthServiceImpl implements IHealthService @Override public int updateHealth(Health health) { + for (SwMedicineUsageDetails usageDetail : health.getUsageDetails()) { + usageDetail.setMediUsage(health.getUsageId()); + } + medicineUsageMapper.deleteSwMedicineUsageDetailsByMediUsage(health.getUsageId()); + medicineUsageMapper.batchSwMedicineUsageDetails(health.getUsageDetails()); + String username = SecurityUtils.getUsername(); + health.setUpdateBy(username); health.setUpdateTime(DateUtils.getNowDate()); return healthMapper.updateHealth(health); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/ImmunityServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/ImmunityServiceImpl.java index 145901b..6556faf 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/ImmunityServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/ImmunityServiceImpl.java @@ -1,12 +1,22 @@ package com.zhyc.module.biosafety.service.impl; +import java.util.ArrayList; import java.util.List; import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; +import com.zhyc.common.utils.bean.BeanUtils; +import com.zhyc.module.base.domain.SheepFile; +import com.zhyc.module.base.mapper.SheepFileMapper; +import com.zhyc.module.biosafety.domain.Deworm; +import com.zhyc.module.biosafety.domain.SwMedicineUsage; +import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails; +import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zhyc.module.biosafety.mapper.ImmunityMapper; import com.zhyc.module.biosafety.domain.Immunity; import com.zhyc.module.biosafety.service.IImmunityService; +import org.springframework.transaction.annotation.Transactional; /** * 免疫Service业务层处理 @@ -20,6 +30,16 @@ public class ImmunityServiceImpl implements IImmunityService @Autowired private ImmunityMapper immunityMapper; + @Autowired + private SwMedicineUsageServiceImpl medicineUsageService; + + @Autowired + private SwMedicineUsageMapper medicineUsageMapper; + + @Autowired + private SheepFileMapper sheepFileMapper; + + /** * 查询免疫 * @@ -29,7 +49,10 @@ public class ImmunityServiceImpl implements IImmunityService @Override public Immunity selectImmunityById(Long id) { - return immunityMapper.selectImmunityById(id); + Immunity immunity = immunityMapper.selectImmunityById(id); + SwMedicineUsage swMedicineUsage = medicineUsageMapper.selectSwMedicineUsageById(immunity.getUsageId()); + immunity.setUsageDetails(swMedicineUsage.getSwMedicineUsageDetailsList()); + return immunity; } /** @@ -53,8 +76,42 @@ public class ImmunityServiceImpl implements IImmunityService @Override public int insertImmunity(Immunity immunity) { + String username = SecurityUtils.getUsername(); + + // 使用记录的文件 + SwMedicineUsage medicineUsage = new SwMedicineUsage(); + medicineUsage.setSwMedicineUsageDetailsList(immunity.getUsageDetails()); + medicineUsage.setName("羊只免疫"); + medicineUsage.setUseType("0"); + medicineUsage.setCreateBy(username); + + List immunities = new ArrayList<>(); + + immunity.setUpdateBy(username); immunity.setCreateTime(DateUtils.getNowDate()); - return immunityMapper.insertImmunity(immunity); + + for (Integer sheepId : immunity.getSheepIds()) { + SheepFile sheepFile = sheepFileMapper.selectSheepFileById(Long.valueOf(sheepId)); + + Immunity imm = new Immunity(); + BeanUtils.copyProperties(immunity, imm); + imm.setSheepId(Long.valueOf(sheepId)); + imm.setVariety(sheepFile.getVariety()); + imm.setSheepType(sheepFile.getName()); + imm.setMonthAge(sheepFile.getMonthAge()); + imm.setGender(String.valueOf(sheepFile.getGender())); + imm.setBreed(sheepFile.getBreed()); + imm.setParity(sheepFile.getParity()); +// 获取药品使用记录的id + Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage); + + imm.setUsageId(usageId); + immunities.add(imm); + } + + + immunity.setCreateTime(DateUtils.getNowDate()); + return immunityMapper.insertImmunity(immunities); } /** @@ -64,8 +121,14 @@ public class ImmunityServiceImpl implements IImmunityService * @return 结果 */ @Override + @Transactional public int updateImmunity(Immunity immunity) { + for (SwMedicineUsageDetails usageDetail : immunity.getUsageDetails()) { + usageDetail.setMediUsage(immunity.getUsageId()); + } + medicineUsageMapper.deleteSwMedicineUsageDetailsByMediUsage(immunity.getUsageId()); + medicineUsageMapper.batchSwMedicineUsageDetails(immunity.getUsageDetails()); immunity.setUpdateTime(DateUtils.getNowDate()); return immunityMapper.updateImmunity(immunity); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/QuarantineReportServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/QuarantineReportServiceImpl.java index dec6015..4c55e78 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/QuarantineReportServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/QuarantineReportServiceImpl.java @@ -3,6 +3,7 @@ package com.zhyc.module.biosafety.service.impl; import java.util.ArrayList; import java.util.List; import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; import com.zhyc.common.utils.StringUtils; import com.zhyc.common.utils.bean.BeanUtils; import com.zhyc.module.base.domain.SheepFile; @@ -60,6 +61,8 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService @Override public int insertQuarantineReport(QuarantineReport quarantineReport) { + String username = SecurityUtils.getUsername(); + quarantineReport.setCreateBy(username); quarantineReport.setCreateTime(DateUtils.getNowDate()); if (quarantineReport.getResult()==null){ quarantineReport.setStatus(0); @@ -94,6 +97,8 @@ public class QuarantineReportServiceImpl implements IQuarantineReportService @Override public int updateQuarantineReport(QuarantineReport quarantineReport) { + String username = SecurityUtils.getUsername(); + quarantineReport.setUpdateBy(username); quarantineReport.setUpdateTime(DateUtils.getNowDate()); return quarantineReportMapper.updateQuarantineReport(quarantineReport); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwMedicineUsageServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwMedicineUsageServiceImpl.java index 684454e..d5d06f9 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwMedicineUsageServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwMedicineUsageServiceImpl.java @@ -2,6 +2,7 @@ package com.zhyc.module.biosafety.service.impl; import java.util.List; import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; import com.zhyc.module.biosafety.service.ISwMedicineUsageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -31,7 +32,7 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService * @return 药品使用记录 */ @Override - public SwMedicineUsage selectSwMedicineUsageById(Long id) + public SwMedicineUsage selectSwMedicineUsageById(Integer id) { return swMedicineUsageMapper.selectSwMedicineUsageById(id); } @@ -58,10 +59,12 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService @Override public int insertSwMedicineUsage(SwMedicineUsage swMedicineUsage) { + String username = SecurityUtils.getUsername(); + swMedicineUsage.setCreateBy(username); swMedicineUsage.setCreateTime(DateUtils.getNowDate()); int rows = swMedicineUsageMapper.insertSwMedicineUsage(swMedicineUsage); insertSwMedicineUsageDetails(swMedicineUsage); - return rows; + return swMedicineUsage.getId(); } /** @@ -74,6 +77,8 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService @Override public int updateSwMedicineUsage(SwMedicineUsage swMedicineUsage) { + String username = SecurityUtils.getUsername(); + swMedicineUsage.setUpdateBy(username); swMedicineUsage.setUpdateTime(DateUtils.getNowDate()); swMedicineUsageMapper.deleteSwMedicineUsageDetailsByMediUsage(swMedicineUsage.getId()); insertSwMedicineUsageDetails(swMedicineUsage); @@ -102,7 +107,7 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService */ @Transactional @Override - public int deleteSwMedicineUsageById(Long id) + public int deleteSwMedicineUsageById(Integer id) { swMedicineUsageMapper.deleteSwMedicineUsageDetailsByMediUsage(id); return swMedicineUsageMapper.deleteSwMedicineUsageById(id); @@ -116,7 +121,7 @@ public class SwMedicineUsageServiceImpl implements ISwMedicineUsageService public void insertSwMedicineUsageDetails(SwMedicineUsage swMedicineUsage) { List swMedicineUsageDetailsList = swMedicineUsage.getSwMedicineUsageDetailsList(); - Long id = swMedicineUsage.getId(); + Integer id = swMedicineUsage.getId(); if (StringUtils.isNotNull(swMedicineUsageDetailsList)) { List list = new ArrayList(); diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwPrescriptionServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwPrescriptionServiceImpl.java index 62058e8..59841b8 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwPrescriptionServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/SwPrescriptionServiceImpl.java @@ -2,6 +2,7 @@ package com.zhyc.module.biosafety.service.impl; import java.util.List; import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; import com.zhyc.module.biosafety.domain.SwPresDetail; import com.zhyc.module.biosafety.domain.SwPrescription; import com.zhyc.module.biosafety.mapper.SwPrescriptionMapper; @@ -58,6 +59,8 @@ public class SwPrescriptionServiceImpl implements ISwPrescriptionService @Override public int insertSwPrescription(SwPrescription swPrescription) { + String username = SecurityUtils.getUsername(); + swPrescription.setCreateBy(username); swPrescription.setCreateTime(DateUtils.getNowDate()); int rows = swPrescriptionMapper.insertSwPrescription(swPrescription); insertSwPresDetail(swPrescription); @@ -74,6 +77,8 @@ public class SwPrescriptionServiceImpl implements ISwPrescriptionService @Override public int updateSwPrescription(SwPrescription swPrescription) { + String username = SecurityUtils.getUsername(); + swPrescription.setUpdateBy(username); swPrescription.setUpdateTime(DateUtils.getNowDate()); swPrescriptionMapper.deleteSwPresDetailByPersId(swPrescription.getId()); insertSwPresDetail(swPrescription); diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/TreatmentServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/TreatmentServiceImpl.java index 1d576f5..7ecd944 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/TreatmentServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/TreatmentServiceImpl.java @@ -1,9 +1,16 @@ package com.zhyc.module.biosafety.service.impl; +import java.util.ArrayList; import java.util.List; import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; +import com.zhyc.common.utils.bean.BeanUtils; +import com.zhyc.module.base.domain.SheepFile; +import com.zhyc.module.base.mapper.SheepFileMapper; +import com.zhyc.module.base.service.impl.SheepFileServiceImpl; import com.zhyc.module.biosafety.domain.SwMedicineUsage; -import com.zhyc.module.biosafety.domain.SwPrescription; +import com.zhyc.module.biosafety.domain.SwMedicineUsageDetails; +import com.zhyc.module.biosafety.mapper.SwMedicineUsageMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zhyc.module.biosafety.mapper.TreatmentMapper; @@ -24,6 +31,10 @@ public class TreatmentServiceImpl implements ITreatmentService private TreatmentMapper treatmentMapper; @Autowired private SwMedicineUsageServiceImpl medicineUsageService; + @Autowired + private SwMedicineUsageMapper medicineUsageMapper; + @Autowired + private SheepFileMapper sheepFileMapper; /** * 查询治疗记录 @@ -34,7 +45,11 @@ public class TreatmentServiceImpl implements ITreatmentService @Override public Treatment selectTreatmentById(Long id) { - return treatmentMapper.selectTreatmentById(id); + Treatment treatment = treatmentMapper.selectTreatmentById(id); +// 获取药品使用记录 + SwMedicineUsage swMedicineUsage = medicineUsageService.selectSwMedicineUsageById(treatment.getUsageId()); + treatment.setUsageDetails(swMedicineUsage.getSwMedicineUsageDetailsList()); + return treatment; } /** @@ -59,14 +74,55 @@ public class TreatmentServiceImpl implements ITreatmentService @Transactional public int insertTreatment(Treatment treatment) { + String username = SecurityUtils.getUsername(); +// 使用记录的文件 SwMedicineUsage medicineUsage = new SwMedicineUsage(); + medicineUsage.setSwMedicineUsageDetailsList(treatment.getUsageDetails()); medicineUsage.setName("羊只治疗"); medicineUsage.setUseType("4"); + medicineUsage.setCreateBy(username); + medicineUsage.setCreateTime(DateUtils.getNowDate()); +// 新增单挑数据 + if (treatment.getSheepId()!=null){ // 药品使用记录 - medicineUsage.setSwMedicineUsageDetailsList(treatment.getUsageDetails()); - medicineUsageService.insertSwMedicineUsage(medicineUsage); - treatment.setCreateTime(DateUtils.getNowDate()); - return treatmentMapper.insertTreatment(treatment); + Integer id=medicineUsageService.insertSwMedicineUsage(medicineUsage); +// 药品使用记录id + treatment.setUsageId(id); + treatment.setCreateTime(DateUtils.getNowDate()); + return treatmentMapper.insertTreatment(treatment); + +// 批量新增 + }else { + + List treatments = new ArrayList<>(); + treatment.setCreateTime(DateUtils.getNowDate()); + for (String sheepId : treatment.getSheepIds()) { + SheepFile sheepFile = sheepFileMapper.selectSheepFileById(Long.valueOf(sheepId)); + Treatment treat = new Treatment(); + BeanUtils.copyProperties(treatment, treat); + treat.setSheepId(Long.valueOf(sheepId)); + treat.setVariety(sheepFile.getVariety()); + treat.setSheepType(sheepFile.getName()); + treat.setMonthAge(sheepFile.getMonthAge()); + treat.setGender(String.valueOf(sheepFile.getGender())); + treat.setBreed(sheepFile.getBreed()); + treat.setParity(sheepFile.getParity()); + treat.setLactDay(sheepFile.getLactationDay()); + treat.setGestDay(sheepFile.getGestationDay()); +// 获取药品使用记录的id + Integer usageId = medicineUsageService.insertSwMedicineUsage(medicineUsage); + System.out.println(medicineUsage); + System.out.println(usageId); + treat.setUsageId(usageId); + treatments.add(treat); + } +// 药品使用记录 + medicineUsage.setSwMedicineUsageDetailsList(treatment.getUsageDetails()); + + + return treatmentMapper.insertTreatmentList(treatments); + } + } /** @@ -76,8 +132,20 @@ public class TreatmentServiceImpl implements ITreatmentService * @return 结果 */ @Override + @Transactional public int updateTreatment(Treatment treatment) { + String username = SecurityUtils.getUsername(); + for (SwMedicineUsageDetails usageDetail : treatment.getUsageDetails()) { + usageDetail.setMediUsage(treatment.getUsageId()); + } + medicineUsageMapper.deleteSwMedicineUsageDetailsByMediUsage(treatment.getUsageId()); + SwMedicineUsage swMedicineUsage = new SwMedicineUsage(); + swMedicineUsage.setId(treatment.getUsageId()); + swMedicineUsage.setUpdateBy(username); + medicineUsageMapper.updateSwMedicineUsage(swMedicineUsage); + medicineUsageMapper.batchSwMedicineUsageDetails(treatment.getUsageDetails()); + treatment.setUpdateBy(username); treatment.setUpdateTime(DateUtils.getNowDate()); return treatmentMapper.updateTreatment(treatment); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/NpFreshMilkInsp.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/NpFreshMilkInsp.java index 15e6314..64e71f6 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/NpFreshMilkInsp.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/NpFreshMilkInsp.java @@ -2,6 +2,9 @@ package com.zhyc.module.dairyProducts.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; @@ -13,6 +16,9 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-18 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class NpFreshMilkInsp extends BaseEntity { private static final long serialVersionUID = 1L; @@ -81,187 +87,4 @@ public class NpFreshMilkInsp extends BaseEntity @Excel(name = "备注") private String commnet; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setSource(String source) - { - this.source = source; - } - - public String getSource() - { - return source; - } - - public void setDatetime(Date datetime) - { - this.datetime = datetime; - } - - public Date getDatetime() - { - return datetime; - } - - public void setFat(Double fat) - { - this.fat = fat; - } - - public Double getFat() - { - return fat; - } - - public void setProtein(Double protein) - { - this.protein = protein; - } - - public Double getProtein() - { - return protein; - } - - public void setNonFat(Double nonFat) - { - this.nonFat = nonFat; - } - - public Double getNonFat() - { - return nonFat; - } - - public void setAcidity(Double acidity) - { - this.acidity = acidity; - } - - public Double getAcidity() - { - return acidity; - } - - public void setBacterialColony1(Double bacterialColony1) - { - this.bacterialColony1 = bacterialColony1; - } - - public Double getBacterialColony1() - { - return bacterialColony1; - } - - public void setBacterialColony2(Double bacterialColony2) - { - this.bacterialColony2 = bacterialColony2; - } - - public Double getBacterialColony2() - { - return bacterialColony2; - } - - public void setBacterialColony3(Double bacterialColony3) - { - this.bacterialColony3 = bacterialColony3; - } - - public Double getBacterialColony3() - { - return bacterialColony3; - } - - public void setBacterialColony4(Double bacterialColony4) - { - this.bacterialColony4 = bacterialColony4; - } - - public Double getBacterialColony4() - { - return bacterialColony4; - } - - public void setBacterialColony5(Double bacterialColony5) - { - this.bacterialColony5 = bacterialColony5; - } - - public Double getBacterialColony5() - { - return bacterialColony5; - } - - public void setColi(Double coli) - { - this.coli = coli; - } - - public Double getColi() - { - return coli; - } - - public void setLactoferrin(Double lactoferrin) - { - this.lactoferrin = lactoferrin; - } - - public Double getLactoferrin() - { - return lactoferrin; - } - - public void setIg(Double ig) - { - this.ig = ig; - } - - public Double getIg() - { - return ig; - } - - public void setCommnet(String commnet) - { - this.commnet = commnet; - } - - public String getCommnet() - { - return commnet; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("source", getSource()) - .append("datetime", getDatetime()) - .append("fat", getFat()) - .append("protein", getProtein()) - .append("nonFat", getNonFat()) - .append("acidity", getAcidity()) - .append("bacterialColony1", getBacterialColony1()) - .append("bacterialColony2", getBacterialColony2()) - .append("bacterialColony3", getBacterialColony3()) - .append("bacterialColony4", getBacterialColony4()) - .append("bacterialColony5", getBacterialColony5()) - .append("coli", getColi()) - .append("lactoferrin", getLactoferrin()) - .append("ig", getIg()) - .append("commnet", getCommnet()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/NpRawMilkInspe.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/NpRawMilkInspe.java index 5b140c6..0c71d35 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/NpRawMilkInspe.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/NpRawMilkInspe.java @@ -344,6 +344,9 @@ package com.zhyc.module.dairyProducts.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; @@ -355,6 +358,9 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-15 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class NpRawMilkInspe extends BaseEntity { private static final long serialVersionUID = 1L; @@ -447,201 +453,4 @@ public class NpRawMilkInspe extends BaseEntity @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; - // Getters and Setters - public void setId(Long id) { - this.id = id; - } - - public Long getId() { - return id; - } - - public void setDatetime(Date datetime) { - this.datetime = datetime; - } - - public Date getDatetime() { - return datetime; - } - - public void setSource(String source) { - this.source = source; - } - - public String getSource() { - return source; - } - - public void setFreeze(Double freeze) { - this.freeze = freeze; - } - - public Double getFreeze() { - return freeze; - } - - public void setDensity(Double density) { - this.density = density; - } - - public Double getDensity() { - return density; - } - - public void setFat(Double fat) { - this.fat = fat; - } - - public Double getFat() { - return fat; - } - - public void setProtein(Double protein) { - this.protein = protein; - } - - public Double getProtein() { - return protein; - } - - public void setNonFat(Double nonFat) { - this.nonFat = nonFat; - } - - public Double getNonFat() { - return nonFat; - } - - public void setDryMatter(Double dryMatter) { - this.dryMatter = dryMatter; - } - - public Double getDryMatter() { - return dryMatter; - } - - public void setImpurityDegree(Double impurityDegree) { - this.impurityDegree = impurityDegree; - } - - public Double getImpurityDegree() { - return impurityDegree; - } - - public void setLactose(Double lactose) { - this.lactose = lactose; - } - - public Double getLactose() { - return lactose; - } - - public void setAshContent(Double ashContent) { - this.ashContent = ashContent; - } - - public Double getAshContent() { - return ashContent; - } - - public void setAcidity(Double acidity) { - this.acidity = acidity; - } - - public Double getAcidity() { - return acidity; - } - - public void setPh(Double ph) { - this.ph = ph; - } - - public Double getPh() { - return ph; - } - - public void setBacterialColony(Double bacterialColony) { - this.bacterialColony = bacterialColony; - } - - public Double getBacterialColony() { - return bacterialColony; - } - - public void setLactoferrin(Double lactoferrin) { - this.lactoferrin = lactoferrin; - } - - public Double getLactoferrin() { - return lactoferrin; - } - - public void setIg(Double ig) { - this.ig = ig; - } - - public Double getIg() { - return ig; - } - - public void setSomaticCell(Double somaticCell) { - this.somaticCell = somaticCell; - } - - public Double getSomaticCell() { - return somaticCell; - } - - public void setUsea(Double usea) { - this.usea = usea; - } - - public Double getUsea() { - return usea; - } - - public void setFatRatio(Double fatRatio) { - this.fatRatio = fatRatio; - } - - public Double getFatRatio() { - return fatRatio; - } - - 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("datetime", getDatetime()) - .append("source", getSource()) - .append("freeze", getFreeze()) - .append("density", getDensity()) - .append("fat", getFat()) - .append("protein", getProtein()) - .append("nonFat", getNonFat()) - .append("dryMatter", getDryMatter()) - .append("impurityDegree", getImpurityDegree()) - .append("lactose", getLactose()) - .append("ashContent", getAshContent()) - .append("acidity", getAcidity()) - .append("ph", getPh()) - .append("bacterialColony", getBacterialColony()) - .append("lactoferrin", getLactoferrin()) - .append("ig", getIg()) - .append("somaticCell", getSomaticCell()) - .append("usea", getUsea()) - .append("fatRatio", getFatRatio()) - .append("comment", getComment()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .toString(); - } } \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/NpYogurtInsp.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/NpYogurtInsp.java index cb57bbc..e284508 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/NpYogurtInsp.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/NpYogurtInsp.java @@ -2,6 +2,9 @@ package com.zhyc.module.dairyProducts.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; @@ -13,6 +16,9 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-17 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class NpYogurtInsp extends BaseEntity { private static final long serialVersionUID = 1L; @@ -82,187 +88,4 @@ public class NpYogurtInsp extends BaseEntity @Excel(name = "备注") private String comment; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setSource(String source) - { - this.source = source; - } - - public String getSource() - { - return source; - } - - public void setDatetime(Date datetime) - { - this.datetime = datetime; - } - - public Date getDatetime() - { - return datetime; - } - - public void setFat(Double fat) - { - this.fat = fat; - } - - public Double getFat() - { - return fat; - } - - public void setProtein(Double protein) - { - this.protein = protein; - } - - public Double getProtein() - { - return protein; - } - - public void setNonFat(Double nonFat) - { - this.nonFat = nonFat; - } - - public Double getNonFat() - { - return nonFat; - } - - public void setAcidity(Double acidity) - { - this.acidity = acidity; - } - - public Double getAcidity() - { - return acidity; - } - - public void setBacterialColony1(Double bacterialColony1) - { - this.bacterialColony1 = bacterialColony1; - } - - public Double getBacterialColony1() - { - return bacterialColony1; - } - - public void setBacterialClony2(Double bacterialClony2) - { - this.bacterialClony2 = bacterialClony2; - } - - public Double getBacterialClony2() - { - return bacterialClony2; - } - - public void setBacterialClony3(Double bacterialClony3) - { - this.bacterialClony3 = bacterialClony3; - } - - public Double getBacterialClony3() - { - return bacterialClony3; - } - - public void setBacterialClony4(Double bacterialClony4) - { - this.bacterialClony4 = bacterialClony4; - } - - public Double getBacterialClony4() - { - return bacterialClony4; - } - - public void setBacterialClony5(Double bacterialClony5) - { - this.bacterialClony5 = bacterialClony5; - } - - public Double getBacterialClony5() - { - return bacterialClony5; - } - - public void setYeast(Double yeast) - { - this.yeast = yeast; - } - - public Double getYeast() - { - return yeast; - } - - public void setMould(Double mould) - { - this.mould = mould; - } - - public Double getMould() - { - return mould; - } - - public void setLacto(Double lacto) - { - this.lacto = lacto; - } - - public Double getLacto() - { - return lacto; - } - - 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("source", getSource()) - .append("datetime", getDatetime()) - .append("fat", getFat()) - .append("protein", getProtein()) - .append("nonFat", getNonFat()) - .append("acidity", getAcidity()) - .append("bacterialColony1", getBacterialColony1()) - .append("bacterialClony2", getBacterialClony2()) - .append("bacterialClony3", getBacterialClony3()) - .append("bacterialClony4", getBacterialClony4()) - .append("bacterialClony5", getBacterialClony5()) - .append("yeast", getYeast()) - .append("mould", getMould()) - .append("lacto", getLacto()) - .append("comment", getComment()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzDryMatterCorrection.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzDryMatterCorrection.java index e7b1e13..a211abb 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzDryMatterCorrection.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzDryMatterCorrection.java @@ -2,11 +2,17 @@ package com.zhyc.module.dairyProducts.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; +@Data +@NoArgsConstructor +@AllArgsConstructor public class XzDryMatterCorrection extends BaseEntity { private static final long serialVersionUID = 1L; @@ -28,29 +34,4 @@ public class XzDryMatterCorrection extends BaseEntity { @Excel(name = "干物质系数") private Double coefficient; - // getters and setters... - public Long getId() { return id; } - public void setId(Long id) { this.id = id; } - public Date getDatetime() { return datetime; } - public void setDatetime(Date datetime) { this.datetime = datetime; } - public String getFactory() { return factory; } - public void setFactory(String factory) { this.factory = factory; } - public Double getContent() { return content; } - public void setContent(Double content) { this.content = content; } - public Double getStandard() { return standard; } - public void setStandard(Double standard) { this.standard = standard; } - public Double getCoefficient() { return coefficient; } - public void setCoefficient(Double coefficient) { this.coefficient = coefficient; } - - @Override - public String toString() { - return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) - .append("id", id) - .append("datetime", datetime) - .append("factory", factory) - .append("content", content) - .append("standard", standard) - .append("coefficient", coefficient) - .toString(); - } } \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzParityCorrection.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzParityCorrection.java index f74f452..d1a93e6 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzParityCorrection.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzParityCorrection.java @@ -1,5 +1,8 @@ package com.zhyc.module.dairyProducts.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-14 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class XzParityCorrection extends BaseEntity { private static final long serialVersionUID = 1L; @@ -26,42 +32,4 @@ public class XzParityCorrection extends BaseEntity @Excel(name = "系数") private Double coef; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setParity(Integer parity) - { - this.parity = parity; - } - - public Integer getParity() - { - return parity; - } - - public void setCoef(Double coef) - { - this.coef = coef; - } - - public Double getCoef() - { - return coef; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("parity", getParity()) - .append("coef", getCoef()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzWegihCorrection.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzWegihCorrection.java index a44abe3..6bba703 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzWegihCorrection.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/domain/XzWegihCorrection.java @@ -2,6 +2,9 @@ package com.zhyc.module.dairyProducts.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; @@ -13,6 +16,9 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-12 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class XzWegihCorrection extends BaseEntity { private static final long serialVersionUID = 1L; @@ -41,73 +47,5 @@ public class XzWegihCorrection extends BaseEntity @Excel(name = "称重系数") private Double coefficient; - public void setId(Long id) - { - this.id = id; - } - public Long getId() - { - return id; - } - - public void setDatetime(Date datetime) - { - this.datetime = datetime; - } - - public Date getDatetime() - { - return datetime; - } - - public void setFactory(String factory) - { - this.factory = factory; - } - - public String getFactory() - { - return factory; - } - - public void setActual(Double actual) - { - this.actual = actual; - } - - public Double getActual() - { - return actual; - } - - public void setSystemMilk(Double systemMilk) - { - this.systemMilk = systemMilk; - } - - public Double getSystemMilk() - { - return systemMilk; - } - - public Double getCoefficient() { - return coefficient; - } - - public void setCoefficient(Double coefficient) { - this.coefficient = coefficient; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("datetime", getDatetime()) - .append("factory", getFactory()) - .append("actual", getActual()) - .append("systemMilk", getSystemMilk()) - .append("coefficient", getCoefficient()) - .toString(); - } } \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/NpFreshMilkInspMapper.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/NpFreshMilkInspMapper.java index 1ec98fa..bb5ca20 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/NpFreshMilkInspMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/NpFreshMilkInspMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.dairyProducts.mapper; import java.util.List; import com.zhyc.module.dairyProducts.domain.NpFreshMilkInsp; +import org.apache.ibatis.annotations.Mapper; /** * 鲜奶生产,成品检验记录Mapper接口 @@ -9,6 +10,7 @@ import com.zhyc.module.dairyProducts.domain.NpFreshMilkInsp; * @author ruoyi * @date 2025-07-18 */ +@Mapper public interface NpFreshMilkInspMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/NpRawMilkInspeMapper.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/NpRawMilkInspeMapper.java index 0391549..8b455ba 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/NpRawMilkInspeMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/NpRawMilkInspeMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.dairyProducts.mapper; import java.util.List; import com.zhyc.module.dairyProducts.domain.NpRawMilkInspe; +import org.apache.ibatis.annotations.Mapper; /** * 生乳检验记录Mapper接口 @@ -9,6 +10,7 @@ import com.zhyc.module.dairyProducts.domain.NpRawMilkInspe; * @author ruoyi * @date 2025-07-15 */ +@Mapper public interface NpRawMilkInspeMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/NpYogurtInspMapper.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/NpYogurtInspMapper.java index eae3d67..5a736d7 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/NpYogurtInspMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/NpYogurtInspMapper.java @@ -3,6 +3,7 @@ package com.zhyc.module.dairyProducts.mapper; import java.util.List; import com.zhyc.module.dairyProducts.domain.NpYogurtInsp; +import org.apache.ibatis.annotations.Mapper; /** * 酸奶生产,成品检疫记录Mapper接口 @@ -10,6 +11,7 @@ import com.zhyc.module.dairyProducts.domain.NpYogurtInsp; * @author ruoyi * @date 2025-07-17 */ +@Mapper public interface NpYogurtInspMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzDryMatterCorrectionMapper.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzDryMatterCorrectionMapper.java index 0db0aff..b84955b 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzDryMatterCorrectionMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzDryMatterCorrectionMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.dairyProducts.mapper; import java.util.List; import com.zhyc.module.dairyProducts.domain.XzDryMatterCorrection; +import org.apache.ibatis.annotations.Mapper; /** * 干物质校正Mapper接口 @@ -9,6 +10,7 @@ import com.zhyc.module.dairyProducts.domain.XzDryMatterCorrection; * @author ruoyi * @date 2025-07-12 */ +@Mapper public interface XzDryMatterCorrectionMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzParityCorrectionMapper.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzParityCorrectionMapper.java index e19c509..d2f4654 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzParityCorrectionMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzParityCorrectionMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.dairyProducts.mapper; import java.util.List; import com.zhyc.module.dairyProducts.domain.XzParityCorrection; +import org.apache.ibatis.annotations.Mapper; /** * 胎次校正Mapper接口 @@ -9,6 +10,7 @@ import com.zhyc.module.dairyProducts.domain.XzParityCorrection; * @author ruoyi * @date 2025-07-14 */ +@Mapper public interface XzParityCorrectionMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzWegihCorrectionMapper.java b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzWegihCorrectionMapper.java index c21fab8..b6313bd 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzWegihCorrectionMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/dairyProducts/mapper/XzWegihCorrectionMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.dairyProducts.mapper; import java.util.List; import com.zhyc.module.dairyProducts.domain.XzWegihCorrection; +import org.apache.ibatis.annotations.Mapper; /** * 称重校正Mapper接口 @@ -9,6 +10,7 @@ import com.zhyc.module.dairyProducts.domain.XzWegihCorrection; * @author ruoyi * @date 2025-07-12 */ +@Mapper public interface XzWegihCorrectionMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/controller/ScBodyMeasureController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/controller/ScBodyMeasureController.java new file mode 100644 index 0000000..23ac1e1 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/controller/ScBodyMeasureController.java @@ -0,0 +1,107 @@ +package com.zhyc.module.produce.bodyManage.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.zhyc.common.utils.SecurityUtils; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.zhyc.common.annotation.Log; +import com.zhyc.common.core.controller.BaseController; +import com.zhyc.common.core.domain.AjaxResult; +import com.zhyc.common.enums.BusinessType; +import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure; +import com.zhyc.module.produce.bodyManage.service.IScBodyMeasureService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 体尺测量Controller + * + * @author ruoyi + * @date 2025-07-27 + */ +@RestController +@RequestMapping("/body_measure/body_measure") +public class ScBodyMeasureController extends BaseController +{ + @Autowired + private IScBodyMeasureService scBodyMeasureService; + + + /** + * 查询体尺测量列表 + */ + @PreAuthorize("@ss.hasPermi('body_measure:body_measure:list')") + @GetMapping("/list") + public TableDataInfo list(ScBodyMeasure scBodyMeasure) + { + startPage(); + List list = scBodyMeasureService.selectScBodyMeasureList(scBodyMeasure); + return getDataTable(list); + } + + /** + * 导出体尺测量列表 + */ + @PreAuthorize("@ss.hasPermi('body_measure:body_measure:export')") + @Log(title = "体尺测量", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ScBodyMeasure scBodyMeasure) + { + List list = scBodyMeasureService.selectScBodyMeasureList(scBodyMeasure); + ExcelUtil util = new ExcelUtil(ScBodyMeasure.class); + util.exportExcel(response, list, "体尺测量数据"); + } + + /** + * 获取体尺测量详细信息 + */ + @PreAuthorize("@ss.hasPermi('body_measure:body_measure:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(scBodyMeasureService.selectScBodyMeasureById(id)); + } + + /** + * 新增体尺测量 + */ + @PreAuthorize("@ss.hasPermi('body_measure:body_measure:add')") + @Log(title = "体尺测量", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ScBodyMeasure scBodyMeasure) + { + return toAjax(scBodyMeasureService.insertScBodyMeasure(scBodyMeasure)); + } + + /** + * 修改体尺测量 + */ + @PreAuthorize("@ss.hasPermi('body_measure:body_measure:edit')") + @Log(title = "体尺测量", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ScBodyMeasure scBodyMeasure) + { + return toAjax(scBodyMeasureService.updateScBodyMeasure(scBodyMeasure)); + } + + /** + * 删除体尺测量 + */ + @PreAuthorize("@ss.hasPermi('body_measure:body_measure:remove')") + @Log(title = "体尺测量", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(scBodyMeasureService.deleteScBodyMeasureByIds(ids)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/controller/ScBodyScoreController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/controller/ScBodyScoreController.java new file mode 100644 index 0000000..d2438a7 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/controller/ScBodyScoreController.java @@ -0,0 +1,104 @@ +package com.zhyc.module.produce.bodyManage.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.zhyc.common.annotation.Log; +import com.zhyc.common.core.controller.BaseController; +import com.zhyc.common.core.domain.AjaxResult; +import com.zhyc.common.enums.BusinessType; +import com.zhyc.module.produce.bodyManage.domain.ScBodyScore; +import com.zhyc.module.produce.bodyManage.service.IScBodyScoreService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 体况评分Controller + * + * @author ruoyi + * @date 2025-07-27 + */ +@RestController +@RequestMapping("/body_score/body_score") +public class ScBodyScoreController extends BaseController +{ + @Autowired + private IScBodyScoreService scBodyScoreService; + + /** + * 查询体况评分列表 + */ + @PreAuthorize("@ss.hasPermi('body_score:body_score:list')") + @GetMapping("/list") + public TableDataInfo list(ScBodyScore scBodyScore) + { + startPage(); + List list = scBodyScoreService.selectScBodyScoreList(scBodyScore); + return getDataTable(list); + } + + /** + * 导出体况评分列表 + */ + @PreAuthorize("@ss.hasPermi('body_score:body_score:export')") + @Log(title = "体况评分", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ScBodyScore scBodyScore) + { + List list = scBodyScoreService.selectScBodyScoreList(scBodyScore); + ExcelUtil util = new ExcelUtil(ScBodyScore.class); + util.exportExcel(response, list, "体况评分数据"); + } + + /** + * 获取体况评分详细信息 + */ + @PreAuthorize("@ss.hasPermi('body_score:body_score:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(scBodyScoreService.selectScBodyScoreById(id)); + } + + /** + * 新增体况评分 + */ + @PreAuthorize("@ss.hasPermi('body_score:body_score:add')") + @Log(title = "体况评分", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ScBodyScore scBodyScore) + { + return toAjax(scBodyScoreService.insertScBodyScore(scBodyScore)); + } + + /** + * 修改体况评分 + */ + @PreAuthorize("@ss.hasPermi('body_score:body_score:edit')") + @Log(title = "体况评分", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ScBodyScore scBodyScore) + { + return toAjax(scBodyScoreService.updateScBodyScore(scBodyScore)); + } + + /** + * 删除体况评分 + */ + @PreAuthorize("@ss.hasPermi('body_score:body_score:remove')") + @Log(title = "体况评分", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(scBodyScoreService.deleteScBodyScoreByIds(ids)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/controller/ScBreastRatingController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/controller/ScBreastRatingController.java new file mode 100644 index 0000000..e6a9cad --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/controller/ScBreastRatingController.java @@ -0,0 +1,104 @@ +package com.zhyc.module.produce.bodyManage.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.zhyc.common.annotation.Log; +import com.zhyc.common.core.controller.BaseController; +import com.zhyc.common.core.domain.AjaxResult; +import com.zhyc.common.enums.BusinessType; +import com.zhyc.module.produce.bodyManage.domain.ScBreastRating; +import com.zhyc.module.produce.bodyManage.service.IScBreastRatingService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 乳房评分Controller + * + * @author ruoyi + * @date 2025-07-27 + */ +@RestController +@RequestMapping("/breast_rating/breast_rating") +public class ScBreastRatingController extends BaseController +{ + @Autowired + private IScBreastRatingService scBreastRatingService; + + /** + * 查询乳房评分列表 + */ + @PreAuthorize("@ss.hasPermi('breast_rating:breast_rating:list')") + @GetMapping("/list") + public TableDataInfo list(ScBreastRating scBreastRating) + { + startPage(); + List list = scBreastRatingService.selectScBreastRatingList(scBreastRating); + return getDataTable(list); + } + + /** + * 导出乳房评分列表 + */ + @PreAuthorize("@ss.hasPermi('breast_rating:breast_rating:export')") + @Log(title = "乳房评分", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ScBreastRating scBreastRating) + { + List list = scBreastRatingService.selectScBreastRatingList(scBreastRating); + ExcelUtil util = new ExcelUtil(ScBreastRating.class); + util.exportExcel(response, list, "乳房评分数据"); + } + + /** + * 获取乳房评分详细信息 + */ + @PreAuthorize("@ss.hasPermi('breast_rating:breast_rating:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(scBreastRatingService.selectScBreastRatingById(id)); + } + + /** + * 新增乳房评分 + */ + @PreAuthorize("@ss.hasPermi('breast_rating:breast_rating:add')") + @Log(title = "乳房评分", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ScBreastRating scBreastRating) + { + return toAjax(scBreastRatingService.insertScBreastRating(scBreastRating)); + } + + /** + * 修改乳房评分 + */ + @PreAuthorize("@ss.hasPermi('breast_rating:breast_rating:edit')") + @Log(title = "乳房评分", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ScBreastRating scBreastRating) + { + return toAjax(scBreastRatingService.updateScBreastRating(scBreastRating)); + } + + /** + * 删除乳房评分 + */ + @PreAuthorize("@ss.hasPermi('breast_rating:breast_rating:remove')") + @Log(title = "乳房评分", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(scBreastRatingService.deleteScBreastRatingByIds(ids)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/domain/ScBodyMeasure.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/domain/ScBodyMeasure.java new file mode 100644 index 0000000..a8efd25 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/domain/ScBodyMeasure.java @@ -0,0 +1,81 @@ +package com.zhyc.module.produce.bodyManage.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.data.annotation.AccessType; + +/** + * 体尺测量对象 sc_body_measure + * + * @author ruoyi + * @date 2025-07-27 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ScBodyMeasure extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** 耳号 */ + private Long sheepId; + @Excel(name = "耳号") + private String manageTags; + + /** 体高 */ + @Excel(name = "体高") + private Long height; + + /** 胸围 */ + @Excel(name = "胸围") + private Long bust; + + /** 体斜长 */ + @Excel(name = "体斜长") + private Long bodyLength; + + /** 管围 */ + @Excel(name = "管围") + private Long pipeLength; + + /** 胸深 */ + @Excel(name = "胸深") + private Long chestDepth; + + /** 臀高 */ + @Excel(name = "臀高") + private Long hipHeight; + + /** 尻宽 */ + @Excel(name = "尻宽") + private Long rumpWidth; + + /** 尻高 */ + @Excel(name = "尻高") + private Long rumpHeignt; + + /** 腰角宽 */ + @Excel(name = "腰角宽") + private Long hipWidth; + + /** 十字部高 */ + @Excel(name = "十字部高") + private Long hipCrossHeight; + + /** 备注 */ + @Excel(name = "备注") + private String comment; + + /** 技术员 */ + @Excel(name = "技术员") + private String technician; + +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/domain/ScBodyScore.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/domain/ScBodyScore.java new file mode 100644 index 0000000..5e5c1bf --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/domain/ScBodyScore.java @@ -0,0 +1,68 @@ +package com.zhyc.module.produce.bodyManage.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; + +/** + * 体况评分对象 sc_body_score + * + * @author ruoyi + * @date 2025-07-27 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ScBodyScore extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * $column.columnComment + */ + private Long id; + + /** + * 羊只id + */ + private String sheepId; + @Excel(name = "管理耳号") + private String manageTags; + /** + * 事件日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "事件日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date datetime; + + /** + * 体况评分 + */ + @Excel(name = "体况评分") + private Long score; + + /** + * 羊舍id + */ + private Long sheepfold; + @Excel(name = "羊舍名称") + private String sheepfoldName; + /** + * 备注 + */ + @Excel(name = "备注") + private String comment; + + /** + * 技术员 + */ + @Excel(name = "技术员") + private String technician; + +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/domain/ScBreastRating.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/domain/ScBreastRating.java new file mode 100644 index 0000000..325a020 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/domain/ScBreastRating.java @@ -0,0 +1,84 @@ +package com.zhyc.module.produce.bodyManage.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; + +/** + * 乳房评分对象 sc_breast_rating + * + * @author ruoyi + * @date 2025-07-27 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ScBreastRating extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * $column.columnComment + */ + private Long id; + + /** + * 羊只id + */ + + private String sheepId; + @Excel(name = "羊只id") + private String manageTags; + /** + * 乳房深度 + */ + @Excel(name = "乳房深度") + private Long depth; + + /** + * 乳房长度 + */ + @Excel(name = "乳房长度") + private Long length; + + /** + * 乳房位置 + */ + @Excel(name = "乳房位置") + private String position; + + /** + * 乳房附着 + */ + @Excel(name = "乳房附着") + private String adbere; + + /** + * 乳房间隔度 + */ + @Excel(name = "乳房间隔度") + private String spacing; + + /** + * 乳房评分 + */ + @Excel(name = "乳房评分") + private Long score; + + /** + * 备注 + */ + @Excel(name = "备注") + private String comment; + + /** + * 技术员 + */ + @Excel(name = "技术员") + private String technician; + + +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/mapper/ScBodyMeasureMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/mapper/ScBodyMeasureMapper.java new file mode 100644 index 0000000..7566ff1 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/mapper/ScBodyMeasureMapper.java @@ -0,0 +1,61 @@ +package com.zhyc.module.produce.bodyManage.mapper; + +import java.util.List; +import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure; + +/** + * 体尺测量Mapper接口 + * + * @author ruoyi + * @date 2025-07-27 + */ +public interface ScBodyMeasureMapper +{ + /** + * 查询体尺测量 + * + * @param id 体尺测量主键 + * @return 体尺测量 + */ + public ScBodyMeasure selectScBodyMeasureById(Long id); + + /** + * 查询体尺测量列表 + * + * @param scBodyMeasure 体尺测量 + * @return 体尺测量集合 + */ + public List selectScBodyMeasureList(ScBodyMeasure scBodyMeasure); + + /** + * 新增体尺测量 + * + * @param scBodyMeasure 体尺测量 + * @return 结果 + */ + public int insertScBodyMeasure(ScBodyMeasure scBodyMeasure); + + /** + * 修改体尺测量 + * + * @param scBodyMeasure 体尺测量 + * @return 结果 + */ + public int updateScBodyMeasure(ScBodyMeasure scBodyMeasure); + + /** + * 删除体尺测量 + * + * @param id 体尺测量主键 + * @return 结果 + */ + public int deleteScBodyMeasureById(Long id); + + /** + * 批量删除体尺测量 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteScBodyMeasureByIds(Long[] ids); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/mapper/ScBodyScoreMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/mapper/ScBodyScoreMapper.java new file mode 100644 index 0000000..1e7a4e6 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/mapper/ScBodyScoreMapper.java @@ -0,0 +1,61 @@ +package com.zhyc.module.produce.bodyManage.mapper; + +import java.util.List; +import com.zhyc.module.produce.bodyManage.domain.ScBodyScore; + +/** + * 体况评分Mapper接口 + * + * @author ruoyi + * @date 2025-07-27 + */ +public interface ScBodyScoreMapper +{ + /** + * 查询体况评分 + * + * @param id 体况评分主键 + * @return 体况评分 + */ + public ScBodyScore selectScBodyScoreById(Long id); + + /** + * 查询体况评分列表 + * + * @param scBodyScore 体况评分 + * @return 体况评分集合 + */ + public List selectScBodyScoreList(ScBodyScore scBodyScore); + + /** + * 新增体况评分 + * + * @param scBodyScore 体况评分 + * @return 结果 + */ + public int insertScBodyScore(ScBodyScore scBodyScore); + + /** + * 修改体况评分 + * + * @param scBodyScore 体况评分 + * @return 结果 + */ + public int updateScBodyScore(ScBodyScore scBodyScore); + + /** + * 删除体况评分 + * + * @param id 体况评分主键 + * @return 结果 + */ + public int deleteScBodyScoreById(Long id); + + /** + * 批量删除体况评分 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteScBodyScoreByIds(Long[] ids); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/mapper/ScBreastRatingMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/mapper/ScBreastRatingMapper.java new file mode 100644 index 0000000..485043a --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/mapper/ScBreastRatingMapper.java @@ -0,0 +1,61 @@ +package com.zhyc.module.produce.bodyManage.mapper; + +import java.util.List; +import com.zhyc.module.produce.bodyManage.domain.ScBreastRating; + +/** + * 乳房评分Mapper接口 + * + * @author ruoyi + * @date 2025-07-27 + */ +public interface ScBreastRatingMapper +{ + /** + * 查询乳房评分 + * + * @param id 乳房评分主键 + * @return 乳房评分 + */ + public ScBreastRating selectScBreastRatingById(Long id); + + /** + * 查询乳房评分列表 + * + * @param scBreastRating 乳房评分 + * @return 乳房评分集合 + */ + public List selectScBreastRatingList(ScBreastRating scBreastRating); + + /** + * 新增乳房评分 + * + * @param scBreastRating 乳房评分 + * @return 结果 + */ + public int insertScBreastRating(ScBreastRating scBreastRating); + + /** + * 修改乳房评分 + * + * @param scBreastRating 乳房评分 + * @return 结果 + */ + public int updateScBreastRating(ScBreastRating scBreastRating); + + /** + * 删除乳房评分 + * + * @param id 乳房评分主键 + * @return 结果 + */ + public int deleteScBreastRatingById(Long id); + + /** + * 批量删除乳房评分 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteScBreastRatingByIds(Long[] ids); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/IScBodyMeasureService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/IScBodyMeasureService.java new file mode 100644 index 0000000..f86848f --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/IScBodyMeasureService.java @@ -0,0 +1,61 @@ +package com.zhyc.module.produce.bodyManage.service; + +import java.util.List; +import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure; + +/** + * 体尺测量Service接口 + * + * @author ruoyi + * @date 2025-07-27 + */ +public interface IScBodyMeasureService +{ + /** + * 查询体尺测量 + * + * @param id 体尺测量主键 + * @return 体尺测量 + */ + public ScBodyMeasure selectScBodyMeasureById(Long id); + + /** + * 查询体尺测量列表 + * + * @param scBodyMeasure 体尺测量 + * @return 体尺测量集合 + */ + public List selectScBodyMeasureList(ScBodyMeasure scBodyMeasure); + + /** + * 新增体尺测量 + * + * @param scBodyMeasure 体尺测量 + * @return 结果 + */ + public int insertScBodyMeasure(ScBodyMeasure scBodyMeasure); + + /** + * 修改体尺测量 + * + * @param scBodyMeasure 体尺测量 + * @return 结果 + */ + public int updateScBodyMeasure(ScBodyMeasure scBodyMeasure); + + /** + * 批量删除体尺测量 + * + * @param ids 需要删除的体尺测量主键集合 + * @return 结果 + */ + public int deleteScBodyMeasureByIds(Long[] ids); + + /** + * 删除体尺测量信息 + * + * @param id 体尺测量主键 + * @return 结果 + */ + public int deleteScBodyMeasureById(Long id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/IScBodyScoreService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/IScBodyScoreService.java new file mode 100644 index 0000000..78ac57d --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/IScBodyScoreService.java @@ -0,0 +1,61 @@ +package com.zhyc.module.produce.bodyManage.service; + +import java.util.List; +import com.zhyc.module.produce.bodyManage.domain.ScBodyScore; + +/** + * 体况评分Service接口 + * + * @author ruoyi + * @date 2025-07-27 + */ +public interface IScBodyScoreService +{ + /** + * 查询体况评分 + * + * @param id 体况评分主键 + * @return 体况评分 + */ + public ScBodyScore selectScBodyScoreById(Long id); + + /** + * 查询体况评分列表 + * + * @param scBodyScore 体况评分 + * @return 体况评分集合 + */ + public List selectScBodyScoreList(ScBodyScore scBodyScore); + + /** + * 新增体况评分 + * + * @param scBodyScore 体况评分 + * @return 结果 + */ + public int insertScBodyScore(ScBodyScore scBodyScore); + + /** + * 修改体况评分 + * + * @param scBodyScore 体况评分 + * @return 结果 + */ + public int updateScBodyScore(ScBodyScore scBodyScore); + + /** + * 批量删除体况评分 + * + * @param ids 需要删除的体况评分主键集合 + * @return 结果 + */ + public int deleteScBodyScoreByIds(Long[] ids); + + /** + * 删除体况评分信息 + * + * @param id 体况评分主键 + * @return 结果 + */ + public int deleteScBodyScoreById(Long id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/IScBreastRatingService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/IScBreastRatingService.java new file mode 100644 index 0000000..81b408f --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/IScBreastRatingService.java @@ -0,0 +1,61 @@ +package com.zhyc.module.produce.bodyManage.service; + +import java.util.List; +import com.zhyc.module.produce.bodyManage.domain.ScBreastRating; + +/** + * 乳房评分Service接口 + * + * @author ruoyi + * @date 2025-07-27 + */ +public interface IScBreastRatingService +{ + /** + * 查询乳房评分 + * + * @param id 乳房评分主键 + * @return 乳房评分 + */ + public ScBreastRating selectScBreastRatingById(Long id); + + /** + * 查询乳房评分列表 + * + * @param scBreastRating 乳房评分 + * @return 乳房评分集合 + */ + public List selectScBreastRatingList(ScBreastRating scBreastRating); + + /** + * 新增乳房评分 + * + * @param scBreastRating 乳房评分 + * @return 结果 + */ + public int insertScBreastRating(ScBreastRating scBreastRating); + + /** + * 修改乳房评分 + * + * @param scBreastRating 乳房评分 + * @return 结果 + */ + public int updateScBreastRating(ScBreastRating scBreastRating); + + /** + * 批量删除乳房评分 + * + * @param ids 需要删除的乳房评分主键集合 + * @return 结果 + */ + public int deleteScBreastRatingByIds(Long[] ids); + + /** + * 删除乳房评分信息 + * + * @param id 乳房评分主键 + * @return 结果 + */ + public int deleteScBreastRatingById(Long id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/impl/ScBodyMeasureServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/impl/ScBodyMeasureServiceImpl.java new file mode 100644 index 0000000..985960e --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/impl/ScBodyMeasureServiceImpl.java @@ -0,0 +1,117 @@ +package com.zhyc.module.produce.bodyManage.service.impl; + +import java.util.List; +import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; +import com.zhyc.common.utils.StringUtils; +import com.zhyc.module.base.domain.BasSheep; +import com.zhyc.module.base.service.IBasSheepService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.produce.bodyManage.mapper.ScBodyMeasureMapper; +import com.zhyc.module.produce.bodyManage.domain.ScBodyMeasure; +import com.zhyc.module.produce.bodyManage.service.IScBodyMeasureService; + +/** + * 体尺测量Service业务层处理 + * + * @author ruoyi + * @date 2025-07-27 + */ +@Service +public class ScBodyMeasureServiceImpl implements IScBodyMeasureService +{ + @Autowired + private ScBodyMeasureMapper scBodyMeasureMapper; + @Autowired + private IBasSheepService basSheepService; + /** + * 查询体尺测量 + * + * @param id 体尺测量主键 + * @return 体尺测量 + */ + @Override + public ScBodyMeasure selectScBodyMeasureById(Long id) + { + return scBodyMeasureMapper.selectScBodyMeasureById(id); + } + + /** + * 查询体尺测量列表 + * + * @param scBodyMeasure 体尺测量 + * @return 体尺测量 + */ + @Override + public List selectScBodyMeasureList(ScBodyMeasure scBodyMeasure) + { + return scBodyMeasureMapper.selectScBodyMeasureList(scBodyMeasure); + } + + /** + * 新增体尺测量 + * + * @param scBodyMeasure 体尺测量 + * @return 结果 + */ + @Override + public int insertScBodyMeasure(ScBodyMeasure scBodyMeasure) + { + String manageTags = scBodyMeasure.getManageTags(); + if (StringUtils.isNotBlank(manageTags)) { + BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags); + if (sheep == null) { + throw new RuntimeException("耳号不存在,请检查输入"); + } + scBodyMeasure.setSheepId(sheep.getId()); + } + scBodyMeasure.setCreateTime(DateUtils.getNowDate()); + scBodyMeasure.setCreateBy(SecurityUtils.getUsername()); + return scBodyMeasureMapper.insertScBodyMeasure(scBodyMeasure); + } + + /** + * 修改体尺测量 + * + * @param scBodyMeasure 体尺测量 + * @return 结果 + */ + @Override + public int updateScBodyMeasure(ScBodyMeasure scBodyMeasure) + { + String manageTags = scBodyMeasure.getManageTags(); + if (StringUtils.isNotBlank(manageTags)) { + BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags); + if (sheep == null) { + throw new RuntimeException("耳号不存在,请检查输入"); + } + scBodyMeasure.setSheepId(sheep.getId()); + } + return scBodyMeasureMapper.updateScBodyMeasure(scBodyMeasure); + } + + /** + * 批量删除体尺测量 + * + * @param ids 需要删除的体尺测量主键 + * @return 结果 + */ + @Override + public int deleteScBodyMeasureByIds(Long[] ids) + { + return scBodyMeasureMapper.deleteScBodyMeasureByIds(ids); + } + + /** + * 删除体尺测量信息 + * + * @param id 体尺测量主键 + * @return 结果 + */ + @Override + public int deleteScBodyMeasureById(Long id) + { + return scBodyMeasureMapper.deleteScBodyMeasureById(id); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/impl/ScBodyScoreServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/impl/ScBodyScoreServiceImpl.java new file mode 100644 index 0000000..1a55d69 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/impl/ScBodyScoreServiceImpl.java @@ -0,0 +1,127 @@ +package com.zhyc.module.produce.bodyManage.service.impl; + +import java.util.List; + +import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; +import com.zhyc.common.utils.StringUtils; +import com.zhyc.module.base.domain.BasSheep; +import com.zhyc.module.base.mapper.BasSheepMapper; +import com.zhyc.module.base.service.IBasSheepService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.produce.bodyManage.mapper.ScBodyScoreMapper; +import com.zhyc.module.produce.bodyManage.domain.ScBodyScore; +import com.zhyc.module.produce.bodyManage.service.IScBodyScoreService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 体况评分Service业务层处理 + * + * @author ruoyi + * @date 2025-07-27 + */ +@Service +public class ScBodyScoreServiceImpl implements IScBodyScoreService { + @Autowired + private ScBodyScoreMapper scBodyScoreMapper; + @Autowired + private IBasSheepService basSheepService; + @Autowired + private BasSheepMapper basSheepMapper; + + /** + * 查询体况评分 + * + * @param id 体况评分主键 + * @return 体况评分 + */ + @Override + public ScBodyScore selectScBodyScoreById(Long id) { + return scBodyScoreMapper.selectScBodyScoreById(id); + } + + /** + * 查询体况评分列表 + * + * @param scBodyScore 体况评分 + * @return 体况评分 + */ + @Override + public List selectScBodyScoreList(ScBodyScore scBodyScore) { + return scBodyScoreMapper.selectScBodyScoreList(scBodyScore); + } + + /** + * 新增体况评分 + * + * @param scBodyScore 体况评分 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int insertScBodyScore(ScBodyScore scBodyScore) { + String manageTags = scBodyScore.getManageTags(); + if (StringUtils.isNotBlank(manageTags)) { + BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags); + if (sheep == null) { + throw new RuntimeException("耳号不存在,请检查输入"); + } + scBodyScore.setSheepId(sheep.getId().toString()); + } + scBodyScore.setCreateTime(DateUtils.getNowDate()); + scBodyScore.setCreateBy(SecurityUtils.getUsername()); + + int insertResult = scBodyScoreMapper.insertScBodyScore(scBodyScore); + + if (insertResult > 0 && scBodyScore.getSheepId() != null) { + BasSheep updateSheep = new BasSheep(); + updateSheep.setId(Long.parseLong(scBodyScore.getSheepId())); + updateSheep.setBody(scBodyScore.getScore()); + basSheepMapper.updateBasSheep(updateSheep); + } + + return insertResult; + } + + /** + * 修改体况评分 + * + * @param scBodyScore 体况评分 + * @return 结果 + */ + @Override + public int updateScBodyScore(ScBodyScore scBodyScore) { + String manageTags = scBodyScore.getManageTags(); + if (StringUtils.isNotBlank(manageTags)) { + BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags); + if (sheep == null) { + throw new RuntimeException("耳号不存在,请检查输入"); + } + scBodyScore.setSheepId(sheep.getId().toString()); + } + return scBodyScoreMapper.updateScBodyScore(scBodyScore); + } + + /** + * 批量删除体况评分 + * + * @param ids 需要删除的体况评分主键 + * @return 结果 + */ + @Override + public int deleteScBodyScoreByIds(Long[] ids) { + return scBodyScoreMapper.deleteScBodyScoreByIds(ids); + } + + /** + * 删除体况评分信息 + * + * @param id 体况评分主键 + * @return 结果 + */ + @Override + public int deleteScBodyScoreById(Long id) { + return scBodyScoreMapper.deleteScBodyScoreById(id); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/impl/ScBreastRatingServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/impl/ScBreastRatingServiceImpl.java new file mode 100644 index 0000000..e813d43 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/bodyManage/service/impl/ScBreastRatingServiceImpl.java @@ -0,0 +1,131 @@ +package com.zhyc.module.produce.bodyManage.service.impl; + +import java.util.List; + +import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; +import com.zhyc.common.utils.StringUtils; +import com.zhyc.module.base.domain.BasSheep; +import com.zhyc.module.base.mapper.BasSheepMapper; +import com.zhyc.module.base.service.IBasSheepService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.produce.bodyManage.mapper.ScBreastRatingMapper; +import com.zhyc.module.produce.bodyManage.domain.ScBreastRating; +import com.zhyc.module.produce.bodyManage.service.IScBreastRatingService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 乳房评分Service业务层处理 + * + * @author ruoyi + * @date 2025-07-27 + */ +@Service +public class ScBreastRatingServiceImpl implements IScBreastRatingService { + @Autowired + private ScBreastRatingMapper scBreastRatingMapper; + + @Autowired + private IBasSheepService basSheepService; + + @Autowired + private BasSheepMapper basSheepMapper; + + /** + * 查询乳房评分 + * + * @param id 乳房评分主键 + * @return 乳房评分 + */ + @Override + public ScBreastRating selectScBreastRatingById(Long id) { + return scBreastRatingMapper.selectScBreastRatingById(id); + } + + /** + * 查询乳房评分列表 + * + * @param scBreastRating 乳房评分 + * @return 乳房评分 + */ + @Override + public List selectScBreastRatingList(ScBreastRating scBreastRating) { + return scBreastRatingMapper.selectScBreastRatingList(scBreastRating); + } + + /** + * 新增乳房评分 + * + * @param scBreastRating 乳房评分 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int insertScBreastRating(ScBreastRating scBreastRating) { + String manageTags = scBreastRating.getManageTags(); + if (StringUtils.isNotBlank(manageTags)) { + BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags); + if (sheep == null) { + throw new RuntimeException("耳号不存在,请检查输入"); + } + scBreastRating.setSheepId(sheep.getId().toString()); + } + scBreastRating.setCreateTime(DateUtils.getNowDate()); + scBreastRating.setCreateBy(SecurityUtils.getUsername()); + int rows = scBreastRatingMapper.insertScBreastRating(scBreastRating); + + if (rows > 0 && scBreastRating.getSheepId() != null) { + Long sheepId = Long.parseLong(scBreastRating.getSheepId()); + Long score = scBreastRating.getScore().longValue(); + + BasSheep updateSheep = new BasSheep(); + updateSheep.setId(sheepId); + updateSheep.setBreast(score); + + basSheepMapper.updateBasSheep(updateSheep); + } + return rows; + } + + /** + * 修改乳房评分 + * + * @param scBreastRating 乳房评分 + * @return 结果 + */ + @Override + public int updateScBreastRating(ScBreastRating scBreastRating) { + String manageTags = scBreastRating.getManageTags(); + if (StringUtils.isNotBlank(manageTags)) { + BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags); + if (sheep == null) { + throw new RuntimeException("耳号不存在,请检查输入"); + } + scBreastRating.setSheepId(sheep.getId().toString()); + } + return scBreastRatingMapper.updateScBreastRating(scBreastRating); + } + + /** + * 批量删除乳房评分 + * + * @param ids 需要删除的乳房评分主键 + * @return 结果 + */ + @Override + public int deleteScBreastRatingByIds(Long[] ids) { + return scBreastRatingMapper.deleteScBreastRatingByIds(ids); + } + + /** + * 删除乳房评分信息 + * + * @param id 乳房评分主键 + * @return 结果 + */ + @Override + public int deleteScBreastRatingById(Long id) { + return scBreastRatingMapper.deleteScBreastRatingById(id); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/RawSpermRecordController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/RawSpermRecordController.java new file mode 100644 index 0000000..17e4ee4 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/RawSpermRecordController.java @@ -0,0 +1,137 @@ +package com.zhyc.module.produce.breed.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.zhyc.common.annotation.Log; +import com.zhyc.common.core.controller.BaseController; +import com.zhyc.common.core.domain.AjaxResult; +import com.zhyc.common.enums.BusinessType; +import com.zhyc.common.utils.StringUtils; +import com.zhyc.module.produce.breed.domain.RawSpermRecord; +import com.zhyc.module.produce.breed.service.IRawSpermRecordService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 采精记录Controller + * + * @author ruoyi + * @date 2025-07-23 + */ +@RestController +@RequestMapping("/Sperm/Sperm") +public class RawSpermRecordController extends BaseController +{ + @Autowired + private IRawSpermRecordService rawSpermRecordService; + + /** + * 查询采精记录列表 + */ + @PreAuthorize("@ss.hasPermi('Sperm:Sperm:list')") + @GetMapping("/list") + public TableDataInfo list(RawSpermRecord rawSpermRecord) + { + startPage(); + List list = rawSpermRecordService.selectRawSpermRecordList(rawSpermRecord); + return getDataTable(list); + } + + /** + * 导出采精记录列表 + */ + @PreAuthorize("@ss.hasPermi('Sperm:Sperm:export')") + @Log(title = "采精记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, RawSpermRecord rawSpermRecord) + { + List list = rawSpermRecordService.selectRawSpermRecordList(rawSpermRecord); + ExcelUtil util = new ExcelUtil(RawSpermRecord.class); + util.exportExcel(response, list, "采精记录数据"); + } + + /** + * 获取采精记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('Sperm:Sperm:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(rawSpermRecordService.selectRawSpermRecordById(id)); + } + + /** + * 新增采精记录 + */ + @PreAuthorize("@ss.hasPermi('Sperm:Sperm:add')") + @Log(title = "采精记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody RawSpermRecord rawSpermRecord) + { + // 如果传入的是耳号,需要先根据耳号查询羊只ID + if (StringUtils.isNotEmpty(rawSpermRecord.getManageTags()) && rawSpermRecord.getSheepId() == null) { + Long sheepId = rawSpermRecordService.getSheepIdByManageTags(rawSpermRecord.getManageTags()); + if (sheepId == null) { + return error("未找到对应耳号的羊只信息"); + } + rawSpermRecord.setSheepId(sheepId); + } + + return toAjax(rawSpermRecordService.insertRawSpermRecord(rawSpermRecord)); + } + + /** + * 修改采精记录 + */ + @PreAuthorize("@ss.hasPermi('Sperm:Sperm:edit')") + @Log(title = "采精记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody RawSpermRecord rawSpermRecord) + { + // 如果传入的是耳号,需要先根据耳号查询羊只ID + if (StringUtils.isNotEmpty(rawSpermRecord.getManageTags()) && rawSpermRecord.getSheepId() == null) { + Long sheepId = rawSpermRecordService.getSheepIdByManageTags(rawSpermRecord.getManageTags()); + if (sheepId == null) { + return error("未找到对应耳号的羊只信息"); + } + rawSpermRecord.setSheepId(sheepId); + } + + return toAjax(rawSpermRecordService.updateRawSpermRecord(rawSpermRecord)); + } + + /** + * 删除采精记录 + */ + @PreAuthorize("@ss.hasPermi('Sperm:Sperm:remove')") + @Log(title = "采精记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(rawSpermRecordService.deleteRawSpermRecordByIds(ids)); + } + + /** + * 根据耳号查询羊只信息 + */ + @GetMapping("/getSheepByManageTags/{manageTags}") + public AjaxResult getSheepByManageTags(@PathVariable("manageTags") String manageTags) + { + Long sheepId = rawSpermRecordService.getSheepIdByManageTags(manageTags); + if (sheepId != null) { + return success(sheepId); + } else { + return error("未找到对应耳号的羊只信息"); + } + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/ScBreedRecordController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/ScBreedRecordController.java new file mode 100644 index 0000000..c80c7ae --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/ScBreedRecordController.java @@ -0,0 +1,158 @@ +package com.zhyc.module.produce.breed.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.zhyc.common.annotation.Log; +import com.zhyc.common.core.controller.BaseController; +import com.zhyc.common.core.domain.AjaxResult; +import com.zhyc.common.enums.BusinessType; +import com.zhyc.module.produce.breed.domain.ScBreedRecord; +import com.zhyc.module.produce.breed.service.IScBreedRecordService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 配种记录Controller + * + * @author ruoyi + * @date 2025-07-23 + */ +@RestController +@RequestMapping("/Breeding_records/Breeding_records") +public class ScBreedRecordController extends BaseController +{ + @Autowired + private IScBreedRecordService scBreedRecordService; + + /** + * 查询配种记录列表 + */ + @PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:list')") + @GetMapping("/list") + public TableDataInfo list(ScBreedRecord scBreedRecord) + { + startPage(); + List list = scBreedRecordService.selectScBreedRecordList(scBreedRecord); + return getDataTable(list); + } + + /** + * 导出配种记录列表 + */ + @PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:export')") + @Log(title = "配种记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ScBreedRecord scBreedRecord) + { + List list = scBreedRecordService.selectScBreedRecordList(scBreedRecord); + ExcelUtil util = new ExcelUtil(ScBreedRecord.class); + util.exportExcel(response, list, "配种记录数据"); + } + + /** + * 获取配种记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(scBreedRecordService.selectScBreedRecordById(id)); + } + + /** + * 根据耳号查询羊只信息 + */ + @PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:query')") + @GetMapping(value = "/getSheepByTags/{manageTags}") + public AjaxResult getSheepInfoByTags(@PathVariable("manageTags") String manageTags) + { + return success(scBreedRecordService.getSheepInfoByTags(manageTags)); + } + + /** + * 根据母羊耳号获取配种计划信息 + */ + @PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:query')") + @GetMapping(value = "/getBreedPlan/{manageTags}") + public AjaxResult getBreedPlanByEweTags(@PathVariable("manageTags") String manageTags) + { + return success(scBreedRecordService.getBreedPlanByEweTags(manageTags)); + } + + /** + * 新增配种记录 + */ + @PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:add')") + @Log(title = "配种记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ScBreedRecord scBreedRecord) + { + // 如果传入的是耳号,需要转换为羊只ID + if (scBreedRecord.getEweManageTags() != null && !scBreedRecord.getEweManageTags().isEmpty()) { + Long eweId = scBreedRecordService.getSheepIdByTags(scBreedRecord.getEweManageTags()); + if (eweId == null) { + return error("未找到母羊耳号对应的羊只信息"); + } + scBreedRecord.setEweId(eweId.toString()); + } + + if (scBreedRecord.getRamManageTags() != null && !scBreedRecord.getRamManageTags().isEmpty()) { + Long ramId = scBreedRecordService.getRamIdByTags(scBreedRecord.getRamManageTags()); + if (ramId == null) { + return error("未找到公羊耳号对应的羊只信息"); + } + scBreedRecord.setRamId(ramId.toString()); + } + + return toAjax(scBreedRecordService.insertScBreedRecord(scBreedRecord)); + } + + /** + * 修改配种记录 + */ + @PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:edit')") + @Log(title = "配种记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ScBreedRecord scBreedRecord) + { + // 如果传入的是耳号,需要转换为羊只ID + if (scBreedRecord.getEweManageTags() != null && !scBreedRecord.getEweManageTags().isEmpty()) { + Long eweId = scBreedRecordService.getSheepIdByTags(scBreedRecord.getEweManageTags()); + if (eweId == null) { + return error("未找到母羊耳号对应的羊只信息"); + } + scBreedRecord.setEweId(eweId.toString()); + } + + if (scBreedRecord.getRamManageTags() != null && !scBreedRecord.getRamManageTags().isEmpty()) { + Long ramId = scBreedRecordService.getRamIdByTags(scBreedRecord.getRamManageTags()); + if (ramId == null) { + return error("未找到公羊耳号对应的羊只信息"); + } + scBreedRecord.setRamId(ramId.toString()); + } + + return toAjax(scBreedRecordService.updateScBreedRecord(scBreedRecord)); + } + + /** + * 删除配种记录 + */ + @PreAuthorize("@ss.hasPermi('Breeding_records:Breeding_records:remove')") + @Log(title = "配种记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(scBreedRecordService.deleteScBreedRecordByIds(ids)); + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/ScPregnancyRecordController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/ScPregnancyRecordController.java index 7dd6649..08d5cc1 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/ScPregnancyRecordController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/ScPregnancyRecordController.java @@ -1,10 +1,8 @@ package com.zhyc.module.produce.breed.controller; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletResponse; - -import com.zhyc.module.produce.breed.domain.ScPregnancyRecord; -import com.zhyc.module.produce.breed.service.IScPregnancyRecordService; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -14,20 +12,22 @@ 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.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.zhyc.common.annotation.Log; import com.zhyc.common.core.controller.BaseController; import com.zhyc.common.core.domain.AjaxResult; import com.zhyc.common.enums.BusinessType; - +import com.zhyc.module.produce.breed.domain.ScPregnancyRecord; +import com.zhyc.module.produce.breed.service.IScPregnancyRecordService; import com.zhyc.common.utils.poi.ExcelUtil; import com.zhyc.common.core.page.TableDataInfo; /** * 孕检记录Controller - * - * @author ruoyi - * @date 2025-07-17 + * + * @author zhyc + * @date 2025-01-21 */ @RestController @RequestMapping("/Pregnancy_Test/Pregnancy_Test") @@ -98,9 +98,19 @@ public class ScPregnancyRecordController extends BaseController */ @PreAuthorize("@ss.hasPermi('Pregnancy_Test:Pregnancy_Test:remove')") @Log(title = "孕检记录", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") + @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(scPregnancyRecordService.deleteScPregnancyRecordByIds(ids)); } -} + + /** + * 根据耳号获取羊只信息 + */ + @GetMapping("/getSheepByManageTags") + public AjaxResult getSheepByManageTags(@RequestParam("manageTags") String manageTags) + { + Map sheepInfo = scPregnancyRecordService.getSheepByManageTags(manageTags); + return success(sheepInfo); + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/RawSpermRecord.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/RawSpermRecord.java new file mode 100644 index 0000000..2f1c625 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/RawSpermRecord.java @@ -0,0 +1,83 @@ +package com.zhyc.module.produce.breed.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; + +/** + * 采精记录对象 raw_sperm_record + * + * @author ruoyi + * @date 2025-07-23 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class RawSpermRecord extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 羊只ID */ + @Excel(name = "羊只ID") + private Long sheepId; + + /** 耳号 */ + @Excel(name = "耳号") + private String manageTags; + + /** 电子耳号 */ + @Excel(name = "电子耳号") + private String electronicTags; + + /** 月龄 */ + @Excel(name = "月龄") + private Long monthAge; + + /** 采精日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "采精日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date pickDate; + + /** 采精量 */ + @Excel(name = "采精量") + private Long amount; + + /** 精液密度 */ + @Excel(name = "精液密度") + private String density; + + /** 精液活力 */ + @Excel(name = "精液活力") + private String vitallity; + + /** 是否性控(0否1是) */ + @Excel(name = "是否性控", readConverterExp = "0=否,1=是") + private Long controlled; + + /** 性欲情况 */ + @Excel(name = "性欲情况") + private String sexualStatus; + + /** 诊疗信息 */ + @Excel(name = "诊疗信息") + private String info; + + /** 技术员 */ + @Excel(name = "技术员") + private String technician; + + /** 采集备注 */ + @Excel(name = "采集备注") + private String comment; + + +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScBreedPlan.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScBreedPlan.java index c888a03..1989341 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScBreedPlan.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScBreedPlan.java @@ -1,5 +1,8 @@ package com.zhyc.module.produce.breed.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-16 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class ScBreedPlan extends BaseEntity { private static final long serialVersionUID = 1L; @@ -30,53 +36,4 @@ public class ScBreedPlan extends BaseEntity @Excel(name = "配种类型") private Long breedType; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setRamId(String ramId) - { - this.ramId = ramId; - } - - public String getRamId() - { - return ramId; - } - - public void setEweId(String eweId) - { - this.eweId = eweId; - } - - public String getEweId() - { - return eweId; - } - - public void setBreedType(Long breedType) - { - this.breedType = breedType; - } - - public Long getBreedType() - { - return breedType; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("ramId", getRamId()) - .append("eweId", getEweId()) - .append("breedType", getBreedType()) - .toString(); - } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScBreedPlanGenerate.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScBreedPlanGenerate.java index 1622ae6..db6f059 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScBreedPlanGenerate.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScBreedPlanGenerate.java @@ -2,6 +2,9 @@ package com.zhyc.module.produce.breed.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; @@ -13,6 +16,9 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-16 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class ScBreedPlanGenerate extends BaseEntity { private static final long serialVersionUID = 1L; @@ -61,134 +67,4 @@ public class ScBreedPlanGenerate extends BaseEntity /** 审批意见 */ private String approveRemark; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setPlanName(String planName) - { - this.planName = planName; - } - - public String getPlanName() - { - return planName; - } - - public void setPlanType(Integer planType) - { - this.planType = planType; - } - - public Integer getPlanType() - { - return planType; - } - - public void setPlanDate(Date planDate) - { - this.planDate = planDate; - } - - public Date getPlanDate() - { - return planDate; - } - - public void setTotalEweCount(Integer totalEweCount) - { - this.totalEweCount = totalEweCount; - } - - public Integer getTotalEweCount() - { - return totalEweCount; - } - - public void setTotalRamCount(Integer totalRamCount) - { - this.totalRamCount = totalRamCount; - } - - public Integer getTotalRamCount() - { - return totalRamCount; - } - - public void setBreedRatio(String breedRatio) - { - this.breedRatio = breedRatio; - } - - public String getBreedRatio() - { - return breedRatio; - } - - public void setStatus(Integer status) - { - this.status = status; - } - - public Integer getStatus() - { - return status; - } - - public void setApprover(String approver) - { - this.approver = approver; - } - - public String getApprover() - { - return approver; - } - - public void setApproveTime(Date approveTime) - { - this.approveTime = approveTime; - } - - public Date getApproveTime() - { - return approveTime; - } - - public void setApproveRemark(String approveRemark) - { - this.approveRemark = approveRemark; - } - - public String getApproveRemark() - { - return approveRemark; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("planName", getPlanName()) - .append("planType", getPlanType()) - .append("planDate", getPlanDate()) - .append("totalEweCount", getTotalEweCount()) - .append("totalRamCount", getTotalRamCount()) - .append("breedRatio", getBreedRatio()) - .append("status", getStatus()) - .append("approver", getApprover()) - .append("approveTime", getApproveTime()) - .append("approveRemark", getApproveRemark()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .toString(); - } } \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScBreedPlanTemp.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScBreedPlanTemp.java index 132ce77..4380caf 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScBreedPlanTemp.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScBreedPlanTemp.java @@ -1,5 +1,8 @@ package com.zhyc.module.produce.breed.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-16 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class ScBreedPlanTemp extends BaseEntity { private static final long serialVersionUID = 1L; @@ -63,110 +69,5 @@ public class ScBreedPlanTemp extends BaseEntity return id; } - public void setPlanGenerateId(Long planGenerateId) - { - this.planGenerateId = planGenerateId; - } - public Long getPlanGenerateId() - { - return planGenerateId; - } - - public void setRamId(String ramId) - { - this.ramId = ramId; - } - - public String getRamId() - { - return ramId; - } - - public void setEweId(String eweId) - { - this.eweId = eweId; - } - - public String getEweId() - { - return eweId; - } - - public void setBreedType(Long breedType) - { - this.breedType = breedType; - } - - public Long getBreedType() - { - return breedType; - } - - public void setRamManageTags(String ramManageTags) - { - this.ramManageTags = ramManageTags; - } - - public String getRamManageTags() - { - return ramManageTags; - } - - public void setRamVariety(String ramVariety) - { - this.ramVariety = ramVariety; - } - - public String getRamVariety() - { - return ramVariety; - } - - public void setEweManageTags(String eweManageTags) - { - this.eweManageTags = eweManageTags; - } - - public String getEweManageTags() - { - return eweManageTags; - } - - public void setEweVariety(String eweVariety) - { - this.eweVariety = eweVariety; - } - - public String getEweVariety() - { - return eweVariety; - } - - public void setEweWeight(Double eweWeight) - { - this.eweWeight = eweWeight; - } - - public Double getEweWeight() - { - return eweWeight; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("planGenerateId", getPlanGenerateId()) - .append("ramId", getRamId()) - .append("eweId", getEweId()) - .append("breedType", getBreedType()) - .append("ramManageTags", getRamManageTags()) - .append("ramVariety", getRamVariety()) - .append("eweManageTags", getEweManageTags()) - .append("eweVariety", getEweVariety()) - .append("eweWeight", getEweWeight()) - .append("createTime", getCreateTime()) - .toString(); - } } \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScBreedRecord.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScBreedRecord.java new file mode 100644 index 0000000..c5f548d --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScBreedRecord.java @@ -0,0 +1,116 @@ +package com.zhyc.module.produce.breed.domain; + +import java.math.BigDecimal; +import java.util.Date; + +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; + +/** + * 配种记录对象 sc_breed_record + * + * @author ruoyi + * @date 2025-07-23 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ScBreedRecord extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 羊只id */ + @Excel(name = "羊只id") + private Long sheepId; + + /** 配种公羊id */ + @Excel(name = "配种公羊id") + private String ramId; + + /** 配种母羊id */ + @Excel(name = "配种母羊id") + private String eweId; + + /** 技术员 */ + @Excel(name = "技术员") + private String technician; + + /** 繁殖用药/耗精量 */ + @Excel(name = "耗精量") + private String breedDrugs; + + // ============ 显示字段 ============ + + /** 母羊耳号 */ + @Excel(name = "耳号") + private String eweManageTags; + + /** 母羊品种 */ + @Excel(name = "品种") + private String eweVariety; + + /** 公羊耳号 */ + @Excel(name = "配种公羊") + private String ramManageTags; + + /** 公羊品种 */ + @Excel(name = "配种公羊品种") + private String ramVariety; + + /** 胎次 */ + @Excel(name = "胎次") + private Integer eweParity; + + /** 月龄 */ + @Excel(name = "月龄") + private Integer eweMonthAge; + + /** 羊舍名称 */ + @Excel(name = "当前羊舍") + private String eweSheepfoldName; + + /** 繁育状态 */ + @Excel(name = "繁育状态") + private String eweBreedStatus; + + /** 是否性控 */ + @Excel(name = "是否性控", readConverterExp = "0=否,1=是") + private Integer eweControlled; + + /** 羊只备注 */ + @Excel(name = "羊只备注") + private String eweComment; + + /** 牧场名称 */ + @Excel(name = "所在牧场") + private String ranchName; + + /** 配种方式 */ + @Excel(name = "配种方式") + private String matingType; + + /** 羊只类别 */ + @Excel(name = "配种时羊只类别") + private String sheepType; + + /** 配次 */ + @Excel(name = "配次") + private Integer matingCount; + + /** 发情后配种时间 */ + @Excel(name = "发情后配种时间(小时)") + private Long timeSincePlanning; + + /** 牧场ID */ + private Long ranchId; + + +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScDryMilk.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScDryMilk.java index 7ffa127..07f0fb8 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScDryMilk.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScDryMilk.java @@ -2,6 +2,9 @@ package com.zhyc.module.produce.breed.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; @@ -13,6 +16,9 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-15 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class ScDryMilk extends BaseEntity { private static final long serialVersionUID = 1L; @@ -63,127 +69,5 @@ public class ScDryMilk extends BaseEntity @Excel(name = "事件类型") private String eventType; - public void setId(Long id) - { - this.id = id; - } - public Long getId() - { - return id; - } - public void setSheepId(String sheepId) - { - this.sheepId = sheepId; - } - - public String getSheepId() - { - return sheepId; - } - public void setDatetime(Date datetime) - { - this.datetime = datetime; - } - - public Date getDatetime() - { - return datetime; - } - public void setStatus(Long status) - { - this.status = status; - } - - public Long getStatus() - { - return status; - } - public void setSheepfold(Long sheepfold) - { - this.sheepfold = sheepfold; - } - - public Long getSheepfold() - { - return sheepfold; - } - public void setTecahnician(String tecahnician) - { - this.tecahnician = tecahnician; - } - - public String getTecahnician() - { - return tecahnician; - } - - public void setComment(String comment) - { - this.comment = comment; - } - - public String getComment() - { - return comment; - } - - public void setManageTags(String manageTags) - { - this.manageTags = manageTags; - } - - public String getManageTags() - { - return manageTags; - } - - public void setVariety(String variety) - { - this.variety = variety; - } - - public String getVariety() - { - return variety; - } - - public void setSheepfoldName(String sheepfoldName) - { - this.sheepfoldName = sheepfoldName; - } - - public String getSheepfoldName() - { - return sheepfoldName; - } - - public void setEventType(String eventType) - { - this.eventType = eventType; - } - - public String getEventType() - { - return eventType; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("sheepId", getSheepId()) - .append("datetime", getDatetime()) - .append("status", getStatus()) - .append("sheepfold", getSheepfold()) - .append("tecahnician", getTecahnician()) - .append("comment", getComment()) - .append("manageTags", getManageTags()) - .append("variety", getVariety()) - .append("sheepfoldName", getSheepfoldName()) - .append("eventType", getEventType()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .toString(); - } } \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScLambDetail.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScLambDetail.java index f2bcb3a..69044e4 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScLambDetail.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScLambDetail.java @@ -5,6 +5,9 @@ import java.util.Date; import java.util.List; 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; @@ -16,6 +19,9 @@ import com.zhyc.common.core.domain.BaseEntity; * @author ruoyi * @date 2025-07-11 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class ScLambDetail extends BaseEntity { private static final long serialVersionUID = 1L; @@ -84,159 +90,5 @@ public class ScLambDetail extends BaseEntity return id; } - public void setLambingRecordId(Long lambingRecordId) - { - this.lambingRecordId = lambingRecordId; - } - public Long getLambingRecordId() - { - return lambingRecordId; - } - - public void setLambEarNumber(String lambEarNumber) - { - this.lambEarNumber = lambEarNumber; - } - - public String getLambEarNumber() - { - return lambEarNumber; - } - - public void setLambBreed(Integer lambBreed) // 改为Integer类型 - { - this.lambBreed = lambBreed; - } - - public Integer getLambBreed() // 改为Integer类型 - { - return lambBreed; - } - - public void setGender(Integer gender) - { - this.gender = gender; - } - - public Integer getGender() - { - return gender; - } - - public void setBirthWeight(BigDecimal birthWeight) - { - this.birthWeight = birthWeight; - } - - public BigDecimal getBirthWeight() - { - return birthWeight; - } - - public void setIsRetained(Boolean isRetained) - { - this.isRetained = isRetained; - } - - public Boolean getIsRetained() - { - return isRetained; - } - - public void setLineage(String lineage) - { - this.lineage = lineage; - } - - public String getLineage() - { - return lineage; - } - - public void setBirthday(Date birthday) - { - this.birthday = birthday; - } - - public Date getBirthday() - { - return birthday; - } - - public List getLambDetails() - { - return lambDetails; - } - - public void setLambDetails(List lambDetails) - { - this.lambDetails = lambDetails; - } - - public Long getMotherId() - { - return motherId; - } - - public void setMotherId(Long motherId) - { - this.motherId = motherId; - } - - public Long getFatherId() - { - return fatherId; - } - - public void setFatherId(Long fatherId) - { - this.fatherId = fatherId; - } - - public Integer getRanchId() - { - return ranchId; - } - - public void setRanchId(Integer ranchId) - { - this.ranchId = ranchId; - } - - public Integer getSheepfoldId() - { - return sheepfoldId; - } - - public void setSheepfoldId(Integer sheepfoldId) - { - this.sheepfoldId = sheepfoldId; - } - - public Integer getParity() - { - return parity; - } - - public void setParity(Integer parity) - { - this.parity = parity; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("lambingRecordId", getLambingRecordId()) - .append("lambEarNumber", getLambEarNumber()) - .append("lambBreed", getLambBreed()) - .append("gender", getGender()) - .append("birthWeight", getBirthWeight()) - .append("isRetained", getIsRetained()) - .append("lineage", getLineage()) - .append("birthday", getBirthday()) - .append("createTime", getCreateTime()) - .toString(); - } } \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScLambingRecord.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScLambingRecord.java index 895ad55..bfb27a0 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScLambingRecord.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScLambingRecord.java @@ -385,17 +385,3 @@ public class ScLambingRecord extends BaseEntity } } -/** - * 羊只羔羊信息对象(用于产羔详情显示) - */ -class SheepLambInfo { - private String lambEarNumber; // 羔羊耳号 - private String lambBreed; // 羔羊品种 - private Integer gender; // 性别 - private Double birthWeight; // 出生重量 - private Boolean isRetained; // 是否留养 - private String lineage; // 家系 - private Date birthday; // 生日 - - // getter和setter方法... -} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScPregnancyRecord.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScPregnancyRecord.java index 558d1a8..f02d38f 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScPregnancyRecord.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScPregnancyRecord.java @@ -1,7 +1,11 @@ package com.zhyc.module.produce.breed.domain; +import java.math.BigDecimal; 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; @@ -9,17 +13,28 @@ import com.zhyc.common.core.domain.BaseEntity; /** * 孕检记录对象 sc_pregnancy_record - * - * @author ruoyi - * @date 2025-07-17 + * + * @author zhyc + * @date 2025-01-21 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class ScPregnancyRecord extends BaseEntity { private static final long serialVersionUID = 1L; - /** $column.columnComment */ + /** 主键ID */ private Long id; + /** 羊只ID */ + @Excel(name = "羊只ID") + private Long sheepId; + + /** 耳号 */ + @Excel(name = "耳号") + private String manageTags; + /** 孕检日期 */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "孕检日期", width = 30, dateFormat = "yyyy-MM-dd") @@ -29,89 +44,79 @@ public class ScPregnancyRecord extends BaseEntity @Excel(name = "孕检结果") private String result; - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") - private Long number; + /** 胎儿数量 */ + @Excel(name = "胎儿数量") + private Integer fetusCount; /** 技术员 */ @Excel(name = "技术员") private String technician; - /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") - private Long way; + /** 孕检方式 */ + @Excel(name = "孕检方式") + private String way; - public void setId(Long id) - { - this.id = id; - } + /** 备注 */ + @Excel(name = "备注") + private String remark; - public Long getId() - { - return id; - } + /** 是否删除 */ + private Integer isDelete; - public void setDatetime(Date datetime) - { - this.datetime = datetime; - } + // 关联查询字段 + /** 品种 */ + @Excel(name = "品种") + private String variety; - public Date getDatetime() - { - return datetime; - } + /** 月龄 */ + @Excel(name = "月龄") + private Long monthAge; - public void setResult(String result) - { - this.result = result; - } + /** 胎次 */ + @Excel(name = "胎次") + private Integer parity; - public String getResult() - { - return result; - } + /** 配次 */ + @Excel(name = "配次") + private Integer matingCounts; - public void setNumber(Long number) - { - this.number = number; - } + /** 当前羊舍 */ + @Excel(name = "当前羊舍") + private String sheepfoldName; - public Long getNumber() - { - return number; - } + /** 繁育状态 */ + @Excel(name = "繁育状态") + private String breedStatus; - public void setTechnician(String technician) - { - this.technician = technician; - } + /** 配种公羊耳号 */ + @Excel(name = "配种公羊") + private String fatherManageTags; - public String getTechnician() - { - return technician; - } + /** 配种公羊品种 */ + @Excel(name = "配种公羊品种") + private String fatherVariety; - public void setWay(Long way) - { - this.way = way; - } + /** 配种类型 */ + @Excel(name = "配种类型") + private String matingTypeName; - public Long getWay() - { - return way; - } + /** 配种日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "配种日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date matingDate; - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("datetime", getDatetime()) - .append("result", getResult()) - .append("number", getNumber()) - .append("technician", getTechnician()) - .append("way", getWay()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .toString(); - } -} + /** 预产日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "预产日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date expectedDate; + + /** 上次事件日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "上次事件日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date lastEventDate; + + /** 所在牧场 */ + @Excel(name = "所在牧场") + private String ranchName; + +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScWeanRecord.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScWeanRecord.java index 06ca783..79c70ce 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScWeanRecord.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/ScWeanRecord.java @@ -5,6 +5,9 @@ import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import com.zhyc.common.annotation.Excel; import com.zhyc.common.core.domain.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -14,6 +17,9 @@ import org.apache.commons.lang3.builder.ToStringStyle; * @author zhyc * @date 2024-01-01 */ +@Data +@NoArgsConstructor +@AllArgsConstructor public class ScWeanRecord extends BaseEntity { private static final long serialVersionUID = 1L; @@ -90,173 +96,5 @@ public class ScWeanRecord extends BaseEntity { @Excel(name = "繁育状态") private String breedingStatus; - 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 setDatetime(Date datetime) { - this.datetime = datetime; - } - - public Date getDatetime() { - return datetime; - } - - public void setWeight(BigDecimal weight) { - this.weight = weight; - } - - public BigDecimal getWeight() { - return weight; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getStatus() { - return status; - } - - public void setTechnician(String technician) { - this.technician = technician; - } - - public String getTechnician() { - return technician; - } - - public void setComment(String comment) { - this.comment = comment; - } - - public String getComment() { - return comment; - } - - public void setElectronicTags(String electronicTags) { - this.electronicTags = electronicTags; - } - - public String getElectronicTags() { - return electronicTags; - } - - public void setEarNumber(String earNumber) { - this.earNumber = earNumber; - } - - public String getEarNumber() { - return earNumber; - } - - public void setBreed(String breed) { - this.breed = breed; - } - - public String getBreed() { - return breed; - } - - public void setEventType(String eventType) { - this.eventType = eventType; - } - - public String getEventType() { - return eventType; - } - - public void setGender(String gender) { - this.gender = gender; - } - - public String getGender() { - return gender; - } - - public void setFatherNumber(String fatherNumber) { - this.fatherNumber = fatherNumber; - } - - public String getFatherNumber() { - return fatherNumber; - } - - public void setMotherNumber(String motherNumber) { - this.motherNumber = motherNumber; - } - - public String getMotherNumber() { - return motherNumber; - } - - public void setMonthAge(Integer monthAge) { - this.monthAge = monthAge; - } - - public Integer getMonthAge() { - return monthAge; - } - - public void setBirthWeight(BigDecimal birthWeight) { - this.birthWeight = birthWeight; - } - - public BigDecimal getBirthWeight() { - return birthWeight; - } - - public void setSheepPen(String sheepPen) { - this.sheepPen = sheepPen; - } - - public String getSheepPen() { - return sheepPen; - } - - public void setBreedingStatus(String breedingStatus) { - this.breedingStatus = breedingStatus; - } - - public String getBreedingStatus() { - return breedingStatus; - } - - @Override - public String toString() { - return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("sheepId", getSheepId()) - .append("datetime", getDatetime()) - .append("weight", getWeight()) - .append("status", getStatus()) - .append("technician", getTechnician()) - .append("comment", getComment()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("electronicTags", getElectronicTags()) - .append("earNumber", getEarNumber()) - .append("breed", getBreed()) - .append("eventType", getEventType()) - .append("gender", getGender()) - .append("fatherNumber", getFatherNumber()) - .append("motherNumber", getMotherNumber()) - .append("monthAge", getMonthAge()) - .append("birthWeight", getBirthWeight()) - .append("sheepPen", getSheepPen()) - .append("breedingStatus", getBreedingStatus()) - .toString(); - } } \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/SheepLambInfo.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/SheepLambInfo.java new file mode 100644 index 0000000..e8b79f7 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/domain/SheepLambInfo.java @@ -0,0 +1,25 @@ +package com.zhyc.module.produce.breed.domain; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * 羊只羔羊信息对象(用于产羔详情显示) + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +class SheepLambInfo { + private String lambEarNumber; // 羔羊耳号 + private String lambBreed; // 羔羊品种 + private Integer gender; // 性别 + private Double birthWeight; // 出生重量 + private Boolean isRetained; // 是否留养 + private String lineage; // 家系 + private Date birthday; // 生日 + + +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/RawSpermRecordMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/RawSpermRecordMapper.java new file mode 100644 index 0000000..a3b9ef8 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/RawSpermRecordMapper.java @@ -0,0 +1,69 @@ +package com.zhyc.module.produce.breed.mapper; + +import java.util.List; +import com.zhyc.module.produce.breed.domain.RawSpermRecord; + +/** + * 采精记录Mapper接口 + * + * @author ruoyi + * @date 2025-07-23 + */ +public interface RawSpermRecordMapper +{ + /** + * 查询采精记录 + * + * @param id 采精记录主键 + * @return 采精记录 + */ + public RawSpermRecord selectRawSpermRecordById(Long id); + + /** + * 查询采精记录列表 + * + * @param rawSpermRecord 采精记录 + * @return 采精记录集合 + */ + public List selectRawSpermRecordList(RawSpermRecord rawSpermRecord); + + /** + * 新增采精记录 + * + * @param rawSpermRecord 采精记录 + * @return 结果 + */ + public int insertRawSpermRecord(RawSpermRecord rawSpermRecord); + + /** + * 修改采精记录 + * + * @param rawSpermRecord 采精记录 + * @return 结果 + */ + public int updateRawSpermRecord(RawSpermRecord rawSpermRecord); + + /** + * 删除采精记录 + * + * @param id 采精记录主键 + * @return 结果 + */ + public int deleteRawSpermRecordById(Long id); + + /** + * 批量删除采精记录 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteRawSpermRecordByIds(Long[] ids); + + /** + * 根据耳号查询羊只ID + * + * @param manageTags 耳号 + * @return 羊只ID + */ + public Long selectSheepIdByManageTags(String manageTags); +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScBreedPlanGenerateMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScBreedPlanGenerateMapper.java index a578784..00eaf16 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScBreedPlanGenerateMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScBreedPlanGenerateMapper.java @@ -2,6 +2,8 @@ package com.zhyc.module.produce.breed.mapper; import java.util.List; import java.util.Map; + +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import com.zhyc.module.produce.breed.domain.ScBreedPlanGenerate; import com.zhyc.module.produce.breed.domain.ScBreedPlan; @@ -12,6 +14,7 @@ import com.zhyc.module.produce.breed.domain.ScBreedPlan; * @author ruoyi * @date 2025-07-16 */ +@Mapper public interface ScBreedPlanGenerateMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScBreedPlanMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScBreedPlanMapper.java index f2a9c66..9699efb 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScBreedPlanMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScBreedPlanMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.produce.breed.mapper; import java.util.List; import com.zhyc.module.produce.breed.domain.ScBreedPlan; +import org.apache.ibatis.annotations.Mapper; /** * 配种计划Mapper接口 @@ -9,6 +10,7 @@ import com.zhyc.module.produce.breed.domain.ScBreedPlan; * @author ruoyi * @date 2025-07-16 */ +@Mapper public interface ScBreedPlanMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScBreedRecordMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScBreedRecordMapper.java new file mode 100644 index 0000000..ee67b34 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScBreedRecordMapper.java @@ -0,0 +1,94 @@ +package com.zhyc.module.produce.breed.mapper; + +import java.util.List; +import java.util.Map; +import com.zhyc.module.produce.breed.domain.ScBreedRecord; + +/** + * 配种记录Mapper接口 + * + * @author ruoyi + * @date 2025-07-23 + */ +public interface ScBreedRecordMapper +{ + /** + * 查询配种记录 + * + * @param id 配种记录主键 + * @return 配种记录 + */ + public ScBreedRecord selectScBreedRecordById(Long id); + + /** + * 查询配种记录列表 + * + * @param scBreedRecord 配种记录 + * @return 配种记录集合 + */ + public List selectScBreedRecordList(ScBreedRecord scBreedRecord); + + /** + * 新增配种记录 + * + * @param scBreedRecord 配种记录 + * @return 结果 + */ + public int insertScBreedRecord(ScBreedRecord scBreedRecord); + + /** + * 修改配种记录 + * + * @param scBreedRecord 配种记录 + * @return 结果 + */ + public int updateScBreedRecord(ScBreedRecord scBreedRecord); + + /** + * 删除配种记录 + * + * @param id 配种记录主键 + * @return 结果 + */ + public int deleteScBreedRecordById(Long id); + + /** + * 批量删除配种记录 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteScBreedRecordByIds(Long[] ids); + + /** + * 根据耳号查询羊只ID + * + * @param manageTags 管理耳号 + * @return 羊只ID + */ + public Long getSheepIdByManageTags(String manageTags); + + /** + * 根据公羊耳号查询羊只ID + * + * @param manageTags 管理耳号 + * @return 羊只ID + */ + public Long getRamIdByManageTags(String manageTags); + + /** + * 根据耳号查询羊只详细信息 + * + * @param manageTags 管理耳号 + * @return 羊只信息 + */ + public Map getSheepInfoByTags(String manageTags); + + /** + * 根据母羊耳号获取配种计划信息 + * + * @param manageTags 母羊管理耳号 + * @return 配种计划信息 + */ + public Map getBreedPlanByEweTags(String manageTags); +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScDryMilkMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScDryMilkMapper.java index daba529..742dbe7 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScDryMilkMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScDryMilkMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.produce.breed.mapper; import java.util.List; import com.zhyc.module.produce.breed.domain.ScDryMilk; +import org.apache.ibatis.annotations.Mapper; /** * 干奶记录Mapper接口 @@ -9,6 +10,7 @@ import com.zhyc.module.produce.breed.domain.ScDryMilk; * @author ruoyi * @date 2025-07-15 */ +@Mapper public interface ScDryMilkMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScLambingRecordMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScLambingRecordMapper.java index 7719104..85edef3 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScLambingRecordMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScLambingRecordMapper.java @@ -3,6 +3,7 @@ package com.zhyc.module.produce.breed.mapper; import java.util.List; import com.zhyc.module.produce.breed.domain.ScLambingRecord; import com.zhyc.module.produce.breed.domain.ScLambDetail; +import org.apache.ibatis.annotations.Mapper; /** * 产羔记录Mapper接口 @@ -10,6 +11,7 @@ import com.zhyc.module.produce.breed.domain.ScLambDetail; * @author ruoyi * @date 2025-07-11 */ +@Mapper public interface ScLambingRecordMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScPregnancyRecordMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScPregnancyRecordMapper.java index c0562e1..4962992 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScPregnancyRecordMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScPregnancyRecordMapper.java @@ -1,20 +1,20 @@ package com.zhyc.module.produce.breed.mapper; import java.util.List; - +import java.util.Map; import com.zhyc.module.produce.breed.domain.ScPregnancyRecord; /** * 孕检记录Mapper接口 - * - * @author ruoyi - * @date 2025-07-17 + * + * @author zhyc + * @date 2025-01-21 */ -public interface ScPregnancyRecordMapper +public interface ScPregnancyRecordMapper { /** * 查询孕检记录 - * + * * @param id 孕检记录主键 * @return 孕检记录 */ @@ -22,7 +22,7 @@ public interface ScPregnancyRecordMapper /** * 查询孕检记录列表 - * + * * @param scPregnancyRecord 孕检记录 * @return 孕检记录集合 */ @@ -30,7 +30,7 @@ public interface ScPregnancyRecordMapper /** * 新增孕检记录 - * + * * @param scPregnancyRecord 孕检记录 * @return 结果 */ @@ -38,7 +38,7 @@ public interface ScPregnancyRecordMapper /** * 修改孕检记录 - * + * * @param scPregnancyRecord 孕检记录 * @return 结果 */ @@ -46,7 +46,7 @@ public interface ScPregnancyRecordMapper /** * 删除孕检记录 - * + * * @param id 孕检记录主键 * @return 结果 */ @@ -54,9 +54,25 @@ public interface ScPregnancyRecordMapper /** * 批量删除孕检记录 - * + * * @param ids 需要删除的数据主键集合 * @return 结果 */ public int deleteScPregnancyRecordByIds(Long[] ids); -} + + /** + * 根据耳号查询羊只信息 + * + * @param manageTags 耳号 + * @return 羊只信息 + */ + public Map selectSheepByManageTags(String manageTags); + + /** + * 更新羊只基础表中的孕检相关字段 + * + * @param params 更新参数 + * @return 结果 + */ + public int updateSheepPregnancyInfo(Map params); +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScWeanRecordMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScWeanRecordMapper.java index 599621f..cb74588 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScWeanRecordMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScWeanRecordMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.produce.breed.mapper; import java.util.List; import com.zhyc.module.produce.breed.domain.ScWeanRecord; +import org.apache.ibatis.annotations.Mapper; /** * 断奶记录Mapper接口 @@ -9,6 +10,7 @@ import com.zhyc.module.produce.breed.domain.ScWeanRecord; * @author zhyc * @date 2024-01-01 */ +@Mapper public interface ScWeanRecordMapper { /** * 查询断奶记录 diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/IRawSpermRecordService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/IRawSpermRecordService.java new file mode 100644 index 0000000..a9b29f2 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/IRawSpermRecordService.java @@ -0,0 +1,69 @@ +package com.zhyc.module.produce.breed.service; + +import java.util.List; +import com.zhyc.module.produce.breed.domain.RawSpermRecord; + +/** + * 采精记录Service接口 + * + * @author ruoyi + * @date 2025-07-23 + */ +public interface IRawSpermRecordService +{ + /** + * 查询采精记录 + * + * @param id 采精记录主键 + * @return 采精记录 + */ + public RawSpermRecord selectRawSpermRecordById(Long id); + + /** + * 查询采精记录列表 + * + * @param rawSpermRecord 采精记录 + * @return 采精记录集合 + */ + public List selectRawSpermRecordList(RawSpermRecord rawSpermRecord); + + /** + * 新增采精记录 + * + * @param rawSpermRecord 采精记录 + * @return 结果 + */ + public int insertRawSpermRecord(RawSpermRecord rawSpermRecord); + + /** + * 修改采精记录 + * + * @param rawSpermRecord 采精记录 + * @return 结果 + */ + public int updateRawSpermRecord(RawSpermRecord rawSpermRecord); + + /** + * 批量删除采精记录 + * + * @param ids 需要删除的采精记录主键集合 + * @return 结果 + */ + public int deleteRawSpermRecordByIds(Long[] ids); + + /** + * 删除采精记录信息 + * + * @param id 采精记录主键 + * @return 结果 + */ + public int deleteRawSpermRecordById(Long id); + + /** + * 根据耳号查询羊只ID + * + * @param manageTags 耳号 + * @return 羊只ID + */ + public Long getSheepIdByManageTags(String manageTags); +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/IScBreedRecordService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/IScBreedRecordService.java new file mode 100644 index 0000000..7f71704 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/IScBreedRecordService.java @@ -0,0 +1,94 @@ +package com.zhyc.module.produce.breed.service; + +import java.util.List; +import java.util.Map; +import com.zhyc.module.produce.breed.domain.ScBreedRecord; + +/** + * 配种记录Service接口 + * + * @author ruoyi + * @date 2025-07-23 + */ +public interface IScBreedRecordService +{ + /** + * 查询配种记录 + * + * @param id 配种记录主键 + * @return 配种记录 + */ + public ScBreedRecord selectScBreedRecordById(Long id); + + /** + * 查询配种记录列表 + * + * @param scBreedRecord 配种记录 + * @return 配种记录集合 + */ + public List selectScBreedRecordList(ScBreedRecord scBreedRecord); + + /** + * 新增配种记录 + * + * @param scBreedRecord 配种记录 + * @return 结果 + */ + public int insertScBreedRecord(ScBreedRecord scBreedRecord); + + /** + * 修改配种记录 + * + * @param scBreedRecord 配种记录 + * @return 结果 + */ + public int updateScBreedRecord(ScBreedRecord scBreedRecord); + + /** + * 批量删除配种记录 + * + * @param ids 需要删除的配种记录主键集合 + * @return 结果 + */ + public int deleteScBreedRecordByIds(Long[] ids); + + /** + * 删除配种记录信息 + * + * @param id 配种记录主键 + * @return 结果 + */ + public int deleteScBreedRecordById(Long id); + + /** + * 根据耳号查询羊只ID + * + * @param manageTags 管理耳号 + * @return 羊只ID + */ + public Long getSheepIdByTags(String manageTags); + + /** + * 根据公羊耳号查询羊只ID + * + * @param manageTags 管理耳号 + * @return 羊只ID + */ + public Long getRamIdByTags(String manageTags); + + /** + * 根据耳号查询羊只详细信息 + * + * @param manageTags 管理耳号 + * @return 羊只信息 + */ + public Map getSheepInfoByTags(String manageTags); + + /** + * 根据母羊耳号获取配种计划信息 + * + * @param manageTags 母羊管理耳号 + * @return 配种计划信息 + */ + public Map getBreedPlanByEweTags(String manageTags); +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/IScPregnancyRecordService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/IScPregnancyRecordService.java index cb34288..bc0d2e4 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/IScPregnancyRecordService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/IScPregnancyRecordService.java @@ -1,21 +1,20 @@ package com.zhyc.module.produce.breed.service; import java.util.List; - +import java.util.Map; import com.zhyc.module.produce.breed.domain.ScPregnancyRecord; - /** * 孕检记录Service接口 - * - * @author ruoyi - * @date 2025-07-17 + * + * @author zhyc + * @date 2025-01-21 */ -public interface IScPregnancyRecordService +public interface IScPregnancyRecordService { /** * 查询孕检记录 - * + * * @param id 孕检记录主键 * @return 孕检记录 */ @@ -23,7 +22,7 @@ public interface IScPregnancyRecordService /** * 查询孕检记录列表 - * + * * @param scPregnancyRecord 孕检记录 * @return 孕检记录集合 */ @@ -31,7 +30,7 @@ public interface IScPregnancyRecordService /** * 新增孕检记录 - * + * * @param scPregnancyRecord 孕检记录 * @return 结果 */ @@ -39,7 +38,7 @@ public interface IScPregnancyRecordService /** * 修改孕检记录 - * + * * @param scPregnancyRecord 孕检记录 * @return 结果 */ @@ -47,7 +46,7 @@ public interface IScPregnancyRecordService /** * 批量删除孕检记录 - * + * * @param ids 需要删除的孕检记录主键集合 * @return 结果 */ @@ -55,9 +54,17 @@ public interface IScPregnancyRecordService /** * 删除孕检记录信息 - * + * * @param id 孕检记录主键 * @return 结果 */ public int deleteScPregnancyRecordById(Long id); -} + + /** + * 根据耳号查询羊只信息 + * + * @param manageTags 耳号 + * @return 羊只信息 + */ + public Map getSheepByManageTags(String manageTags); +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/impl/RawSpermRecordServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/impl/RawSpermRecordServiceImpl.java new file mode 100644 index 0000000..f925b77 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/impl/RawSpermRecordServiceImpl.java @@ -0,0 +1,120 @@ +package com.zhyc.module.produce.breed.service.impl; + +import java.util.List; +import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.produce.breed.mapper.RawSpermRecordMapper; +import com.zhyc.module.produce.breed.domain.RawSpermRecord; +import com.zhyc.module.produce.breed.service.IRawSpermRecordService; + +/** + * 采精记录Service业务层处理 + * + * @author ruoyi + * @date 2025-07-23 + */ +@Service +public class RawSpermRecordServiceImpl implements IRawSpermRecordService +{ + @Autowired + private RawSpermRecordMapper rawSpermRecordMapper; + + /** + * 查询采精记录 + * + * @param id 采精记录主键 + * @return 采精记录 + */ + @Override + public RawSpermRecord selectRawSpermRecordById(Long id) + { + return rawSpermRecordMapper.selectRawSpermRecordById(id); + } + + /** + * 查询采精记录列表 + * + * @param rawSpermRecord 采精记录 + * @return 采精记录 + */ + @Override + public List selectRawSpermRecordList(RawSpermRecord rawSpermRecord) + { + return rawSpermRecordMapper.selectRawSpermRecordList(rawSpermRecord); + } + + /** + * 新增采精记录 + * + * @param rawSpermRecord 采精记录 + * @return 结果 + */ + @Override + public int insertRawSpermRecord(RawSpermRecord rawSpermRecord) + { + // 如果传入的是耳号,需要先根据耳号查询羊只ID + if (StringUtils.isNotEmpty(rawSpermRecord.getManageTags()) && rawSpermRecord.getSheepId() == null) { + Long sheepId = getSheepIdByManageTags(rawSpermRecord.getManageTags()); + rawSpermRecord.setSheepId(sheepId); + } + + rawSpermRecord.setCreateTime(DateUtils.getNowDate()); + return rawSpermRecordMapper.insertRawSpermRecord(rawSpermRecord); + } + + /** + * 修改采精记录 + * + * @param rawSpermRecord 采精记录 + * @return 结果 + */ + @Override + public int updateRawSpermRecord(RawSpermRecord rawSpermRecord) + { + // 如果传入的是耳号,需要先根据耳号查询羊只ID + if (StringUtils.isNotEmpty(rawSpermRecord.getManageTags()) && rawSpermRecord.getSheepId() == null) { + Long sheepId = getSheepIdByManageTags(rawSpermRecord.getManageTags()); + rawSpermRecord.setSheepId(sheepId); + } + + return rawSpermRecordMapper.updateRawSpermRecord(rawSpermRecord); + } + + /** + * 批量删除采精记录 + * + * @param ids 需要删除的采精记录主键 + * @return 结果 + */ + @Override + public int deleteRawSpermRecordByIds(Long[] ids) + { + return rawSpermRecordMapper.deleteRawSpermRecordByIds(ids); + } + + /** + * 删除采精记录信息 + * + * @param id 采精记录主键 + * @return 结果 + */ + @Override + public int deleteRawSpermRecordById(Long id) + { + return rawSpermRecordMapper.deleteRawSpermRecordById(id); + } + + /** + * 根据耳号查询羊只ID + * + * @param manageTags 耳号 + * @return 羊只ID + */ + @Override + public Long getSheepIdByManageTags(String manageTags) + { + return rawSpermRecordMapper.selectSheepIdByManageTags(manageTags); + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/impl/ScBreedRecordServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/impl/ScBreedRecordServiceImpl.java new file mode 100644 index 0000000..61ab012 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/impl/ScBreedRecordServiceImpl.java @@ -0,0 +1,164 @@ +package com.zhyc.module.produce.breed.service.impl; + +import java.util.List; +import java.util.Map; +import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.produce.breed.mapper.ScBreedRecordMapper; +import com.zhyc.module.produce.breed.domain.ScBreedRecord; +import com.zhyc.module.produce.breed.service.IScBreedRecordService; + +/** + * 配种记录Service业务层处理 + * + * @author ruoyi + * @date 2025-07-23 + */ +@Service +public class ScBreedRecordServiceImpl implements IScBreedRecordService +{ + @Autowired + private ScBreedRecordMapper scBreedRecordMapper; + + /** + * 查询配种记录 + * + * @param id 配种记录主键 + * @return 配种记录 + */ + @Override + public ScBreedRecord selectScBreedRecordById(Long id) + { + return scBreedRecordMapper.selectScBreedRecordById(id); + } + + /** + * 查询配种记录列表 + * + * @param scBreedRecord 配种记录 + * @return 配种记录 + */ + @Override + public List selectScBreedRecordList(ScBreedRecord scBreedRecord) + { + // 如果查询条件中有耳号,需要先转换为ID + if (StringUtils.isNotEmpty(scBreedRecord.getEweManageTags())) + { + Long eweId = scBreedRecordMapper.getSheepIdByManageTags(scBreedRecord.getEweManageTags()); + if (eweId != null) + { + scBreedRecord.setEweId(eweId.toString()); + } + } + + if (StringUtils.isNotEmpty(scBreedRecord.getRamManageTags())) + { + Long ramId = scBreedRecordMapper.getRamIdByManageTags(scBreedRecord.getRamManageTags()); + if (ramId != null) + { + scBreedRecord.setRamId(ramId.toString()); + } + } + + return scBreedRecordMapper.selectScBreedRecordList(scBreedRecord); + } + + /** + * 新增配种记录 + * + * @param scBreedRecord 配种记录 + * @return 结果 + */ + @Override + public int insertScBreedRecord(ScBreedRecord scBreedRecord) + { + scBreedRecord.setCreateTime(DateUtils.getNowDate()); + return scBreedRecordMapper.insertScBreedRecord(scBreedRecord); + } + + /** + * 修改配种记录 + * + * @param scBreedRecord 配种记录 + * @return 结果 + */ + @Override + public int updateScBreedRecord(ScBreedRecord scBreedRecord) + { + return scBreedRecordMapper.updateScBreedRecord(scBreedRecord); + } + + /** + * 批量删除配种记录 + * + * @param ids 需要删除的配种记录主键 + * @return 结果 + */ + @Override + public int deleteScBreedRecordByIds(Long[] ids) + { + return scBreedRecordMapper.deleteScBreedRecordByIds(ids); + } + + /** + * 删除配种记录信息 + * + * @param id 配种记录主键 + * @return 结果 + */ + @Override + public int deleteScBreedRecordById(Long id) + { + return scBreedRecordMapper.deleteScBreedRecordById(id); + } + + /** + * 根据耳号查询羊只ID + * + * @param manageTags 管理耳号 + * @return 羊只ID + */ + @Override + public Long getSheepIdByTags(String manageTags) + { + return scBreedRecordMapper.getSheepIdByManageTags(manageTags); + } + + /** + * 根据公羊耳号查询羊只ID + * + * @param manageTags 管理耳号 + * @return 羊只ID + */ + @Override + public Long getRamIdByTags(String manageTags) + { + return scBreedRecordMapper.getRamIdByManageTags(manageTags); + } + + /** + * 根据耳号查询羊只详细信息 + * + * @param manageTags 管理耳号 + * @return 羊只信息 + */ + @Override + public Map getSheepInfoByTags(String manageTags) + { + return scBreedRecordMapper.getSheepInfoByTags(manageTags); + } + + /** + * 根据母羊耳号获取配种计划信息 + * + * @param manageTags 母羊管理耳号 + * @return 配种计划信息 + */ + @Override + public Map getBreedPlanByEweTags(String manageTags) + { + return scBreedRecordMapper.getBreedPlanByEweTags(manageTags); + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/impl/ScPregnancyRecordServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/impl/ScPregnancyRecordServiceImpl.java index 7f50d65..dde2c3d 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/impl/ScPregnancyRecordServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/impl/ScPregnancyRecordServiceImpl.java @@ -1,19 +1,24 @@ package com.zhyc.module.produce.breed.service.impl; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Date; +import java.util.Calendar; + import com.zhyc.common.utils.DateUtils; -import com.zhyc.module.produce.breed.domain.ScPregnancyRecord; -import com.zhyc.module.produce.breed.mapper.ScPregnancyRecordMapper; -import com.zhyc.module.produce.breed.service.IScPregnancyRecordService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - +import org.springframework.transaction.annotation.Transactional; +import com.zhyc.module.produce.breed.mapper.ScPregnancyRecordMapper; +import com.zhyc.module.produce.breed.domain.ScPregnancyRecord; +import com.zhyc.module.produce.breed.service.IScPregnancyRecordService; /** * 孕检记录Service业务层处理 - * - * @author ruoyi - * @date 2025-07-17 + * + * @author zhyc + * @date 2025-01-21 */ @Service public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService @@ -23,7 +28,7 @@ public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService /** * 查询孕检记录 - * + * * @param id 孕检记录主键 * @return 孕检记录 */ @@ -35,7 +40,7 @@ public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService /** * 查询孕检记录列表 - * + * * @param scPregnancyRecord 孕检记录 * @return 孕检记录 */ @@ -47,32 +52,68 @@ public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService /** * 新增孕检记录 - * + * * @param scPregnancyRecord 孕检记录 * @return 结果 */ @Override + @Transactional public int insertScPregnancyRecord(ScPregnancyRecord scPregnancyRecord) { scPregnancyRecord.setCreateTime(DateUtils.getNowDate()); - return scPregnancyRecordMapper.insertScPregnancyRecord(scPregnancyRecord); + scPregnancyRecord.setIsDelete(0); + + // 根据耳号获取羊只ID + if (scPregnancyRecord.getManageTags() != null) { + Map sheepInfo = scPregnancyRecordMapper.selectSheepByManageTags(scPregnancyRecord.getManageTags()); + if (sheepInfo != null && sheepInfo.get("id") != null) { + scPregnancyRecord.setSheepId(Long.valueOf(sheepInfo.get("id").toString())); + } + } + + int result = scPregnancyRecordMapper.insertScPregnancyRecord(scPregnancyRecord); + + // 如果孕检结果为怀孕,更新羊只基础表相关字段 + if ("怀孕".equals(scPregnancyRecord.getResult()) && scPregnancyRecord.getSheepId() != null) { + updateSheepPregnancyStatus(scPregnancyRecord); + } + + return result; } /** * 修改孕检记录 - * + * * @param scPregnancyRecord 孕检记录 * @return 结果 */ @Override + @Transactional public int updateScPregnancyRecord(ScPregnancyRecord scPregnancyRecord) { - return scPregnancyRecordMapper.updateScPregnancyRecord(scPregnancyRecord); + scPregnancyRecord.setUpdateTime(DateUtils.getNowDate()); + + // 根据耳号获取羊只ID + if (scPregnancyRecord.getManageTags() != null) { + Map sheepInfo = scPregnancyRecordMapper.selectSheepByManageTags(scPregnancyRecord.getManageTags()); + if (sheepInfo != null && sheepInfo.get("id") != null) { + scPregnancyRecord.setSheepId(Long.valueOf(sheepInfo.get("id").toString())); + } + } + + int result = scPregnancyRecordMapper.updateScPregnancyRecord(scPregnancyRecord); + + // 如果孕检结果为怀孕,更新羊只基础表相关字段 + if ("怀孕".equals(scPregnancyRecord.getResult()) && scPregnancyRecord.getSheepId() != null) { + updateSheepPregnancyStatus(scPregnancyRecord); + } + + return result; } /** * 批量删除孕检记录 - * + * * @param ids 需要删除的孕检记录主键 * @return 结果 */ @@ -84,7 +125,7 @@ public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService /** * 删除孕检记录信息 - * + * * @param id 孕检记录主键 * @return 结果 */ @@ -93,4 +134,46 @@ public class ScPregnancyRecordServiceImpl implements IScPregnancyRecordService { return scPregnancyRecordMapper.deleteScPregnancyRecordById(id); } -} + + /** + * 根据耳号查询羊只信息 + * + * @param manageTags 耳号 + * @return 羊只信息 + */ + @Override + public Map getSheepByManageTags(String manageTags) + { + return scPregnancyRecordMapper.selectSheepByManageTags(manageTags); + } + + /** + * 更新羊只怀孕状态 + * + * @param scPregnancyRecord 孕检记录 + */ + private void updateSheepPregnancyStatus(ScPregnancyRecord scPregnancyRecord) { + Map params = new HashMap<>(); + params.put("sheepId", scPregnancyRecord.getSheepId()); + params.put("pregDate", scPregnancyRecord.getDatetime()); + + // 设置繁育状态为怀孕状态(假设怀孕状态ID为2) + params.put("breedStatusId", 2); + + // 计算预产日期(羊的妊娠期大约150天) + if (scPregnancyRecord.getDatetime() != null) { + Calendar cal = Calendar.getInstance(); + cal.setTime(scPregnancyRecord.getDatetime()); + cal.add(Calendar.DAY_OF_YEAR, 150); + params.put("expectedDate", cal.getTime()); + } + + // 计算怀孕天数 + if (scPregnancyRecord.getDatetime() != null) { + long days = (System.currentTimeMillis() - scPregnancyRecord.getDatetime().getTime()) / (1000 * 60 * 60 * 24); + params.put("gestationDay", (int) days); + } + + scPregnancyRecordMapper.updateSheepPregnancyInfo(params); + } +} \ No newline at end of file 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 33d8118..6d2f7f9 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,6 +5,8 @@ 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.BasSheepVariety; +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; import com.zhyc.module.base.domain.DaSheepfold; @@ -32,7 +34,8 @@ public class ScAddSheepController { private IScAddSheepService scAddSheepService; @Autowired private IDaSheepfoldService daSheepfoldMapper; - + @Autowired + private IBasSheepVarietyService basSheepVarietyMapper; //新增羊只验证 @PreAuthorize("@ss.hasPermi('produce:add_sheep:add')") @Log(title = "新增", businessType = BusinessType.INSERT) @@ -70,13 +73,14 @@ public class ScAddSheepController { } - @PostMapping("/exportForm") + //导出 @Log(title = "羊只信息", businessType = BusinessType.EXPORT) + @PostMapping("/exportForm") 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) { @@ -84,10 +88,16 @@ public class ScAddSheepController { } } + if (scAddSheep.getVarietyId() != null) { + BasSheepVariety variety = basSheepVarietyMapper.selectBasSheepVarietyById(scAddSheep.getVarietyId().longValue()); + if (variety != null) { + scAddSheep.setVarietyName(variety.getVariety()); + } + } + 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/controller/ScChangeCommentController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScChangeCommentController.java new file mode 100644 index 0000000..756e4a5 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScChangeCommentController.java @@ -0,0 +1,104 @@ +package com.zhyc.module.produce.manage_sheep.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.zhyc.common.annotation.Log; +import com.zhyc.common.core.controller.BaseController; +import com.zhyc.common.core.domain.AjaxResult; +import com.zhyc.common.enums.BusinessType; +import com.zhyc.module.produce.manage_sheep.domain.ScChangeComment; +import com.zhyc.module.produce.manage_sheep.service.IScChangeCommentService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 改备注Controller + * + * @author ruoyi + * @date 2025-07-24 + */ +@RestController +@RequestMapping("/changeComment/changeComment") +public class ScChangeCommentController extends BaseController +{ + @Autowired + private IScChangeCommentService scChangeCommentService; + + /** + * 查询改备注列表 + */ + @PreAuthorize("@ss.hasPermi('changeComment:changeComment:list')") + @GetMapping("/list") + public TableDataInfo list(ScChangeComment scChangeComment) + { + startPage(); + List list = scChangeCommentService.selectScChangeCommentList(scChangeComment); + return getDataTable(list); + } + + /** + * 导出改备注列表 + */ + @PreAuthorize("@ss.hasPermi('changeComment:changeComment:export')") + @Log(title = "改备注", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ScChangeComment scChangeComment) + { + List list = scChangeCommentService.selectScChangeCommentList(scChangeComment); + ExcelUtil util = new ExcelUtil(ScChangeComment.class); + util.exportExcel(response, list, "改备注数据"); + } + + /** + * 获取改备注详细信息 + */ + @PreAuthorize("@ss.hasPermi('changeComment:changeComment:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(scChangeCommentService.selectScChangeCommentById(id)); + } + + /** + * 新增改备注 + */ + @PreAuthorize("@ss.hasPermi('changeComment:changeComment:add')") + @Log(title = "改备注", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ScChangeComment scChangeComment) + { + return toAjax(scChangeCommentService.insertScChangeComment(scChangeComment)); + } + + /** + * 修改改备注 + */ + @PreAuthorize("@ss.hasPermi('changeComment:changeComment:edit')") + @Log(title = "改备注", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ScChangeComment scChangeComment) + { + return toAjax(scChangeCommentService.updateScChangeComment(scChangeComment)); + } + + /** + * 删除改备注 + */ + @PreAuthorize("@ss.hasPermi('changeComment:changeComment:remove')") + @Log(title = "改备注", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(scChangeCommentService.deleteScChangeCommentByIds(ids)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScChangeEarController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScChangeEarController.java new file mode 100644 index 0000000..cd6b28b --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScChangeEarController.java @@ -0,0 +1,119 @@ +package com.zhyc.module.produce.manage_sheep.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.zhyc.module.base.domain.BasSheep; +import com.zhyc.module.base.service.IBasSheepService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.zhyc.common.annotation.Log; +import com.zhyc.common.core.controller.BaseController; +import com.zhyc.common.core.domain.AjaxResult; +import com.zhyc.common.enums.BusinessType; +import com.zhyc.module.produce.manage_sheep.domain.ScChangeEar; +import com.zhyc.module.produce.manage_sheep.service.IScChangeEarService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 修改电子耳号记录Controller + * + * @author ruoyi + * @date 2025-07-24 + */ +@RestController +@RequestMapping("/changeEar/changeEar") +public class ScChangeEarController extends BaseController +{ + @Autowired + private IScChangeEarService scChangeEarService; + + @Autowired + private IBasSheepService basSheepService; + /** + * 查询修改电子耳号记录列表 + */ + @PreAuthorize("@ss.hasPermi('changeEar:changeEar:list')") + @GetMapping("/list") + public TableDataInfo list(ScChangeEar scChangeEar) + { + startPage(); + List list = scChangeEarService.selectScChangeEarList(scChangeEar); + return getDataTable(list); + } + + /** + * 导出修改电子耳号记录列表 + */ + @PreAuthorize("@ss.hasPermi('changeEar:changeEar:export')") + @Log(title = "修改电子耳号记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ScChangeEar scChangeEar) + { + List list = scChangeEarService.selectScChangeEarList(scChangeEar); + ExcelUtil util = new ExcelUtil(ScChangeEar.class); + util.exportExcel(response, list, "修改电子耳号记录数据"); + } + + /** + * 获取修改电子耳号记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('changeEar:changeEar:query')") + @GetMapping("/{id}") + public AjaxResult getInfo(@PathVariable("id") Integer id) { + ScChangeEar changeEar = scChangeEarService.selectScChangeEarById(id); + // 关联查询羊只表,获取旧耳号 + BasSheep sheep = basSheepService.selectBasSheepById(changeEar.getSheepId()); + if (sheep != null) { + // 根据耳号类型,设置旧耳号 + if (changeEar.getEarType() == 0) { + changeEar.setOldTag(sheep.getElectronicTags()); + } else { + changeEar.setOldTag(sheep.getManageTags()); + } + } + return success(changeEar); + } + + /** + * 新增修改电子耳号记录 + */ + @PreAuthorize("@ss.hasPermi('changeEar:changeEar:add')") + @Log(title = "修改电子耳号记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ScChangeEar scChangeEar) + { + return toAjax(scChangeEarService.insertScChangeEar(scChangeEar)); + } + + /** + * 修改修改电子耳号记录 + */ + @PreAuthorize("@ss.hasPermi('changeEar:changeEar:edit')") + @Log(title = "修改电子耳号记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ScChangeEar scChangeEar) + { + return toAjax(scChangeEarService.updateScChangeEar(scChangeEar)); + } + + /** + * 删除修改电子耳号记录 + */ + @PreAuthorize("@ss.hasPermi('changeEar:changeEar:remove')") + @Log(title = "修改电子耳号记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Integer[] ids) + { + return toAjax(scChangeEarService.deleteScChangeEarByIds(ids)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScChangeVarietyController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScChangeVarietyController.java new file mode 100644 index 0000000..fd5b092 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScChangeVarietyController.java @@ -0,0 +1,104 @@ +package com.zhyc.module.produce.manage_sheep.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.zhyc.common.annotation.Log; +import com.zhyc.common.core.controller.BaseController; +import com.zhyc.common.core.domain.AjaxResult; +import com.zhyc.common.enums.BusinessType; +import com.zhyc.module.produce.manage_sheep.domain.ScChangeVariety; +import com.zhyc.module.produce.manage_sheep.service.IScChangeVarietyService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 改品种记录Controller + * + * @author ruoyi + * @date 2025-07-24 + */ +@RestController +@RequestMapping("/changeVariety/changeVariety") +public class ScChangeVarietyController extends BaseController +{ + @Autowired + private IScChangeVarietyService scChangeVarietyService; + + /** + * 查询改品种记录列表 + */ + @PreAuthorize("@ss.hasPermi('changeVariety:changeVariety:list')") + @GetMapping("/list") + public TableDataInfo list(ScChangeVariety scChangeVariety) + { + startPage(); + List list = scChangeVarietyService.selectScChangeVarietyList(scChangeVariety); + return getDataTable(list); + } + + /** + * 导出改品种记录列表 + */ + @PreAuthorize("@ss.hasPermi('changeVariety:changeVariety:export')") + @Log(title = "改品种记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ScChangeVariety scChangeVariety) + { + List list = scChangeVarietyService.selectScChangeVarietyList(scChangeVariety); + ExcelUtil util = new ExcelUtil(ScChangeVariety.class); + util.exportExcel(response, list, "改品种记录数据"); + } + + /** + * 获取改品种记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('changeVariety:changeVariety:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Integer id) + { + return success(scChangeVarietyService.selectScChangeVarietyById(id)); + } + + /** + * 新增改品种记录 + */ + @PreAuthorize("@ss.hasPermi('changeVariety:changeVariety:add')") + @Log(title = "改品种记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ScChangeVariety scChangeVariety) + { + return toAjax(scChangeVarietyService.insertScChangeVariety(scChangeVariety)); + } + + /** + * 修改改品种记录 + */ + @PreAuthorize("@ss.hasPermi('changeVariety:changeVariety:edit')") + @Log(title = "改品种记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ScChangeVariety scChangeVariety) + { + return toAjax(scChangeVarietyService.updateScChangeVariety(scChangeVariety)); + } + + /** + * 删除改品种记录 + */ + @PreAuthorize("@ss.hasPermi('changeVariety:changeVariety:remove')") + @Log(title = "改品种记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Integer[] ids) + { + return toAjax(scChangeVarietyService.deleteScChangeVarietyByIds(ids)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScTransGroupController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScTransGroupController.java index 1b5069f..9fe5a2f 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScTransGroupController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/controller/ScTransGroupController.java @@ -96,4 +96,13 @@ public class ScTransGroupController extends BaseController { public AjaxResult remove(@PathVariable Integer[] ids) { return toAjax(scTransGroupService.deleteScTransGroupByIds(ids)); } + + + /** + * 审批转群记录 + */ + @PutMapping("/approve") + public AjaxResult approve(@RequestBody ScTransGroup scTransGroup) { + return toAjax(scTransGroupService.approveScTransGroup(scTransGroup)); + } } 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 2697a7a..f41c044 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 @@ -2,6 +2,7 @@ package com.zhyc.module.produce.manage_sheep.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -23,14 +24,13 @@ import com.zhyc.common.core.page.TableDataInfo; /** * 转场Controller - * + * * @author ruoyi * @date 2025-07-10 */ @RestController @RequestMapping("produce/manage_sheep/transition_info") -public class ScTransitionInfoController extends BaseController -{ +public class ScTransitionInfoController extends BaseController { @Autowired private IScTransitionInfoService scTransitionInfoService; @@ -39,8 +39,7 @@ public class ScTransitionInfoController extends BaseController */ @PreAuthorize("@ss.hasPermi('produce:transition_info:list')") @GetMapping("/list") - public TableDataInfo list(ScTransitionInfo scTransitionInfo) - { + public TableDataInfo list(ScTransitionInfo scTransitionInfo) { startPage(); List list = scTransitionInfoService.selectScTransitionInfoList(scTransitionInfo); return getDataTable(list); @@ -52,10 +51,13 @@ public class ScTransitionInfoController extends BaseController @PreAuthorize("@ss.hasPermi('produce:transition_info:export')") @Log(title = "转场", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, ScTransitionInfo scTransitionInfo) - { + public void export(HttpServletResponse response, ScTransitionInfo scTransitionInfo) { List list = scTransitionInfoService.selectScTransitionInfoList(scTransitionInfo); - ExcelUtil util = new ExcelUtil(ScTransitionInfo.class); + for (ScTransitionInfo item : list) { + item.setStatusText(scTransitionInfoService.convertStatus(item.getStatus())); + item.setTransTypeText(scTransitionInfoService.convertTransType(item.getTransType())); + } + ExcelUtil util = new ExcelUtil<>(ScTransitionInfo.class); util.exportExcel(response, list, "转场数据"); } @@ -64,9 +66,10 @@ public class ScTransitionInfoController extends BaseController */ @PreAuthorize("@ss.hasPermi('produce:transition_info:query')") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Integer id) - { - return success(scTransitionInfoService.selectScTransitionInfoById(id)); + public AjaxResult getInfo(@PathVariable("id") Integer id) { + ScTransitionInfo transitionInfo = scTransitionInfoService.selectScTransitionInfoById(id); + transitionInfo.setTransTypeText(scTransitionInfoService.convertTransType(transitionInfo.getTransType())); + return success(transitionInfo); } /** @@ -75,19 +78,23 @@ public class ScTransitionInfoController extends BaseController @PreAuthorize("@ss.hasPermi('produce:transition_info:add')") @Log(title = "转场", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody ScTransitionInfo scTransitionInfo) - { + public AjaxResult add(@RequestBody ScTransitionInfo scTransitionInfo) { return toAjax(scTransitionInfoService.insertScTransitionInfo(scTransitionInfo)); } + //批量添加 + @PostMapping("/batch") + public AjaxResult addBatch(@RequestBody List transitionInfoList) { + return toAjax(scTransitionInfoService.insertScTransitionInfoBatch(transitionInfoList)); + } + /** * 修改转场 */ @PreAuthorize("@ss.hasPermi('produce:transition_info:edit')") @Log(title = "转场", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody ScTransitionInfo scTransitionInfo) - { + public AjaxResult edit(@RequestBody ScTransitionInfo scTransitionInfo) { return toAjax(scTransitionInfoService.updateScTransitionInfo(scTransitionInfo)); } @@ -96,9 +103,14 @@ public class ScTransitionInfoController extends BaseController */ @PreAuthorize("@ss.hasPermi('produce:transition_info:remove')") @Log(title = "转场", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Integer[] ids) - { + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Integer[] ids) { return toAjax(scTransitionInfoService.deleteScTransitionInfoByIds(ids)); } + + @PutMapping("/approve") + public AjaxResult approveScTransitionInfo(@RequestBody ScTransitionInfo scTransitionInfo) { + 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 b493b4e..7bdf7ad 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 @@ -1,5 +1,6 @@ package com.zhyc.module.produce.manage_sheep.domain; +import com.fasterxml.jackson.annotation.JsonFormat; import com.zhyc.common.annotation.Excel; import com.zhyc.common.core.domain.BaseEntity; import lombok.AllArgsConstructor; @@ -21,7 +22,7 @@ public class ScAddSheep extends BaseEntity { */ private static final long serialVersionUID = 1L; @Excel(name = "主键") - private Integer id; // 如果数据库主键叫 id,就加这一行 + private Integer id; /** 羊只耳号 */ @Excel(name = "耳号") private String earNumber; @@ -29,7 +30,6 @@ public class ScAddSheep extends BaseEntity { /** 羊舍编号 */ private Integer sheepfold; -// @Excel(name = "羊舍名称") private String sheepfoldName; // 导出时生成“羊舍名称”列 ,仅 Excel 用,不映射到数据库 @@ -49,11 +49,12 @@ public class ScAddSheep extends BaseEntity { private BigDecimal bornWeight; /** 出生日期 */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @Excel(name = "出生日期", dateFormat = "yyyy-MM-dd") private Date birthday; - /** 性别 1公 0母 2阉羊 3兼性 */ - @Excel(name = "性别", readConverterExp = "1=公,0=母,2=阉羊,3=兼性") + /** 性别 1母 2公 3阉羊 */ + @Excel(name = "性别", readConverterExp = "1=母,2=公,3=阉羊") private Integer gender; /** 胎次 */ @@ -68,6 +69,7 @@ public class ScAddSheep extends BaseEntity { private String varietyName; /** 入群日期 */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @Excel(name = "入群日期", dateFormat = "yyyy-MM-dd") private Date joinDate; @@ -79,7 +81,7 @@ public class ScAddSheep extends BaseEntity { @Excel(name = "技术员") private String technician; - /* 以下字段不导出 */ + private String createBy; private Date createTime; 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 new file mode 100644 index 0000000..2243411 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScChangeComment.java @@ -0,0 +1,47 @@ +package com.zhyc.module.produce.manage_sheep.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; + +/** + * 改备注对象 sc_change_comment + * + * @author ruoyi + * @date 2025-07-24 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ScChangeComment extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * $column.columnComment + */ + private Long id; + + /** + * 羊只id + */ + private String sheepId; + @Excel(name = "管理耳号") + private String manageTags; + /** + * 新备注 + */ + @Excel(name = "新备注") + private String newComment; + + /** + * 原备注 + */ + @Excel(name = "原备注") + private String oldComment; + + +} 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 new file mode 100644 index 0000000..f2ef13f --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScChangeEar.java @@ -0,0 +1,50 @@ +package com.zhyc.module.produce.manage_sheep.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; + +/** + * 修改电子耳号记录对象 sc_change_ear + * + * @author ruoyi + * @date 2025-07-24 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ScChangeEar extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Integer id; + + /** 羊只id */ + private Long sheepId; + + @Excel(name = "管理耳号") + private String manageTags; + + /** 选择更改耳号类型(0电子耳号1管理耳号) */ + @Excel(name = "耳号类型", readConverterExp = "0=电子耳号,1=管理耳号") + private Integer earType; + + /** 新耳号/电子耳号 */ + @Excel(name = "新耳号/电子耳号") + private String newTag; + + /** 旧耳号/电子耳号 */ + @Excel(name = "旧耳号/电子耳号") + private String oldTag; + + /** 备注 */ + @Excel(name = "备注") + private String comment; + + +} 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 new file mode 100644 index 0000000..5f5e8ee --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/domain/ScChangeVariety.java @@ -0,0 +1,52 @@ +package com.zhyc.module.produce.manage_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; + +/** + * 改品种记录对象 sc_change_variety + * + * @author ruoyi + * @date 2025-07-24 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ScChangeVariety extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Integer id; + + /** 羊只id */ + private Integer sheepId; + @Excel(name = "耳号") + private String manageTags; + + /** 原品种 */ + @Excel(name = "原品种") + private String varietyOld; + + /** 新品种 */ + @Excel(name = "新品种") + private String varietyNew; + + /** 备注 */ + @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 da94cbb..ba62557 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 @@ -29,9 +29,10 @@ public class ScTransGroup extends BaseEntity { /** * 羊只id */ - @Excel(name = "羊只id") private Integer sheepId; + @Excel(name = "耳号") + private String manageTags; /** * 转入羊舍 */ @@ -48,12 +49,17 @@ public class ScTransGroup extends BaseEntity { @Excel(name = "转出羊舍") private String foldFromName; + /** + * 羊只类型ID + */ + private Integer sheepTypeId; + // 羊只类型名称 + private String sheepTypeName; /** * 转入羊舍名称 */ @Excel(name = "转入羊舍") private String foldToName; - /** 转群原因 */ /** * 品种id 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 01899f4..554bf4d 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 @@ -21,16 +21,17 @@ public class ScTransitionInfo extends BaseEntity { private static final long serialVersionUID = 1L; /** - * + *主键 */ private Integer id; /** * 羊只id */ - @Excel(name = "羊只id") private Integer sheepId; + @Excel(name = "耳号") + private String manageTags; /** * 品种id */ @@ -74,9 +75,9 @@ public class ScTransitionInfo extends BaseEntity { /** * 状态 */ - @Excel(name = "状态") private Integer status; - + @Excel(name = "状态") + private String statusText; /** * 备注 */ diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScAddSheepMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScAddSheepMapper.java index c6e3b27..8231d04 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScAddSheepMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScAddSheepMapper.java @@ -7,11 +7,19 @@ import java.util.List; @Mapper public interface ScAddSheepMapper { + //新增羊只 int insert(ScAddSheep scAddSheep); + + //查询新增羊只列表 List selectScAddSheepList(ScAddSheep scAddSheep); + + //修改羊只 int updateScAddSheep(ScAddSheep scAddSheep); + + //删除羊只(支持批量) int deleteScAddSheepByIds(Integer[] ids); + //根据耳号查询羊只 ScAddSheep selectByEarNumber(String earNumber); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScChangeCommentMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScChangeCommentMapper.java new file mode 100644 index 0000000..cd71536 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScChangeCommentMapper.java @@ -0,0 +1,61 @@ +package com.zhyc.module.produce.manage_sheep.mapper; + +import java.util.List; +import com.zhyc.module.produce.manage_sheep.domain.ScChangeComment; + +/** + * 改备注Mapper接口 + * + * @author ruoyi + * @date 2025-07-24 + */ +public interface ScChangeCommentMapper +{ + /** + * 查询改备注 + * + * @param id 改备注主键 + * @return 改备注 + */ + public ScChangeComment selectScChangeCommentById(Long id); + + /** + * 查询改备注列表 + * + * @param scChangeComment 改备注 + * @return 改备注集合 + */ + public List selectScChangeCommentList(ScChangeComment scChangeComment); + + /** + * 新增改备注 + * + * @param scChangeComment 改备注 + * @return 结果 + */ + public int insertScChangeComment(ScChangeComment scChangeComment); + + /** + * 修改改备注 + * + * @param scChangeComment 改备注 + * @return 结果 + */ + public int updateScChangeComment(ScChangeComment scChangeComment); + + /** + * 删除改备注 + * + * @param id 改备注主键 + * @return 结果 + */ + public int deleteScChangeCommentById(Long id); + + /** + * 批量删除改备注 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteScChangeCommentByIds(Long[] ids); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScChangeEarMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScChangeEarMapper.java new file mode 100644 index 0000000..5699a46 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScChangeEarMapper.java @@ -0,0 +1,61 @@ +package com.zhyc.module.produce.manage_sheep.mapper; + +import java.util.List; +import com.zhyc.module.produce.manage_sheep.domain.ScChangeEar; + +/** + * 修改电子耳号记录Mapper接口 + * + * @author ruoyi + * @date 2025-07-24 + */ +public interface ScChangeEarMapper +{ + /** + * 查询修改电子耳号记录 + * + * @param id 修改电子耳号记录主键 + * @return 修改电子耳号记录 + */ + public ScChangeEar selectScChangeEarById(Integer id); + + /** + * 查询修改电子耳号记录列表 + * + * @param scChangeEar 修改电子耳号记录 + * @return 修改电子耳号记录集合 + */ + public List selectScChangeEarList(ScChangeEar scChangeEar); + + /** + * 新增修改电子耳号记录 + * + * @param scChangeEar 修改电子耳号记录 + * @return 结果 + */ + public int insertScChangeEar(ScChangeEar scChangeEar); + + /** + * 修改修改电子耳号记录 + * + * @param scChangeEar 修改电子耳号记录 + * @return 结果 + */ + public int updateScChangeEar(ScChangeEar scChangeEar); + + /** + * 删除修改电子耳号记录 + * + * @param id 修改电子耳号记录主键 + * @return 结果 + */ + public int deleteScChangeEarById(Integer id); + + /** + * 批量删除修改电子耳号记录 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteScChangeEarByIds(Integer[] ids); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScChangeVarietyMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScChangeVarietyMapper.java new file mode 100644 index 0000000..12d9075 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScChangeVarietyMapper.java @@ -0,0 +1,61 @@ +package com.zhyc.module.produce.manage_sheep.mapper; + +import java.util.List; +import com.zhyc.module.produce.manage_sheep.domain.ScChangeVariety; + +/** + * 改品种记录Mapper接口 + * + * @author ruoyi + * @date 2025-07-24 + */ +public interface ScChangeVarietyMapper +{ + /** + * 查询改品种记录 + * + * @param id 改品种记录主键 + * @return 改品种记录 + */ + public ScChangeVariety selectScChangeVarietyById(Integer id); + + /** + * 查询改品种记录列表 + * + * @param scChangeVariety 改品种记录 + * @return 改品种记录集合 + */ + public List selectScChangeVarietyList(ScChangeVariety scChangeVariety); + + /** + * 新增改品种记录 + * + * @param scChangeVariety 改品种记录 + * @return 结果 + */ + public int insertScChangeVariety(ScChangeVariety scChangeVariety); + + /** + * 修改改品种记录 + * + * @param scChangeVariety 改品种记录 + * @return 结果 + */ + public int updateScChangeVariety(ScChangeVariety scChangeVariety); + + /** + * 删除改品种记录 + * + * @param id 改品种记录主键 + * @return 结果 + */ + public int deleteScChangeVarietyById(Integer id); + + /** + * 批量删除改品种记录 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteScChangeVarietyByIds(Integer[] ids); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScTransGroupMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScTransGroupMapper.java index 01cb430..5746adc 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScTransGroupMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/mapper/ScTransGroupMapper.java @@ -3,6 +3,7 @@ package com.zhyc.module.produce.manage_sheep.mapper; import java.util.List; import com.zhyc.module.produce.manage_sheep.domain.ScTransGroup; +import org.apache.ibatis.annotations.Mapper; /** * 转群记录Mapper接口 @@ -10,6 +11,7 @@ import com.zhyc.module.produce.manage_sheep.domain.ScTransGroup; * @author ruoyi * @date 2025-07-10 */ +@Mapper public interface ScTransGroupMapper { /** * 查询转群记录 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 0cfc78c..a095246 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 @@ -3,6 +3,7 @@ package com.zhyc.module.produce.manage_sheep.mapper; import java.util.List; import com.zhyc.module.produce.manage_sheep.domain.ScTransitionInfo; +import org.apache.ibatis.annotations.Param; /** * 转场Mapper接口 @@ -59,4 +60,7 @@ public interface ScTransitionInfoMapper * @return 结果 */ public int deleteScTransitionInfoByIds(Integer[] ids); + + //批量转场 + int insertScTransitionInfoBatch(@Param("list") List transitionInfoList); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScAddSheepService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScAddSheepService.java index 24f81d0..e39b7c9 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScAddSheepService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScAddSheepService.java @@ -7,11 +7,19 @@ import java.util.List; public interface IScAddSheepService { + //新增 boolean insertScAddSheep(ScAddSheep scAddSheep); + //查询 List selectScAddSheepList(ScAddSheep scAddSheep); + + //修改 boolean updateScAddSheep(ScAddSheep scAddSheep); + + //删除 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/service/IScChangeCommentService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScChangeCommentService.java new file mode 100644 index 0000000..cd11f0c --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScChangeCommentService.java @@ -0,0 +1,61 @@ +package com.zhyc.module.produce.manage_sheep.service; + +import java.util.List; +import com.zhyc.module.produce.manage_sheep.domain.ScChangeComment; + +/** + * 改备注Service接口 + * + * @author ruoyi + * @date 2025-07-24 + */ +public interface IScChangeCommentService +{ + /** + * 查询改备注 + * + * @param id 改备注主键 + * @return 改备注 + */ + public ScChangeComment selectScChangeCommentById(Long id); + + /** + * 查询改备注列表 + * + * @param scChangeComment 改备注 + * @return 改备注集合 + */ + public List selectScChangeCommentList(ScChangeComment scChangeComment); + + /** + * 新增改备注 + * + * @param scChangeComment 改备注 + * @return 结果 + */ + public int insertScChangeComment(ScChangeComment scChangeComment); + + /** + * 修改改备注 + * + * @param scChangeComment 改备注 + * @return 结果 + */ + public int updateScChangeComment(ScChangeComment scChangeComment); + + /** + * 批量删除改备注 + * + * @param ids 需要删除的改备注主键集合 + * @return 结果 + */ + public int deleteScChangeCommentByIds(Long[] ids); + + /** + * 删除改备注信息 + * + * @param id 改备注主键 + * @return 结果 + */ + public int deleteScChangeCommentById(Long id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScChangeEarService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScChangeEarService.java new file mode 100644 index 0000000..93133ea --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScChangeEarService.java @@ -0,0 +1,61 @@ +package com.zhyc.module.produce.manage_sheep.service; + +import java.util.List; +import com.zhyc.module.produce.manage_sheep.domain.ScChangeEar; + +/** + * 修改电子耳号记录Service接口 + * + * @author ruoyi + * @date 2025-07-24 + */ +public interface IScChangeEarService +{ + /** + * 查询修改电子耳号记录 + * + * @param id 修改电子耳号记录主键 + * @return 修改电子耳号记录 + */ + public ScChangeEar selectScChangeEarById(Integer id); + + /** + * 查询修改电子耳号记录列表 + * + * @param scChangeEar 修改电子耳号记录 + * @return 修改电子耳号记录集合 + */ + public List selectScChangeEarList(ScChangeEar scChangeEar); + + /** + * 新增修改电子耳号记录 + * + * @param scChangeEar 修改电子耳号记录 + * @return 结果 + */ + public int insertScChangeEar(ScChangeEar scChangeEar); + + /** + * 修改修改电子耳号记录 + * + * @param scChangeEar 修改电子耳号记录 + * @return 结果 + */ + public int updateScChangeEar(ScChangeEar scChangeEar); + + /** + * 批量删除修改电子耳号记录 + * + * @param ids 需要删除的修改电子耳号记录主键集合 + * @return 结果 + */ + public int deleteScChangeEarByIds(Integer[] ids); + + /** + * 删除修改电子耳号记录信息 + * + * @param id 修改电子耳号记录主键 + * @return 结果 + */ + public int deleteScChangeEarById(Integer id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScChangeVarietyService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScChangeVarietyService.java new file mode 100644 index 0000000..7de8f59 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScChangeVarietyService.java @@ -0,0 +1,61 @@ +package com.zhyc.module.produce.manage_sheep.service; + +import java.util.List; +import com.zhyc.module.produce.manage_sheep.domain.ScChangeVariety; + +/** + * 改品种记录Service接口 + * + * @author ruoyi + * @date 2025-07-24 + */ +public interface IScChangeVarietyService +{ + /** + * 查询改品种记录 + * + * @param id 改品种记录主键 + * @return 改品种记录 + */ + public ScChangeVariety selectScChangeVarietyById(Integer id); + + /** + * 查询改品种记录列表 + * + * @param scChangeVariety 改品种记录 + * @return 改品种记录集合 + */ + public List selectScChangeVarietyList(ScChangeVariety scChangeVariety); + + /** + * 新增改品种记录 + * + * @param scChangeVariety 改品种记录 + * @return 结果 + */ + public int insertScChangeVariety(ScChangeVariety scChangeVariety); + + /** + * 修改改品种记录 + * + * @param scChangeVariety 改品种记录 + * @return 结果 + */ + public int updateScChangeVariety(ScChangeVariety scChangeVariety); + + /** + * 批量删除改品种记录 + * + * @param ids 需要删除的改品种记录主键集合 + * @return 结果 + */ + public int deleteScChangeVarietyByIds(Integer[] ids); + + /** + * 删除改品种记录信息 + * + * @param id 改品种记录主键 + * @return 结果 + */ + public int deleteScChangeVarietyById(Integer id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScTransGroupService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScTransGroupService.java index b9a63dd..6430d38 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScTransGroupService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/IScTransGroupService.java @@ -58,4 +58,10 @@ public interface IScTransGroupService { * @return 结果 */ public int deleteScTransGroupById(Integer id); + + + /** + * 审批转群记录 + */ + int approveScTransGroup(ScTransGroup scTransGroup); } 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 d84a886..b578491 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 @@ -6,15 +6,14 @@ import com.zhyc.module.produce.manage_sheep.domain.ScTransitionInfo; /** * 转场Service接口 - * + * * @author ruoyi * @date 2025-07-10 */ -public interface IScTransitionInfoService -{ +public interface IScTransitionInfoService { /** * 查询转场 - * + * * @param id 转场主键 * @return 转场 */ @@ -22,7 +21,7 @@ public interface IScTransitionInfoService /** * 查询转场列表 - * + * * @param scTransitionInfo 转场 * @return 转场集合 */ @@ -30,7 +29,7 @@ public interface IScTransitionInfoService /** * 新增转场 - * + * * @param scTransitionInfo 转场 * @return 结果 */ @@ -38,7 +37,7 @@ public interface IScTransitionInfoService /** * 修改转场 - * + * * @param scTransitionInfo 转场 * @return 结果 */ @@ -46,7 +45,7 @@ public interface IScTransitionInfoService /** * 批量删除转场 - * + * * @param ids 需要删除的转场主键集合 * @return 结果 */ @@ -54,9 +53,21 @@ public interface IScTransitionInfoService /** * 删除转场信息 - * + * * @param id 转场主键 * @return 结果 */ public int deleteScTransitionInfoById(Integer id); + + //批量转场 + public int insertScTransitionInfoBatch(List transitionInfoList); + + //状态 + public String convertStatus(Integer status); + + //转场类型 + public String convertTransType(Integer transType); + + //审批转场 + 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 f9bcdf9..278490e 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,6 +2,7 @@ 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.mapper.BasSheepVarietyMapper; 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; @@ -11,6 +12,7 @@ import com.zhyc.module.base.domain.DaSheepfold; import com.zhyc.module.base.mapper.DaSheepfoldMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.List; @@ -27,56 +29,67 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { @Autowired private IBasSheepService basSheepService; + @Autowired + private BasSheepVarietyMapper basSheepVarietyMapper; + + //新增 @Override + @Transactional(rollbackFor = Exception.class) public boolean insertScAddSheep(ScAddSheep scAddSheep) { - // 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.setManageTags(scAddSheep.getEarNumber()); +// bs.setElectronicTags(scAddSheep.getEarNumber()); + bs.setSheepfoldId(scAddSheep.getSheepfold().longValue()); + bs.setFatherId(null); bs.setMotherId(null); bs.setBirthWeight(scAddSheep.getBornWeight().longValue()); + bs.setSource(String.valueOf(2)); bs.setBirthday(scAddSheep.getBirthday()); bs.setGender(scAddSheep.getGender().longValue()); - bs.setParity(scAddSheep.getParity().longValue()); + if (scAddSheep.getParity() != null) { + bs.setParity(scAddSheep.getParity().longValue()); + } else { + bs.setParity(null); + } 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); } + //修改 @Override public boolean updateScAddSheep(ScAddSheep scAddSheep) { return scAddSheepMapper.updateScAddSheep(scAddSheep) > 0; } + //删除 @Override public boolean deleteScAddSheepByIds(Integer[] ids) { return scAddSheepMapper.deleteScAddSheepByIds(ids) > 0; } - /* ------------------ 导入:羊舍名称 → ID ------------------ */ + //导入羊只 @Override + @Transactional(rollbackFor = Exception.class) public String importSheep(List list, boolean updateSupport, String operName) { if (list == null || list.isEmpty()) { throw new ServiceException("导入数据不能为空!"); @@ -88,12 +101,30 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { for (int i = 0; i < list.size(); i++) { ScAddSheep sheep = list.get(i); try { - /* 1. 羊舍名称 → ID */ + if (StringUtils.isNotBlank(sheep.getVarietyName())) { + Long varietyId = basSheepVarietyMapper.selectIdByName(sheep.getVarietyName()); + if (varietyId == null) { + failure++; + failureMsg.append("
第") + .append(i + 1) + .append("行:品种名称不存在【") + .append(sheep.getVarietyName()) + .append("】"); + continue; + } + sheep.setVarietyId(varietyId.intValue()); + } else { + failure++; + failureMsg.append("
第") + .append(i + 1) + .append("行:品种不能为空"); + continue; + } + 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("
第") @@ -106,7 +137,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { sheep.setSheepfold(foldList.get(0).getId().intValue()); } - /* 2. 耳号非空校验 */ if (StringUtils.isBlank(sheep.getEarNumber())) { failure++; failureMsg.append("
第") @@ -115,7 +145,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { continue; } - /* 3. 耳号重复校验(增量导入核心) */ ScAddSheep exist = scAddSheepMapper.selectByEarNumber(sheep.getEarNumber()); if (exist != null) { failure++; @@ -127,7 +156,6 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { continue; } - /* 4. 插入或更新 */ if (updateSupport && sheep.getId() != null) { sheep.setUpdateBy(operName); updateScAddSheep(sheep); @@ -136,6 +164,7 @@ public class ScAddSheepServiceImpl implements IScAddSheepService { insertScAddSheep(sheep); } success++; + } catch (Exception e) { failure++; failureMsg.append("
第") diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScChangeCommentServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScChangeCommentServiceImpl.java new file mode 100644 index 0000000..f45aa59 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScChangeCommentServiceImpl.java @@ -0,0 +1,120 @@ +package com.zhyc.module.produce.manage_sheep.service.impl; + +import java.util.Date; +import java.util.List; +import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; +import com.zhyc.module.base.domain.BasSheep; +import com.zhyc.module.base.service.IBasSheepService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.produce.manage_sheep.mapper.ScChangeCommentMapper; +import com.zhyc.module.produce.manage_sheep.domain.ScChangeComment; +import com.zhyc.module.produce.manage_sheep.service.IScChangeCommentService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 改备注Service业务层处理 + * + * @author ruoyi + * @date 2025-07-24 + */ +@Service +public class ScChangeCommentServiceImpl implements IScChangeCommentService +{ + @Autowired + private ScChangeCommentMapper scChangeCommentMapper; + + @Autowired + private IBasSheepService basSheepService; + /** + * 查询改备注 + * + * @param id 改备注主键 + * @return 改备注 + */ + @Override + public ScChangeComment selectScChangeCommentById(Long id) + { + return scChangeCommentMapper.selectScChangeCommentById(id); + } + + /** + * 查询改备注列表 + * + * @param scChangeComment 改备注 + * @return 改备注 + */ + @Override + public List selectScChangeCommentList(ScChangeComment scChangeComment) + { + return scChangeCommentMapper.selectScChangeCommentList(scChangeComment); + } + + /** + * 新增改备注 + * + * @param scChangeComment 改备注 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int insertScChangeComment(ScChangeComment scChangeComment) + { + scChangeComment.setCreateTime(new Date()); + scChangeComment.setCreateBy(SecurityUtils.getUsername()); + int rows = scChangeCommentMapper.insertScChangeComment(scChangeComment); + if (rows <= 0) { + return rows; + } + + String manageTags = scChangeComment.getManageTags(); + BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags); + if (sheep == null) { + throw new RuntimeException("未找到耳号为【" + manageTags + "】的羊只,无法更新备注"); + } + + sheep.setComment(scChangeComment.getNewComment()); + basSheepService.updateBasSheep(sheep); + + return rows; + } + + /** + * 修改改备注 + * + * @param scChangeComment 改备注 + * @return 结果 + */ + @Override + public int updateScChangeComment(ScChangeComment scChangeComment) + { + return scChangeCommentMapper.updateScChangeComment(scChangeComment); + } + + /** + * 批量删除改备注 + * + * @param ids 需要删除的改备注主键 + * @return 结果 + */ + @Override + public int deleteScChangeCommentByIds(Long[] ids) + { + return scChangeCommentMapper.deleteScChangeCommentByIds(ids); + } + + /** + * 删除改备注信息 + * + * @param id 改备注主键 + * @return 结果 + */ + @Override + public int deleteScChangeCommentById(Long id) + { + return scChangeCommentMapper.deleteScChangeCommentById(id); + } + + +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScChangeEarServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScChangeEarServiceImpl.java new file mode 100644 index 0000000..8f78e50 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScChangeEarServiceImpl.java @@ -0,0 +1,156 @@ +package com.zhyc.module.produce.manage_sheep.service.impl; + +import java.util.List; +import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; +import com.zhyc.module.base.domain.BasSheep; +import com.zhyc.module.base.service.IBasSheepService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.produce.manage_sheep.mapper.ScChangeEarMapper; +import com.zhyc.module.produce.manage_sheep.domain.ScChangeEar; +import com.zhyc.module.produce.manage_sheep.service.IScChangeEarService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 修改电子耳号记录Service业务层处理 + * + * @author ruoyi + * @date 2025-07-24 + */ +@Service +public class ScChangeEarServiceImpl implements IScChangeEarService +{ + @Autowired + private ScChangeEarMapper scChangeEarMapper; + + @Autowired + private IBasSheepService basSheepService; + /** + * 查询修改电子耳号记录 + * + * @param id 修改电子耳号记录主键 + * @return 修改电子耳号记录 + */ + @Override + public ScChangeEar selectScChangeEarById(Integer id) { + ScChangeEar changeEar = scChangeEarMapper.selectScChangeEarById(id); + if (changeEar != null && changeEar.getSheepId() != null) { + System.out.println("当前要查询羊只信息的sheepId: " + changeEar.getSheepId()); + BasSheep sheep = basSheepService.selectBasSheepById(changeEar.getSheepId()); + System.out.println("查询到的羊只信息: " + sheep); + if (sheep != null) { + if (changeEar.getEarType() != null) { + if (changeEar.getEarType() == 0) { + changeEar.setOldTag(sheep.getElectronicTags()); + } else { + changeEar.setOldTag(sheep.getManageTags()); + } + } + changeEar.setManageTags(sheep.getManageTags()); + } else { + System.out.println("根据sheepId: " + changeEar.getSheepId() + " 未查询到对应的羊只信息"); + } + } else { + System.out.println("changeEar为null或者sheepId为null"); + } + System.out.println("设置旧耳号: " + changeEar.getOldTag()); + return changeEar; + } + + /** + * 查询修改电子耳号记录列表 + * + * @param scChangeEar 修改电子耳号记录 + * @return 修改电子耳号记录 + */ + @Override + public List selectScChangeEarList(ScChangeEar scChangeEar) { + List list = scChangeEarMapper.selectScChangeEarList(scChangeEar); + return list; + } + + /** + * 新增修改电子耳号记录 + * + * @param scChangeEar 修改电子耳号记录 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int insertScChangeEar(ScChangeEar scChangeEar) { + scChangeEar.setCreateTime(DateUtils.getNowDate()); + scChangeEar.setCreateBy(SecurityUtils.getUsername()); + + // 在新增时,确保旧耳号被正确设置为原始耳号的值 + if (scChangeEar.getSheepId() == null) { + throw new RuntimeException("未找到对应的羊只ID"); + } + + BasSheep sheep = basSheepService.selectBasSheepById(scChangeEar.getSheepId()); + if (sheep == null) { + throw new RuntimeException("未找到ID为【" + scChangeEar.getSheepId() + "】的羊只"); + } + + // 设置旧耳号为原始耳号的值 + if (scChangeEar.getEarType() == 0) { + scChangeEar.setOldTag(sheep.getElectronicTags()); + } else if (scChangeEar.getEarType() == 1) { + scChangeEar.setOldTag(sheep.getManageTags()); + } else { + throw new RuntimeException("无效的耳号类型:" + scChangeEar.getEarType()); + } + + int rows = scChangeEarMapper.insertScChangeEar(scChangeEar); + System.out.println(scChangeEar); + if (rows <= 0) { + return rows; + } + + // 更新羊只基本信息表中的管理耳号或电子耳号 + if (scChangeEar.getEarType() == 0) { + sheep.setElectronicTags(scChangeEar.getNewTag()); + } else if (scChangeEar.getEarType() == 1) { + sheep.setManageTags(scChangeEar.getNewTag()); + } + basSheepService.updateBasSheep(sheep); + + return rows; + } + + /** + * 修改修改电子耳号记录 + * + * @param scChangeEar 修改电子耳号记录 + * @return 结果 + */ + @Override + public int updateScChangeEar(ScChangeEar scChangeEar) + { + return scChangeEarMapper.updateScChangeEar(scChangeEar); + } + + /** + * 批量删除修改电子耳号记录 + * + * @param ids 需要删除的修改电子耳号记录主键 + * @return 结果 + */ + @Override + public int deleteScChangeEarByIds(Integer[] ids) + { + return scChangeEarMapper.deleteScChangeEarByIds(ids); + } + + /** + * 删除修改电子耳号记录信息 + * + * @param id 修改电子耳号记录主键 + * @return 结果 + */ + @Override + public int deleteScChangeEarById(Integer id) + { + return scChangeEarMapper.deleteScChangeEarById(id); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScChangeVarietyServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScChangeVarietyServiceImpl.java new file mode 100644 index 0000000..9551a56 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/service/impl/ScChangeVarietyServiceImpl.java @@ -0,0 +1,127 @@ +package com.zhyc.module.produce.manage_sheep.service.impl; + +import java.util.Date; +import java.util.List; + +import com.zhyc.common.utils.SecurityUtils; +import com.zhyc.module.base.domain.BasSheep; +import com.zhyc.module.base.domain.BasSheepVariety; +import com.zhyc.module.base.service.IBasSheepService; +import com.zhyc.module.base.service.IBasSheepVarietyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.produce.manage_sheep.mapper.ScChangeVarietyMapper; +import com.zhyc.module.produce.manage_sheep.domain.ScChangeVariety; +import com.zhyc.module.produce.manage_sheep.service.IScChangeVarietyService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 改品种记录Service业务层处理 + * + * @author ruoyi + * @date 2025-07-24 + */ +@Service +public class ScChangeVarietyServiceImpl implements IScChangeVarietyService +{ + @Autowired + private ScChangeVarietyMapper scChangeVarietyMapper; + @Autowired + private IBasSheepService basSheepService; + @Autowired + private IBasSheepVarietyService varietyService; + /** + * 查询改品种记录 + * + * @param id 改品种记录主键 + * @return 改品种记录 + */ + @Override + public ScChangeVariety selectScChangeVarietyById(Integer id) + { + return scChangeVarietyMapper.selectScChangeVarietyById(id); + } + + /** + * 查询改品种记录列表 + * + * @param scChangeVariety 改品种记录 + * @return 改品种记录 + */ + @Override + public List selectScChangeVarietyList(ScChangeVariety scChangeVariety) + { + return scChangeVarietyMapper.selectScChangeVarietyList(scChangeVariety); + } + + /** + * 新增改品种记录 + * + * @param scChangeVariety 改品种记录 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int insertScChangeVariety(ScChangeVariety scChangeVariety) + { + scChangeVariety.setCreateTime(new Date()); + scChangeVariety.setCreateBy(SecurityUtils.getUsername()); + int rows = scChangeVarietyMapper.insertScChangeVariety(scChangeVariety); + if (rows <= 0) { + return rows; + } + + String manageTags = scChangeVariety.getManageTags(); + BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags); + if (sheep == null) { + throw new RuntimeException("未找到耳号为【" + manageTags + "】的羊只,无法更新品种"); + } + + String newVarietyName = scChangeVariety.getVarietyNew(); + BasSheepVariety newVariety = varietyService.selectByVarietyName(newVarietyName); + if (newVariety == null) { + throw new RuntimeException("未找到品种【" + newVarietyName + "】的信息,请检查品种名称"); + } + + sheep.setVarietyId(newVariety.getId()); + basSheepService.updateBasSheep(sheep); + + return rows; + } + + /** + * 修改改品种记录 + * + * @param scChangeVariety 改品种记录 + * @return 结果 + */ + @Override + public int updateScChangeVariety(ScChangeVariety scChangeVariety) + { + return scChangeVarietyMapper.updateScChangeVariety(scChangeVariety); + } + + /** + * 批量删除改品种记录 + * + * @param ids 需要删除的改品种记录主键 + * @return 结果 + */ + @Override + public int deleteScChangeVarietyByIds(Integer[] ids) + { + return scChangeVarietyMapper.deleteScChangeVarietyByIds(ids); + } + + /** + * 删除改品种记录信息 + * + * @param id 改品种记录主键 + * @return 结果 + */ + @Override + public int deleteScChangeVarietyById(Integer id) + { + return scChangeVarietyMapper.deleteScChangeVarietyById(id); + } +} 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 6bea8d1..3604f92 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 @@ -1,15 +1,21 @@ package com.zhyc.module.produce.manage_sheep.service.impl; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; +import com.zhyc.module.base.domain.BasSheep; +import com.zhyc.module.base.mapper.BasSheepMapper; +import com.zhyc.module.base.service.IBasSheepService; import com.zhyc.module.produce.manage_sheep.mapper.ScTransGroupMapper; import com.zhyc.module.produce.manage_sheep.service.IScTransGroupService; import com.zhyc.module.produce.manage_sheep.domain.ScTransGroup; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; /** * 转群记录Service业务层处理 @@ -21,7 +27,10 @@ import org.springframework.stereotype.Service; public class ScTransGroupServiceImpl implements IScTransGroupService { @Autowired private ScTransGroupMapper scTransGroupMapper; - + @Autowired + private BasSheepMapper basSheepMapper; + @Autowired + private IBasSheepService basSheepService; /** * 查询转群记录 * @@ -64,6 +73,7 @@ public class ScTransGroupServiceImpl implements IScTransGroupService { public int insertScTransGroup(ScTransGroup scTransGroup) { scTransGroup.setStatus(0); scTransGroup.setCreateTime(DateUtils.getNowDate()); + scTransGroup.setCreateBy(SecurityUtils.getUsername()); return scTransGroupMapper.insertScTransGroup(scTransGroup); } @@ -100,6 +110,51 @@ public class ScTransGroupServiceImpl implements IScTransGroupService { return scTransGroupMapper.deleteScTransGroupById(id); } + + /** + * 审批转群记录 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int approveScTransGroup(ScTransGroup scTransGroup) { + int rows = scTransGroupMapper.updateScTransGroup(scTransGroup); + + if (rows > 0 && scTransGroup.getStatus() == 1) { + updateSheepFold(scTransGroup); + } + + return rows; + } + + /** + * 更新羊只所在羊舍 + */ + private void updateSheepFold(ScTransGroup transGroup) { + Long foldTo = Long.valueOf(transGroup.getFoldTo()); + if (foldTo == null) { + throw new RuntimeException("转入羊舍不能为空"); + } + + String manageTags = transGroup.getManageTags(); + if (manageTags == null || manageTags.isEmpty()) { + throw new RuntimeException("耳号不能为空"); + } + + List tagList = Arrays.asList(manageTags.split(",")); + + for (String tag : tagList) { + BasSheep sheep = basSheepService.selectBasSheepByManageTags(tag.trim()); + if (sheep != null) { + BasSheep updateSheep = new BasSheep(); + updateSheep.setId(sheep.getId()); + updateSheep.setSheepfoldId(foldTo); + basSheepMapper.updateBasSheep(updateSheep); + } else { + throw new RuntimeException("耳号 [" + tag + "] 不存在"); + } + } + } + /** * 转换转群原因 */ 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 24ff65f..cd8a96b 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 @@ -1,12 +1,22 @@ package com.zhyc.module.produce.manage_sheep.service.impl; -import java.util.List; +import java.util.*; + import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; +import com.zhyc.common.utils.StringUtils; +import com.zhyc.module.base.domain.BasSheep; +import com.zhyc.module.base.domain.DaRanch; +import com.zhyc.module.base.mapper.BasSheepMapper; +import com.zhyc.module.base.mapper.DaRanchMapper; +import com.zhyc.module.base.service.IBasSheepService; +import com.zhyc.module.base.service.IDaRanchService; import com.zhyc.module.produce.manage_sheep.mapper.ScTransitionInfoMapper; import com.zhyc.module.produce.manage_sheep.domain.ScTransitionInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zhyc.module.produce.manage_sheep.service.IScTransitionInfoService; +import org.springframework.transaction.annotation.Transactional; /** * 转场Service业务层处理 @@ -19,7 +29,12 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService { @Autowired private ScTransitionInfoMapper scTransitionInfoMapper; - + @Autowired + private BasSheepMapper basSheepMapper; + @Autowired + private IDaRanchService daRanchService; + @Autowired + private IBasSheepService basSheepService; /** * 查询转场 * @@ -93,4 +108,94 @@ public class ScTransitionInfoServiceImpl implements IScTransitionInfoService { return scTransitionInfoMapper.deleteScTransitionInfoById(id); } + + @Override + public int insertScTransitionInfoBatch(List transitionInfoList) { + String username = SecurityUtils.getUsername(); + Date now = DateUtils.getNowDate(); + + for (ScTransitionInfo info : transitionInfoList) { + info.setCreateBy(username); // 设置创建人 + info.setCreateTime(now); // 设置创建时间 + info.setStatus(0); // 设置默认状态 + } + return scTransitionInfoMapper.insertScTransitionInfoBatch(transitionInfoList); + } + + /** + * 审批转场记录(通过时更新羊只所在牧场) + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int approveScTransitionInfo(ScTransitionInfo scTransitionInfo) { + int rows = scTransitionInfoMapper.updateScTransitionInfo(scTransitionInfo); + + if (rows > 0 && scTransitionInfo.getStatus() == 1) { + updateSheepRanch(scTransitionInfo); + } + return rows; + } + + /** + * 更新羊只的所在牧场(基于现有牧场列表接口) + */ + private void updateSheepRanch(ScTransitionInfo transitionInfo) { + String transTo = transitionInfo.getTransTo(); + if (StringUtils.isBlank(transTo)) { + throw new RuntimeException("转入牧场不能为空"); + } + + DaRanch query = new DaRanch(); + query.setRanch(transTo); + List ranchList = daRanchService.selectDaRanchList(query); + + Optional matchedRanch = ranchList.stream() + .filter(ranch -> transTo.equals(ranch.getRanch())) + .findFirst(); + + if (!matchedRanch.isPresent()) { + throw new RuntimeException("转入牧场 [" + transTo + "] 不存在"); + } + Long targetRanchId = matchedRanch.get().getId(); + + String manageTags = transitionInfo.getManageTags(); + if (StringUtils.isBlank(manageTags)) { + throw new RuntimeException("耳号不能为空"); + } + List tagList = Arrays.asList(manageTags.split(",")); + + for (String tag : tagList) { + BasSheep sheep = basSheepService.selectBasSheepByManageTags(tag.trim()); + if (sheep == null) { + throw new RuntimeException("耳号 [" + tag + "] 不存在"); + } + + BasSheep updateSheep = new BasSheep(); + updateSheep.setId(sheep.getId()); + updateSheep.setRanchId(targetRanchId); + basSheepMapper.updateBasSheep(updateSheep); + } + } + + /** + * 状态 + */ + public String convertStatus(Integer statusCode) { + Map statusMap = new HashMap<>(); + statusMap.put(0, "待批准"); + statusMap.put(1, "通过"); + statusMap.put(2, "驳回"); + return statusMap.getOrDefault(statusCode, "未知状态"); + } + + /** + * 转场类型 + */ + public String convertTransType(Integer transTypeCode) { + Map transTypeMap = new HashMap<>(); + transTypeMap.put(0, "内部调拨"); + transTypeMap.put(1, "内部销售"); + transTypeMap.put(2, "育肥调拨"); + return transTypeMap.getOrDefault(transTypeCode, "未知类型"); + } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/controller/ScFixHoofController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/controller/ScFixHoofController.java index 83e5a18..9f97e71 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/controller/ScFixHoofController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/controller/ScFixHoofController.java @@ -3,18 +3,12 @@ package com.zhyc.module.produce.other.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.zhyc.common.utils.StringUtils; import com.zhyc.module.produce.other.domain.ScFixHoof; import com.zhyc.module.produce.other.service.IScFixHoofService; 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 org.springframework.web.bind.annotation.*; import com.zhyc.common.annotation.Log; import com.zhyc.common.core.controller.BaseController; import com.zhyc.common.core.domain.AjaxResult; @@ -24,7 +18,7 @@ import com.zhyc.common.core.page.TableDataInfo; /** * 修蹄Controller - * + * * @author ruoyi * @date 2025-07-10 */ @@ -72,14 +66,23 @@ public class ScFixHoofController extends BaseController } /** - * 新增修蹄 + * 新增修蹄记录(支持批量) + * @return 结果 */ @PreAuthorize("@ss.hasPermi('produce:fixHoof:add')") @Log(title = "修蹄", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody ScFixHoof dto){ - dto.setSheepId(scFixHoofService.findIdByManageTags(dto.getManageTags()).intValue()); - return toAjax(scFixHoofService.insertScFixHoof(dto)); + public AjaxResult add(@RequestBody List dtos) { + for (ScFixHoof dto : dtos) { + if (dto.getSheepId() == null && StringUtils.isNotBlank(dto.getManageTags())) { + Long sheepId = scFixHoofService.findIdByManageTags(dto.getManageTags()); + dto.setSheepId(sheepId.intValue()); + } + + // 保存修蹄记录 + scFixHoofService.insertScFixHoof(dto); + } + return toAjax(dtos.size()); } /** @@ -98,11 +101,13 @@ public class ScFixHoofController extends BaseController */ @PreAuthorize("@ss.hasPermi('produce:fixHoof:remove')") @Log(title = "修蹄", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") + @DeleteMapping("/{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/domain/ScCastrate.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/domain/ScCastrate.java index 69d7d38..1ebab6d 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 @@ -28,17 +28,16 @@ public class ScCastrate extends BaseEntity { /** * 羊只id */ - @Excel(name = "羊只id") private String sheepId; + @Excel(name = "耳号") + private String manageTags; + /** * 羊舍id */ private Long sheepfold; - /** - * 用于通过羊舍id获取羊舍名称 - */ @Excel(name = "羊舍名称") private String sheepfoldName; 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 9dafaaa..60a92a8 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 @@ -10,7 +10,7 @@ import com.zhyc.common.core.domain.BaseEntity; /** * 修蹄对象 sc_fix_hoof - * + * * @author ruoyi * @date 2025-07-10 */ @@ -26,9 +26,8 @@ public class ScFixHoof extends BaseEntity /** 羊只id */ private Integer sheepId; - /** 管理耳号(仅用于接收参数/返回视图,不存库) */ + /** 管理耳号(仅用于接收参数/返回视图) */ @Excel(name = "管理耳号") -// @TableField(exist = false) // ← 非数据库字段 private String manageTags; /** 羊舍id */ diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/mapper/ScCastrateMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/mapper/ScCastrateMapper.java index 7ea9527..8b09e94 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/mapper/ScCastrateMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/mapper/ScCastrateMapper.java @@ -3,6 +3,7 @@ package com.zhyc.module.produce.other.mapper; import java.util.List; import com.zhyc.module.produce.other.domain.ScCastrate; +import org.apache.ibatis.annotations.Mapper; /** * 去势Mapper接口 @@ -10,6 +11,7 @@ import com.zhyc.module.produce.other.domain.ScCastrate; * @author ruoyi * @date 2025-07-09 */ +@Mapper public interface ScCastrateMapper { /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/mapper/ScFixHoofMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/mapper/ScFixHoofMapper.java index 580a4ca..490ddc4 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/mapper/ScFixHoofMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/mapper/ScFixHoofMapper.java @@ -3,6 +3,7 @@ package com.zhyc.module.produce.other.mapper; import java.util.List; import com.zhyc.module.produce.other.domain.ScFixHoof; +import org.apache.ibatis.annotations.Mapper; /** * 修蹄Mapper接口 @@ -10,6 +11,7 @@ import com.zhyc.module.produce.other.domain.ScFixHoof; * @author ruoyi * @date 2025-07-10 */ +@Mapper public interface ScFixHoofMapper { /** * 查询修蹄 diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/IScCastrateService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/IScCastrateService.java index 5f579c0..293a6bf 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/IScCastrateService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/IScCastrateService.java @@ -6,15 +6,14 @@ import com.zhyc.module.produce.other.domain.ScCastrate; /** * 去势Service接口 - * + * * @author ruoyi * @date 2025-07-09 */ -public interface IScCastrateService -{ +public interface IScCastrateService { /** * 查询去势 - * + * * @param id 去势主键 * @return 去势 */ @@ -22,7 +21,7 @@ public interface IScCastrateService /** * 查询去势列表 - * + * * @param scCastrate 去势 * @return 去势集合 */ @@ -30,7 +29,7 @@ public interface IScCastrateService /** * 新增去势 - * + * * @param scCastrate 去势 * @return 结果 */ @@ -38,7 +37,7 @@ public interface IScCastrateService /** * 修改去势 - * + * * @param scCastrate 去势 * @return 结果 */ @@ -46,7 +45,7 @@ public interface IScCastrateService /** * 批量删除去势 - * + * * @param ids 需要删除的去势主键集合 * @return 结果 */ @@ -54,9 +53,11 @@ public interface IScCastrateService /** * 删除去势信息 - * + * * @param id 去势主键 * @return 结果 */ public int deleteScCastrateById(Long id); + + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/IScFixHoofService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/IScFixHoofService.java index b567788..32d9263 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/IScFixHoofService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/IScFixHoofService.java @@ -6,15 +6,14 @@ import com.zhyc.module.produce.other.domain.ScFixHoof; /** * 修蹄Service接口 - * + * * @author ruoyi * @date 2025-07-10 */ -public interface IScFixHoofService -{ +public interface IScFixHoofService { /** * 查询修蹄 - * + * * @param id 修蹄主键 * @return 修蹄 */ @@ -22,7 +21,7 @@ public interface IScFixHoofService /** * 查询修蹄列表 - * + * * @param scFixHoof 修蹄 * @return 修蹄集合 */ @@ -30,7 +29,7 @@ public interface IScFixHoofService /** * 新增修蹄 - * + * * @param scFixHoof 修蹄 * @return 结果 */ @@ -38,7 +37,7 @@ public interface IScFixHoofService /** * 修改修蹄 - * + * * @param scFixHoof 修蹄 * @return 结果 */ @@ -46,7 +45,7 @@ public interface IScFixHoofService /** * 批量删除修蹄 - * + * * @param ids 需要删除的修蹄主键集合 * @return 结果 */ @@ -54,7 +53,7 @@ public interface IScFixHoofService /** * 删除修蹄信息 - * + * * @param id 修蹄主键 * @return 结果 */ @@ -62,6 +61,7 @@ public interface IScFixHoofService /** * 根据管理耳号查询 + * * @param manageTags * @return */ diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/impl/ScCastrateServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/impl/ScCastrateServiceImpl.java index 2ba46d3..74f80eb 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/impl/ScCastrateServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/impl/ScCastrateServiceImpl.java @@ -1,7 +1,11 @@ package com.zhyc.module.produce.other.service.impl; import java.util.List; + import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; +import com.zhyc.module.base.domain.BasSheep; +import com.zhyc.module.base.service.IBasSheepService; import com.zhyc.module.produce.other.domain.ScCastrate; import com.zhyc.module.produce.other.mapper.ScCastrateMapper; import com.zhyc.module.produce.other.service.IScCastrateService; @@ -10,86 +14,95 @@ import org.springframework.stereotype.Service; /** * 去势Service业务层处理 - * + * * @author ruoyi * @date 2025-07-09 */ @Service -public class ScCastrateServiceImpl implements IScCastrateService -{ +public class ScCastrateServiceImpl implements IScCastrateService { @Autowired private ScCastrateMapper scCastrateMapper; + @Autowired + private IBasSheepService basSheepService; /** * 查询去势 - * + * * @param id 去势主键 * @return 去势 */ @Override - public ScCastrate selectScCastrateById(Long id) - { + public ScCastrate selectScCastrateById(Long id) { return scCastrateMapper.selectScCastrateById(id); } /** * 查询去势列表 - * + * * @param scCastrate 去势 * @return 去势 */ @Override - public List selectScCastrateList(ScCastrate scCastrate) - { + public List selectScCastrateList(ScCastrate scCastrate) { return scCastrateMapper.selectScCastrateList(scCastrate); } /** * 新增去势 - * + * * @param scCastrate 去势 * @return 结果 */ @Override - public int insertScCastrate(ScCastrate scCastrate) - { + public int insertScCastrate(ScCastrate scCastrate) { scCastrate.setCreateTime(DateUtils.getNowDate()); - return scCastrateMapper.insertScCastrate(scCastrate); + scCastrate.setCreateBy(SecurityUtils.getUsername()); + int result = scCastrateMapper.insertScCastrate(scCastrate); + + if (result > 0 && scCastrate.getSheepId() != null) { + try { + BasSheep sheep = new BasSheep(); + sheep.setId(Long.parseLong(scCastrate.getSheepId())); + sheep.setGender(3L); + basSheepService.updateBasSheep(sheep); + } catch (Exception e) { + throw new RuntimeException("去势成功,但更新羊只性别失败,请重试"); + } + } + + return result; } /** * 修改去势 - * + * * @param scCastrate 去势 * @return 结果 */ @Override - public int updateScCastrate(ScCastrate scCastrate) - { + public int updateScCastrate(ScCastrate scCastrate) { return scCastrateMapper.updateScCastrate(scCastrate); } /** * 批量删除去势 - * + * * @param ids 需要删除的去势主键 * @return 结果 */ @Override - public int deleteScCastrateByIds(Long[] ids) - { + public int deleteScCastrateByIds(Long[] ids) { return scCastrateMapper.deleteScCastrateByIds(ids); } /** * 删除去势信息 - * + * * @param id 去势主键 * @return 结果 */ @Override - public int deleteScCastrateById(Long id) - { + public int deleteScCastrateById(Long id) { return scCastrateMapper.deleteScCastrateById(id); } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/impl/ScFixHoofServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/impl/ScFixHoofServiceImpl.java index 201eacc..fde7034 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/impl/ScFixHoofServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/service/impl/ScFixHoofServiceImpl.java @@ -4,14 +4,17 @@ import java.util.List; import com.zhyc.common.exception.ServiceException; import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.SecurityUtils; import com.zhyc.common.utils.StringUtils; -import com.zhyc.module.produce.other.domain.ScFixHoof; -import com.zhyc.module.produce.other.mapper.ScFixHoofMapper; import com.zhyc.module.base.domain.BasSheep; import com.zhyc.module.base.mapper.BasSheepMapper; +import com.zhyc.module.base.service.IDaSheepfoldService; +import com.zhyc.module.produce.other.domain.ScFixHoof; +import com.zhyc.module.produce.other.mapper.ScFixHoofMapper; +import com.zhyc.module.produce.other.service.IScFixHoofService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.zhyc.module.produce.other.service.IScFixHoofService; +import org.springframework.transaction.annotation.Transactional; /** * 修蹄Service业务层处理 @@ -27,6 +30,9 @@ public class ScFixHoofServiceImpl implements IScFixHoofService { @Autowired private BasSheepMapper basSheepMapper; + @Autowired + private IDaSheepfoldService daSheepfoldService; + /** * 查询修蹄 * @@ -57,12 +63,12 @@ public class ScFixHoofServiceImpl implements IScFixHoofService { */ @Override public int insertScFixHoof(ScFixHoof scFixHoof) { - // 校验羊只是否存在 BasSheep sheep = basSheepMapper.selectBasSheepById(scFixHoof.getSheepId().longValue()); if (sheep == null) { throw new ServiceException("该羊只ID不存在,请检查后再添加"); } scFixHoof.setCreateTime(DateUtils.getNowDate()); + scFixHoof.setCreateBy(SecurityUtils.getUsername()); return scFixHoofMapper.insertScFixHoof(scFixHoof); } @@ -104,15 +110,14 @@ public class ScFixHoofServiceImpl implements IScFixHoofService { * 根据管理耳号查询 */ @Override - public Long findIdByManageTags(String manageTags){ - if(StringUtils.isBlank(manageTags)) + public Long findIdByManageTags(String manageTags) { + if (StringUtils.isBlank(manageTags)) throw new ServiceException("管理耳号不能为空"); BasSheep sheep = basSheepMapper.selectBasSheepByManageTags(manageTags.trim()); - if(sheep == null) + if (sheep == null) throw new ServiceException("管理耳号不存在:" + manageTags); return sheep.getId(); } - -} +} \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/Breeding_records/ScBreedRecordMapper.xml b/zhyc-module/src/main/resources/mapper/Breeding_records/ScBreedRecordMapper.xml new file mode 100644 index 0000000..4128a7a --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/Breeding_records/ScBreedRecordMapper.xml @@ -0,0 +1,235 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select + br.id, + br.sheep_id, + br.ram_id, + br.ewe_id, + br.technician, + br.breed_drugs, + br.create_by, + br.create_time, + -- 母羊信息(从视图获取) + ewe_view.bs_manage_tags as ewe_manage_tags, + ewe_view.variety as ewe_variety, + ewe_view.parity as ewe_parity, + ewe_view.month_age as ewe_month_age, + ewe_view.sheepfold_name as ewe_sheepfold_name, + ewe_view.breed as ewe_breed_status, + ewe_view.controlled as ewe_controlled, + ewe_view.comment as ewe_comment, + ewe_view.dr_ranch as ranch_name, + ewe_view.name as sheep_type, + ewe_view.mating_total as mating_count, + -- 公羊信息(从视图获取) + ram_view.bs_manage_tags as ram_manage_tags, + ram_view.variety as ram_variety, + -- 配种方式(如果视图中没有,设为空或从其他地方获取) + '' as mating_type, + -- 发情后配种时间(小时数) + TIMESTAMPDIFF(HOUR, br.create_time, NOW()) as time_since_planning + from sc_breed_record br + left join sheep_file ewe_view on br.ewe_id = ewe_view.id + left join sheep_file ram_view on br.ram_id = ram_view.id + + + + + + + + + + + + + + + + + + + + insert into sc_breed_record + + sheep_id, + ram_id, + ewe_id, + technician, + breed_drugs, + create_by, + create_time, + + + #{sheepId}, + #{ramId}, + #{eweId}, + #{technician}, + #{breedDrugs}, + #{createBy}, + #{createTime}, + + + + + update sc_breed_record + + sheep_id = #{sheepId}, + ram_id = #{ramId}, + ewe_id = #{eweId}, + technician = #{technician}, + breed_drugs = #{breedDrugs}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from sc_breed_record where id = #{id} + + + + delete from sc_breed_record where id in + + #{id} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/Sperm/RawSpermRecordMapper.xml b/zhyc-module/src/main/resources/mapper/Sperm/RawSpermRecordMapper.xml new file mode 100644 index 0000000..727f32c --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/Sperm/RawSpermRecordMapper.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + select + rsr.id, + rsr.sheep_id, + sf.bs_manage_tags, + sf.electronic_tags, + sf.month_age, + rsr.pick_date, + rsr.amount, + rsr.density, + rsr.vitallity, + rsr.controlled, + rsr.sexual_status, + rsr.info, + rsr.technician, + rsr.comment, + rsr.create_by, + rsr.create_time + from raw_sperm_record rsr + left join sheep_file sf on rsr.sheep_id = sf.id + + + + + + + + + + + insert into raw_sperm_record + + sheep_id, + pick_date, + amount, + density, + vitallity, + controlled, + sexual_status, + info, + technician, + comment, + create_by, + create_time, + + + #{sheepId}, + #{pickDate}, + #{amount}, + #{density}, + #{vitallity}, + #{controlled}, + #{sexualStatus}, + #{info}, + #{technician}, + #{comment}, + #{createBy}, + #{createTime}, + + + + + update raw_sperm_record + + sheep_id = #{sheepId}, + pick_date = #{pickDate}, + amount = #{amount}, + density = #{density}, + vitallity = #{vitallity}, + controlled = #{controlled}, + sexual_status = #{sexualStatus}, + info = #{info}, + technician = #{technician}, + comment = #{comment}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from raw_sperm_record where id = #{id} + + + + delete from raw_sperm_record where id in + + #{id} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/base/BasSheepGroupMappingMapper.xml b/zhyc-module/src/main/resources/mapper/base/BasSheepGroupMappingMapper.xml index 7eaaf52..6fe31d8 100644 --- a/zhyc-module/src/main/resources/mapper/base/BasSheepGroupMappingMapper.xml +++ b/zhyc-module/src/main/resources/mapper/base/BasSheepGroupMappingMapper.xml @@ -52,19 +52,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND m.group_id = #{groupId} AND s.bs_manage_tags IN - - #{bsManageTag} + + #{tag} ORDER BY m.id - - - - - + SELECT id, manage_tags + FROM bas_sheep + WHERE manage_tags IN + + #{tag} + + + + + + INSERT INTO bas_sheep_group_mapping (sheep_id, group_id) + VALUES + + (#{item.sheepId}, #{item.groupId}) + + + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml b/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml index dc16f45..c39e3a5 100644 --- a/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml +++ b/zhyc-module/src/main/resources/mapper/base/BasSheepMapper.xml @@ -1,122 +1,177 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - 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 + 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 - SELECT s.id, - s.sheepfold_id AS sheepfoldId, - sf.sheepfold_name AS sheepfoldName, - s.variety_id AS varietyId, - bv.variety AS varietyName + s.manage_tags AS manageTags, + s.electronic_tags AS electronicTags, + s.sheepfold_id AS sheepfoldId, + sf.sheepfold_name AS sheepfoldName, + s.variety_id AS varietyId, + bv.variety AS varietyName FROM bas_sheep s LEFT JOIN da_sheepfold sf ON s.sheepfold_id = sf.id LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id WHERE s.id = #{id} - + SELECT s.*, + bv.variety AS varietyName + FROM bas_sheep s + LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id + WHERE s.manage_tags = #{manageTags} LIMIT 1 + + + + @@ -161,7 +216,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_by, create_time, is_delete, - + #{manageTags}, #{ranchId}, @@ -202,7 +257,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createBy}, #{createTime}, #{isDelete}, - + @@ -252,7 +307,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from bas_sheep where id = #{id} + delete + from bas_sheep + where id = #{id} @@ -262,5 +319,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/base/BasSheepTypeMapper.xml b/zhyc-module/src/main/resources/mapper/base/BasSheepTypeMapper.xml new file mode 100644 index 0000000..c1d5cd1 --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/base/BasSheepTypeMapper.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + select id, name from bas_sheep_type + + + + + + + + insert into bas_sheep_type + + name, + + + #{name}, + + + + + update bas_sheep_type + + name = #{name}, + + where id = #{id} + + + + delete from bas_sheep_type where id = #{id} + + + + delete from bas_sheep_type where id in + + #{id} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/base/BasSheepVarietyMapper.xml b/zhyc-module/src/main/resources/mapper/base/BasSheepVarietyMapper.xml index ede615b..f9d207a 100644 --- a/zhyc-module/src/main/resources/mapper/base/BasSheepVarietyMapper.xml +++ b/zhyc-module/src/main/resources/mapper/base/BasSheepVarietyMapper.xml @@ -1,25 +1,26 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - - + + - select id, variety from bas_sheep_variety + select id, variety + from bas_sheep_variety - + + SELECT id + FROM bas_sheep_variety + WHERE variety = #{varietyName} LIMIT 1 + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/base/DaRanchMapper.xml b/zhyc-module/src/main/resources/mapper/base/DaRanchMapper.xml new file mode 100644 index 0000000..2b7afb2 --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/base/DaRanchMapper.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + select id, ranch + from da_ranch + + + + + + + + insert into da_ranch + + ranch, + + + #{ranch}, + + + + + update da_ranch + + ranch = #{ranch}, + + where id = #{id} + + + + delete + from da_ranch + where id = #{id} + + + + delete from da_ranch where id in + + #{id} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/base/DaSheepfoldMapper.xml b/zhyc-module/src/main/resources/mapper/base/DaSheepfoldMapper.xml index f5c1afa..7c5ba5b 100644 --- a/zhyc-module/src/main/resources/mapper/base/DaSheepfoldMapper.xml +++ b/zhyc-module/src/main/resources/mapper/base/DaSheepfoldMapper.xml @@ -1,32 +1,40 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - + + + + + + + + + + - select id, ranch_id, sheepfold_name, sheepfold_type_id, sheepfold_no, row_no, columns, comment from da_sheepfold + select id, + ranch_id, + sheepfold_name, + sheepfold_type_id, + sheepfold_no, + row_no, + columns, + comment + from da_sheepfold - + + - - insert into sheep_file - - id, - bs_manage_tags, - ranch_id, - dr_ranch, - sheepfold_id, - sheepfold_name, - electronic_tags, - variety_id, - variety, - family, - name, - gender, - birthday, - day_age, - month_age, - parity, - birth_weight, - weaning_date, - status_id, - weaning_weight, - current_weight, - breed_status_id, - breed, - bs_father_id, - father_manage_tags, - bs_mother_id, - mother_manage_tags, - receptor_id, - receptor_manage_tags, - father_father_id, - grandfather_manage_tags, - father_mother_id, - grandmother_manage_tags, - father_id, - maternal_grandfather_manage_tags, - mother_id, - maternal_grandmother_manage_tags, - mating_date, - mating_type_id, - preg_date, - lambing_date, - lambing_day, - mating_day, - gestation_day, - expected_date, - post_lambing_day, - lactation_day, - anestrous_day, - mating_counts, - mating_total, - miscarriage_counts, - comment, - controlled, - body, - breast, - source, - source_date, - source_ranch_id, - source_ranch, - update_by, - update_time, - create_by, - create_time, - is_delete, - - - #{id}, - #{bsManageTags}, - #{ranchId}, - #{drRanch}, - #{sheepfoldId}, - #{sheepfoldName}, - #{electronicTags}, - #{varietyId}, - #{variety}, - #{family}, - #{name}, - #{gender}, - #{birthday}, - #{dayAge}, - #{monthAge}, - #{parity}, - #{birthWeight}, - #{weaningDate}, - #{statusId}, - #{weaningWeight}, - #{currentWeight}, - #{breedStatusId}, - #{breed}, - #{bsFatherId}, - #{fatherManageTags}, - #{bsMotherId}, - #{motherManageTags}, - #{receptorId}, - #{receptorManageTags}, - #{fatherFatherId}, - #{grandfatherManageTags}, - #{fatherMotherId}, - #{grandmotherManageTags}, - #{fatherId}, - #{maternalGrandfatherManageTags}, - #{motherId}, - #{maternalGrandmotherManageTags}, - #{matingDate}, - #{matingTypeId}, - #{pregDate}, - #{lambingDate}, - #{lambingDay}, - #{matingDay}, - #{gestationDay}, - #{expectedDate}, - #{postLambingDay}, - #{lactationDay}, - #{anestrousDay}, - #{matingCounts}, - #{matingTotal}, - #{miscarriageCounts}, - #{comment}, - #{controlled}, - #{body}, - #{breast}, - #{source}, - #{sourceDate}, - #{sourceRanchId}, - #{sourceRanch}, - #{updateBy}, - #{updateTime}, - #{createBy}, - #{createTime}, - #{isDelete}, - - - - update sheep_file - - bs_manage_tags = #{bsManageTags}, - ranch_id = #{ranchId}, - dr_ranch = #{drRanch}, - sheepfold_id = #{sheepfoldId}, - sheepfold_name = #{sheepfoldName}, - electronic_tags = #{electronicTags}, - variety_id = #{varietyId}, - variety = #{variety}, - family = #{family}, - name = #{name}, - gender = #{gender}, - birthday = #{birthday}, - day_age = #{dayAge}, - month_age = #{monthAge}, - parity = #{parity}, - birth_weight = #{birthWeight}, - weaning_date = #{weaningDate}, - status_id = #{statusId}, - weaning_weight = #{weaningWeight}, - current_weight = #{currentWeight}, - breed_status_id = #{breedStatusId}, - breed = #{breed}, - bs_father_id = #{bsFatherId}, - father_manage_tags = #{fatherManageTags}, - bs_mother_id = #{bsMotherId}, - mother_manage_tags = #{motherManageTags}, - receptor_id = #{receptorId}, - receptor_manage_tags = #{receptorManageTags}, - father_father_id = #{fatherFatherId}, - grandfather_manage_tags = #{grandfatherManageTags}, - father_mother_id = #{fatherMotherId}, - grandmother_manage_tags = #{grandmotherManageTags}, - father_id = #{fatherId}, - maternal_grandfather_manage_tags = #{maternalGrandfatherManageTags}, - mother_id = #{motherId}, - maternal_grandmother_manage_tags = #{maternalGrandmotherManageTags}, - mating_date = #{matingDate}, - mating_type_id = #{matingTypeId}, - preg_date = #{pregDate}, - lambing_date = #{lambingDate}, - lambing_day = #{lambingDay}, - mating_day = #{matingDay}, - gestation_day = #{gestationDay}, - expected_date = #{expectedDate}, - post_lambing_day = #{postLambingDay}, - lactation_day = #{lactationDay}, - anestrous_day = #{anestrousDay}, - mating_counts = #{matingCounts}, - mating_total = #{matingTotal}, - miscarriage_counts = #{miscarriageCounts}, - comment = #{comment}, - controlled = #{controlled}, - body = #{body}, - breast = #{breast}, - source = #{source}, - source_date = #{sourceDate}, - source_ranch_id = #{sourceRanchId}, - source_ranch = #{sourceRanch}, - update_by = #{updateBy}, - update_time = #{updateTime}, - create_by = #{createBy}, - create_time = #{createTime}, - is_delete = #{isDelete}, - - where id = #{id} - - - delete from sheep_file where id = #{id} - + + - - delete from sheep_file where id in - - #{id} - - + + + + + + + + + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/biosafety/DewormMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/DewormMapper.xml index 91cc932..174f8f3 100644 --- a/zhyc-module/src/main/resources/mapper/biosafety/DewormMapper.xml +++ b/zhyc-module/src/main/resources/mapper/biosafety/DewormMapper.xml @@ -7,12 +7,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -23,7 +25,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, sheep_id, usage_id, variety, sheep_type, gender, month_age, parity, datetime, technical, comment, update_by, update_time, create_by, create_time from sw_deworm + select s.id, sheep_id, usage_id, variety, sheep_type, s.gender, month_age, s.parity,breed, datetime, technical, s.comment, s.update_by, s.update_time, s.create_by, s.create_time, + bs.manage_tags sheep_no + from sw_deworm s + left join bas_sheep bs on s.sheep_id = bs.id - where id = #{id} + where s.id = #{id} - + insert into sw_deworm - - sheep_id, - usage_id, - variety, - sheep_type, - gender, - month_age, - parity, - datetime, - technical, - comment, - update_by, - update_time, - create_by, - create_time, - - - #{sheepId}, - #{usageId}, - #{variety}, - #{sheepType}, - #{gender}, - #{monthAge}, - #{parity}, - #{datetime}, - #{technical}, - #{comment}, - #{updateBy}, - #{updateTime}, - #{createBy}, - #{createTime}, - + (sheep_id, usage_id, variety, sheep_type, gender, month_age, + parity, breed,datetime, technical, comment, + update_by, update_time, create_by, create_time) + values + + (#{d.sheepId}, #{d.usageId}, #{d.variety}, #{d.sheepType}, + #{d.gender}, #{d.monthAge}, #{d.parity},#{d.breed}, #{d.datetime}, + #{d.technical}, #{d.comment}, + #{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime}) + diff --git a/zhyc-module/src/main/resources/mapper/biosafety/DiagnosisMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/DiagnosisMapper.xml index 68cfea1..4063b5e 100644 --- a/zhyc-module/src/main/resources/mapper/biosafety/DiagnosisMapper.xml +++ b/zhyc-module/src/main/resources/mapper/biosafety/DiagnosisMapper.xml @@ -8,10 +8,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + @@ -19,30 +23,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select id, treat_id, sheep_id, datetime, sheep_type, gender, parity, disease_pid, disease_id, result, begindate, enddate, treat_day, sheepfold_id, create_by, create_time from sw_diagnosis + select sd.id, treat_id, sheep_id, sd.datetime, sheep_type, sd.gender,sd.month_age,sd.parity, disease_pid, disease_id, + result, begindate, enddate, treat_day, sd.sheepfold_id, sd.create_by, sd.create_time, + sf.bs_manage_tags sheep_no,sf.sheepfold_name , + s2.name disease_pname,s1.name disease_name + from sw_diagnosis sd + left join sheep_file sf on sf.id = sd.sheep_id + left join sw_disease s1 on sd.disease_id = s1.id + left join sw_disease s2 on sd.disease_pid = s2.id + diff --git a/zhyc-module/src/main/resources/mapper/biosafety/DisinfectMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/DisinfectMapper.xml index 175d4a7..0269e82 100644 --- a/zhyc-module/src/main/resources/mapper/biosafety/DisinfectMapper.xml +++ b/zhyc-module/src/main/resources/mapper/biosafety/DisinfectMapper.xml @@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -20,7 +21,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, sheepfold_id, datetime, technician, way, usage_id, ratio, comment, update_by, update_time, create_by, create_time from sw_disinfect + select sd.id, sheepfold_id, datetime, technician, way, usage_id, ratio, sd.comment, update_by, update_time, create_by, create_time, + ds.sheepfold_name + from sw_disinfect sd + left join da_sheepfold ds on sd.sheepfold_id = ds.id - where id = #{id} + where sd.id = #{id} insert into sw_disinfect - - sheepfold_id, - datetime, - technician, - way, - usage_id, - ratio, - comment, - update_by, - update_time, - create_by, - create_time, - - - #{sheepfoldId}, - #{datetime}, - #{technician}, - #{way}, - #{usageId}, - #{ratio}, - #{comment}, - #{updateBy}, - #{updateTime}, - #{createBy}, - #{createTime}, - + (sheepfold_id, datetime, technician, way, usage_id, ratio, comment, update_by, update_time, create_by, create_time) + values + + (#{d.sheepfoldId}, #{d.datetime}, #{d.technician}, #{d.way}, + #{d.usageId}, #{d.ratio}, #{d.comment}, + #{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime}) + @@ -86,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_by = #{createBy}, create_time = #{createTime}, - where id = #{id} + where sd.id = #{id} diff --git a/zhyc-module/src/main/resources/mapper/biosafety/HealthMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/HealthMapper.xml index 6c5610d..67c9f2d 100644 --- a/zhyc-module/src/main/resources/mapper/biosafety/HealthMapper.xml +++ b/zhyc-module/src/main/resources/mapper/biosafety/HealthMapper.xml @@ -8,13 +8,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - + @@ -24,7 +25,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, datetime, sheep_id, usage_id, variety, sheep_type, gender, month_age, parity, sheepfold_id, technical, comment, update_by, update_time, create_by, create_time from sw_health + select s.id, datetime, sheep_id, usage_id, variety, sheep_type, s.gender, month_age, s.parity, breed, technical, + s.comment, s.update_by, s.update_time, s.create_by, s.create_time, + bs.manage_tags sheep_no + from sw_health s + left join bas_sheep bs on s.sheep_id = bs.id + - where id = #{id} + where s.id = #{id} insert into sw_health - - datetime, - sheep_id, - usage_id, - variety, - sheep_type, - gender, - month_age, - parity, - sheepfold_id, - technical, - comment, - update_by, - update_time, - create_by, - create_time, - - - #{datetime}, - #{sheepId}, - #{usageId}, - #{variety}, - #{sheepType}, - #{gender}, - #{monthAge}, - #{parity}, - #{sheepfoldId}, - #{technical}, - #{comment}, - #{updateBy}, - #{updateTime}, - #{createBy}, - #{createTime}, - + (sheep_id, usage_id, variety, sheep_type, gender, month_age, + parity, breed,datetime, technical, comment, + update_by, update_time, create_by, create_time) + values + + (#{d.sheepId}, #{d.usageId}, #{d.variety}, #{d.sheepType}, + #{d.gender}, #{d.monthAge}, #{d.parity},#{d.breed}, #{d.datetime}, + #{d.technical}, #{d.comment}, + #{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime}) + @@ -89,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" gender = #{gender}, month_age = #{monthAge}, parity = #{parity}, - sheepfold_id = #{sheepfoldId}, + breed = #{breed}, technical = #{technical}, comment = #{comment}, update_by = #{updateBy}, diff --git a/zhyc-module/src/main/resources/mapper/biosafety/ImmunityMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/ImmunityMapper.xml index c7c57a0..3a50922 100644 --- a/zhyc-module/src/main/resources/mapper/biosafety/ImmunityMapper.xml +++ b/zhyc-module/src/main/resources/mapper/biosafety/ImmunityMapper.xml @@ -7,24 +7,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - + - - select id, sheep_id, usage_id, variety, sheep_type, gender, month_age, parity, sheepfold_id, datetime, technical, comment, update_by, update_time, create_by, create_time from sw_immunity + select s.id, datetime, sheep_id, usage_id, variety, sheep_type, s.gender, month_age, s.parity, breed, technical, + s.comment, s.update_by, s.update_time, s.create_by, s.create_time, + bs.manage_tags sheep_no + from sw_immunity s + left join bas_sheep bs on s.sheep_id = bs.id - where id = #{id} + where s.id = #{id} insert into sw_immunity - - sheep_id, - usage_id, - variety, - sheep_type, - gender, - month_age, - parity, - sheepfold_id, - datetime, - technical, - comment, - update_by, - update_time, - create_by, - create_time, - - - #{sheepId}, - #{usageId}, - #{variety}, - #{sheepType}, - #{gender}, - #{monthAge}, - #{parity}, - #{sheepfoldId}, - #{datetime}, - #{technical}, - #{comment}, - #{updateBy}, - #{updateTime}, - #{createBy}, - #{createTime}, - + (sheep_id, usage_id, variety, sheep_type, gender, month_age, + parity, breed,datetime, technical, comment, + update_by, update_time, create_by, create_time) + values + + (#{d.sheepId}, #{d.usageId}, #{d.variety}, #{d.sheepType}, + #{d.gender}, #{d.monthAge}, #{d.parity},#{d.breed}, #{d.datetime}, + #{d.technical}, #{d.comment}, + #{d.updateBy}, #{d.updateTime}, #{d.createBy}, #{d.createTime}) + @@ -90,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" gender = #{gender}, month_age = #{monthAge}, parity = #{parity}, - sheepfold_id = #{sheepfoldId}, + breed = #{breed}, datetime = #{datetime}, technical = #{technical}, comment = #{comment}, diff --git a/zhyc-module/src/main/resources/mapper/biosafety/SwMedicineUsageMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/SwMedicineUsageMapper.xml index 20ce9f6..f86bdef 100644 --- a/zhyc-module/src/main/resources/mapper/biosafety/SwMedicineUsageMapper.xml +++ b/zhyc-module/src/main/resources/mapper/biosafety/SwMedicineUsageMapper.xml @@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, name, use_type, update_by, update_time, create_by, create_time from sw_medicine_usage where id = #{id} @@ -108,7 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + delete from sw_medicine_usage_details where medi_usage = #{mediUsage} diff --git a/zhyc-module/src/main/resources/mapper/biosafety/TreatmentMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/TreatmentMapper.xml index ea9b470..ee496ad 100644 --- a/zhyc-module/src/main/resources/mapper/biosafety/TreatmentMapper.xml +++ b/zhyc-module/src/main/resources/mapper/biosafety/TreatmentMapper.xml @@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -18,7 +19,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -29,7 +32,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, diag_id, sheep_id, variety, sheep_type, month_age, gender, parity, breed, lact_day, gest_day, datetime, disease_id, disease_pid, veterinary, usage_id, comment, update_by, update_time, create_by, create_time from sw_treatment + select t.id, diag_id, sheep_id, variety, sheep_type, month_age, t.gender, t.parity, breed, lact_day, gest_day, datetime, disease_id, disease_pid, veterinary, usage_id, t.comment, t.update_by, t.update_time, t.create_by, t.create_time, + bs.manage_tags, + sd.name disease_name, + sd2.name disease_pname + from sw_treatment t + left join bas_sheep bs on t.sheep_id = bs.id + left join sw_disease sd on t.disease_id = sd.id + left join sw_disease sd2 on t.disease_pid = sd2.id - where id = #{id} + where t.id = #{id} @@ -95,6 +105,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + insert into sw_treatment + (diag_id, sheep_id, variety, sheep_type, month_age, gender, + parity, breed, lact_day, gest_day, datetime, + disease_id, disease_pid, veterinary, usage_id, + comment, update_by, update_time, create_by, create_time) + values + + (#{t.diagId}, #{t.sheepId}, #{t.variety}, #{t.sheepType}, + #{t.monthAge}, #{t.gender}, #{t.parity}, #{t.breed}, + #{t.lactDay}, #{t.gestDay}, #{t.datetime}, #{t.diseaseId}, + #{t.diseasePid}, #{t.veterinary},#{t.usageId}, #{t.comment}, + #{t.updateBy}, #{t.updateTime},#{t.createBy}, #{t.createTime}) + + + update sw_treatment diff --git a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyMeasureMapper.xml b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyMeasureMapper.xml new file mode 100644 index 0000000..e5a2d5e --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyMeasureMapper.xml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select sm.id, + sm.sheep_id, + bs.manage_tags, + sm.height, + sm.bust, + sm.body_length, + sm.pipe_length, + sm.chest_depth, + sm.hip_height, + sm.rump_width, + sm.rump_heignt, + sm.hip_width, + sm.hip_cross_height, + sm.comment, + sm.technician, + sm.create_by, + sm.create_time + from sc_body_measure sm + left join bas_sheep bs on sm.sheep_id = bs.id + + + + + + + + insert into sc_body_measure + + sheep_id, + height, + bust, + body_length, + pipe_length, + chest_depth, + hip_height, + rump_width, + rump_heignt, + hip_width, + hip_cross_height, + comment, + technician, + create_by, + create_time, + + + #{sheepId}, + #{height}, + #{bust}, + #{bodyLength}, + #{pipeLength}, + #{chestDepth}, + #{hipHeight}, + #{rumpWidth}, + #{rumpHeignt}, + #{hipWidth}, + #{hipCrossHeight}, + #{comment}, + #{technician}, + #{createBy}, + #{createTime}, + + + + + update sc_body_measure + + sheep_id = #{sheepId}, + height = #{height}, + bust = #{bust}, + body_length = #{bodyLength}, + pipe_length = #{pipeLength}, + chest_depth = #{chestDepth}, + hip_height = #{hipHeight}, + rump_width = #{rumpWidth}, + rump_heignt = #{rumpHeignt}, + hip_width = #{hipWidth}, + hip_cross_height = #{hipCrossHeight}, + comment = #{comment}, + technician = #{technician}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete + from sc_body_measure + where id = #{id} + + + + delete from sc_body_measure where id in + + #{id} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyScoreMapper.xml b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyScoreMapper.xml new file mode 100644 index 0000000..442f3cf --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBodyScoreMapper.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + select sbs.id, + sbs.sheep_id, + bs.manage_tags, + sbs.datetime, + sbs.score, + sbs.sheepfold, + ds.sheepfold_name as sheepfoldName, + sbs.comment, + sbs.technician, + sbs.create_by, + sbs.create_time + from sc_body_score sbs + left join bas_sheep bs on sbs.sheep_id = bs.id + left join da_sheepfold ds on sbs.sheepfold = ds.id + + + + + + + + insert into sc_body_score + + sheep_id, + datetime, + score, + sheepfold, + comment, + technician, + create_by, + create_time, + + + #{sheepId}, + #{datetime}, + #{score}, + #{sheepfold}, + #{comment}, + #{technician}, + #{createBy}, + #{createTime}, + + + + + update sc_body_score + + sheep_id = #{sheepId}, + datetime = #{datetime}, + score = #{score}, + sheepfold = #{sheepfold}, + comment = #{comment}, + technician = #{technician}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete + from sc_body_score + where id = #{id} + + + + delete from sc_body_score where id in + + #{id} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBreastRatingMapper.xml b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBreastRatingMapper.xml new file mode 100644 index 0000000..f1b6f53 --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/produce/bodyManage/ScBreastRatingMapper.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + select sbr.*, + bs.manage_tags as manageTags + from sc_breast_rating sbr + left join bas_sheep bs on sbr.sheep_id = bs.id + + + + + + + + insert into sc_breast_rating + + sheep_id, + depth, + length, + position, + adbere, + spacing, + score, + comment, + technician, + create_by, + create_time, + + + #{sheepId}, + #{depth}, + #{length}, + #{position}, + #{adbere}, + #{spacing}, + #{score}, + #{comment}, + #{technician}, + #{createBy}, + #{createTime}, + + + + + update sc_breast_rating + + sheep_id = #{sheepId}, + depth = #{depth}, + length = #{length}, + position = #{position}, + adbere = #{adbere}, + spacing = #{spacing}, + score = #{score}, + comment = #{comment}, + technician = #{technician}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete + from sc_breast_rating + where id = #{id} + + + + delete from sc_breast_rating where id in + + #{id} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/produce/breed/ScPregnancyRecordMapper.xml b/zhyc-module/src/main/resources/mapper/produce/breed/ScPregnancyRecordMapper.xml index 7e7175a..3017f1a 100644 --- a/zhyc-module/src/main/resources/mapper/produce/breed/ScPregnancyRecordMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/breed/ScPregnancyRecordMapper.xml @@ -1,60 +1,147 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + + + - + + + + + + + + + + + + + + + + + + - select id, datetime, result, number, technician, way, create_by, create_time from sc_pregnancy_record + select + pr.id, + pr.sheep_id, + pr.datetime, + pr.result, + pr.fetus_count, + pr.technician, + pr.way, + pr.remark, + pr.create_by, + pr.create_time, + pr.create_by, + pr.create_time, + sf.bs_manage_tags as manage_tags, + sf.variety, + sf.month_age, + sf.parity, + sf.mating_counts, + sf.sheepfold_name, + sf.breed, + sf.father_manage_tags, + father_sf.variety as father_variety, + mating_type.dict_label as mating_type_name, + sf.mating_date, + sf.expected_date, + sf.lambing_date as last_event_date, + r.ranch as ranch + from sc_pregnancy_record pr + left join sheep_file sf on pr.sheep_id = sf.id + left join sys_dict_data mating_type on sf.mating_type_id = mating_type.dict_value and mating_type.dict_type = 'breed_type' and mating_type.status = '0' + left join da_ranch r on sf.ranch_id = r.id + left join sheep_file father_sf on sf.bs_father_id = father_sf.id - + + + + insert into sc_pregnancy_record + sheep_id, datetime, result, - number, + fetus_count, technician, way, + remark, create_by, create_time, - + is_delete + + #{sheepId}, #{datetime}, #{result}, - #{number}, + #{fetusCount}, #{technician}, #{way}, + #{remark}, #{createBy}, #{createTime}, - + 0 + @@ -62,23 +149,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" datetime = #{datetime}, result = #{result}, - number = #{number}, + fetus_count = #{fetusCount}, technician = #{technician}, way = #{way}, - create_by = #{createBy}, - create_time = #{createTime}, + remark = #{remark}, + create_by = #{updateBy}, + create_time = #{updateTime}, where id = #{id} - - delete from sc_pregnancy_record where id = #{id} - + + update sc_pregnancy_record set is_delete = 1 where id = #{id} + - - delete from sc_pregnancy_record where id in + + update sc_pregnancy_record set is_delete = 1 where id in #{id} - + + + + + update bas_sheep + + preg_date = #{pregDate}, + breed_status_id = #{breedStatusId}, + expected_date = #{expectedDate}, + gestation_day = #{gestationDay}, + create_time = now() + + where id = #{sheepId} + \ No newline at end of file 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 8a2fdac..a679f11 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 @@ -5,36 +5,34 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - INSERT INTO sc_add_sheep (ear_number, sheepfold, father, mother, born_weight, birthday, gender, parity, variety_id, join_date, comment, technician, create_by, create_time) - VALUES - (#{earNumber}, #{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 - ear_number = #{earNumber}, - sheepfold = #{sheepfold}, - father = #{father}, - mother = #{mother}, - born_weight = #{bornWeight}, - birthday = #{birthday}, - gender = #{gender}, - parity = #{parity}, - variety_id = #{varietyId}, - join_date = #{joinDate}, - comment = #{comment}, - technician = #{technician}, - update_by = #{updateBy}, - update_time = NOW() + ear_number = #{earNumber}, + sheepfold = #{sheepfold}, + father = #{father}, + mother = #{mother}, + born_weight = #{bornWeight}, + birthday = #{birthday}, + gender = #{gender}, + parity = #{parity}, + variety_id = #{varietyId}, + join_date = #{joinDate}, + comment = #{comment}, + technician = #{technician}, + update_by = #{updateBy}, + update_time = NOW() WHERE id = #{id} - DELETE FROM sc_add_sheep WHERE id IN 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 new file mode 100644 index 0000000..df4eaa6 --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeCommentMapper.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + select scc.id, + scc.sheep_id, + bs.manage_tags as manage_tags, + 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 + + + + + + + + insert into sc_change_comment + + sheep_id, + new_comment, + old_comment, + create_by, + create_time, + + + #{sheepId}, + #{newComment}, + #{oldComment}, + #{createBy}, + #{createTime}, + + + + + update sc_change_comment + + sheep_id = #{sheepId}, + new_comment = #{newComment}, + old_comment = #{oldComment}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete + from sc_change_comment + where id = #{id} + + + + delete from sc_change_comment where id in + + #{id} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeEarMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeEarMapper.xml new file mode 100644 index 0000000..337c5db --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeEarMapper.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + select sce.id as sce_id, + sce.sheep_id, + bs.manage_tags as manage_tags, + sce.ear_type, + sce.newTag, + sce.oldTag as oldTag, + sce.comment, + sce.create_by, + sce.create_time + from sc_change_ear sce + LEFT JOIN bas_sheep bs ON sce.sheep_id = bs.id + + + + + + + + insert into sc_change_ear + + sheep_id, + ear_type, + newTag, + oldTag, + comment, + create_by, + create_time, + + + #{sheepId}, + #{earType}, + #{newTag}, + #{oldTag}, + #{comment}, + #{createBy}, + #{createTime}, + + + + + update sc_change_ear + + sheep_id = #{sheepId}, + ear_type = #{earType}, + newTag = #{newTag}, + oldTag = #{oldTag}, + comment = #{comment}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete + from sc_change_ear + where id = #{id} + + + + delete from sc_change_ear where id in + + #{id} + + + \ No newline at end of file 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 new file mode 100644 index 0000000..77cf67f --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScChangeVarietyMapper.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + select scv.id, + scv.sheep_id, + bs.manage_tags as manage_tags, + scv.variety_old, + scv.variety_new, + scv.comment, + scv.create_by, + scv.create_time + from sc_change_variety scv + left join bas_sheep bs on scv.sheep_id = bs.id + + + + + + + + insert into sc_change_variety + + sheep_id, + variety_old, + variety_new, + comment, + create_by, + create_time, + + + #{sheepId}, + #{varietyOld}, + #{varietyNew}, + #{comment}, + #{createBy}, + #{createTime}, + + + + + update sc_change_variety + + sheep_id = #{sheepId}, + variety_old = #{varietyOld}, + variety_new = #{varietyNew}, + comment = #{comment}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete + from sc_change_variety + where id = #{id} + + + + delete from sc_change_variety where id in + + #{id} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransGroupMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransGroupMapper.xml index 93bdee8..f627eac 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransGroupMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransGroupMapper.xml @@ -4,9 +4,11 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + + + @@ -22,6 +24,7 @@ SELECT tg.id, tg.sheep_id, + s.manage_tags AS manageTags, tg.fold_to, tg.fold_from, tg.reason, @@ -33,8 +36,12 @@ tg.create_by, tg.create_time, sf_from.sheepfold_name AS foldFromName, - sf_to.sheepfold_name AS foldToName + sf_to.sheepfold_name AS foldToName, + st.id AS sheepTypeId, + st.name AS sheepTypeName FROM sc_trans_group tg + LEFT JOIN bas_sheep s ON tg.sheep_id = s.id + LEFT JOIN bas_sheep_type st ON s.type_id = st.id 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 LEFT JOIN bas_sheep_variety bv ON tg.variety_id = bv.id @@ -44,12 +51,15 @@ and sheep_id = #{sheepId} + + and s.manage_tags like concat('%', #{manageTags}, '%') + and fold_to = #{foldTo} and fold_from = #{foldFrom} and status = #{status} and tg.variety_id = #{varietyId} - and create_time between #{params.beginCreateTime} and #{params.endCreateTime} + and tg.create_time between #{params.beginCreateTime} and #{params.endCreateTime} diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml index 5b2a4e2..4905687 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/ScTransitionInfoMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -11,7 +11,7 @@ - + @@ -20,27 +20,39 @@ - SELECT t.*, bv.variety AS varietyName, + SELECT t.*, + bv.variety AS varietyName, + bs.manage_tags AS manageTags, CASE t.trans_type - WHEN 0 THEN '内部转场' - WHEN 1 THEN '跨场转场' - WHEN 2 THEN '销售转场' + WHEN 0 THEN '内部调拨' + WHEN 1 THEN '内部销售' + WHEN 2 THEN '育肥调拨' ELSE '未知' - END AS trans_type_text + END AS transTypeText, + CASE t.status + WHEN 0 THEN '待审批' + WHEN 1 THEN '已通过' + WHEN 2 THEN '已驳回' + ELSE '未知状态' + END AS statusText FROM sc_transition_info t LEFT JOIN bas_sheep_variety bv ON t.variety_id = bv.id + LEFT JOIN bas_sheep bs ON t.sheep_id = bs.id @@ -78,6 +90,21 @@ + + INSERT INTO sc_transition_info ( + sheep_id, variety_id, trans_to, trans_from, + trans_type, technician, status, comment, + create_by, create_time + ) VALUES + + ( + #{item.sheepId}, #{item.varietyId}, #{item.transTo}, #{item.transFrom}, + #{item.transType}, #{item.technician}, #{item.status}, #{item.comment}, + #{item.createBy}, now() + ) + + + update sc_transition_info diff --git a/zhyc-module/src/main/resources/mapper/produce/other/ScCastrateMapper.xml b/zhyc-module/src/main/resources/mapper/produce/other/ScCastrateMapper.xml index c861b13..d52dd84 100644 --- a/zhyc-module/src/main/resources/mapper/produce/other/ScCastrateMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/other/ScCastrateMapper.xml @@ -7,9 +7,12 @@ + - + + + @@ -18,15 +21,17 @@ select sc.id, sc.sheep_id, + bs.manage_tags as manageTags, sc.sheepfold, sf.sheepfold_name as sheepfoldName, sc.variety_id, - bv.variety as varietyName, + bv.variety as varietyName, sc.comment, sc.technician, sc.create_by, sc.create_time from sc_castrate sc + left join bas_sheep bs on sc.sheep_id = bs.id left join da_sheepfold sf on sc.sheepfold = sf.id left join bas_sheep_variety bv on sc.variety_id = bv.id @@ -34,16 +39,16 @@ diff --git a/zhyc-module/src/main/resources/mapper/produce/other/ScFixHoofMapper.xml b/zhyc-module/src/main/resources/mapper/produce/other/ScFixHoofMapper.xml index ff66103..4f450ae 100644 --- a/zhyc-module/src/main/resources/mapper/produce/other/ScFixHoofMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/other/ScFixHoofMapper.xml @@ -6,8 +6,9 @@ - + + @@ -17,15 +18,19 @@ select fh.id, - fh.sheep_id, + bs.manage_tags AS manageTags, fh.sheepfold, - sf.sheepfold_name as sheepfoldName, + sf.sheepfold_name AS sheepfoldName, + fh.variety_id, + bv.variety AS varietyName, fh.comment, fh.technician, fh.create_by, fh.create_time from sc_fix_hoof fh + left join bas_sheep bs on fh.sheep_id = bs.id left join da_sheepfold sf on fh.sheepfold = sf.id + left join bas_sheep_variety bv on fh.variety_id = bv.id @@ -44,24 +55,24 @@ where fh.id = #{id} - - insert into sc_fix_hoof - - and fh.sheep_id like concat('%', #{sheepId}, '%') - and fh.sheepfold = #{sheepfold} - comment, - technician, - create_by, - create_time, - - - #{sheepId}, - #{sheepfold}, - #{comment}, - #{technician}, - #{createBy}, - #{createTime}, - + + INSERT INTO sc_fix_hoof + (sheep_id, + sheepfold, + variety_id, + comment, + technician, + create_by, + create_time) + VALUES + (#{sheepId}, + #{sheepfold}, + #{varietyId}, + #{comment}, + #{technician}, + #{createBy}, + #{createTime}) @@ -69,6 +80,7 @@ sheep_id = #{sheepId}, sheepfold = #{sheepfold}, + variety_id=#{varietyId}, comment = #{comment}, technician = #{technician}, create_by = #{createBy}, @@ -89,4 +101,6 @@ #{id} + + \ No newline at end of file