diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/variety/controller/BasSheepVarietyController.java b/zhyc-module/src/main/java/com/zhyc/module/base/variety/controller/BasSheepVarietyController.java new file mode 100644 index 0000000..1c24dfa --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/base/variety/controller/BasSheepVarietyController.java @@ -0,0 +1,104 @@ +package com.zhyc.module.base.variety.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.base.variety.domain.BasSheepVariety; +import com.zhyc.module.base.variety.service.IBasSheepVarietyService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 羊只品种Controller + * + * @author ruoyi + * @date 2025-07-15 + */ +@RestController +@RequestMapping("/base/variety") +public class BasSheepVarietyController extends BaseController +{ + @Autowired + private IBasSheepVarietyService basSheepVarietyService; + + /** + * 查询羊只品种列表 + */ + @PreAuthorize("@ss.hasPermi('base:variety:list')") + @GetMapping("/list") + public TableDataInfo list(BasSheepVariety basSheepVariety) + { + startPage(); + List list = basSheepVarietyService.selectBasSheepVarietyList(basSheepVariety); + return getDataTable(list); + } + + /** + * 导出羊只品种列表 + */ + @PreAuthorize("@ss.hasPermi('base:variety:export')") + @Log(title = "羊只品种", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, BasSheepVariety basSheepVariety) + { + List list = basSheepVarietyService.selectBasSheepVarietyList(basSheepVariety); + ExcelUtil util = new ExcelUtil(BasSheepVariety.class); + util.exportExcel(response, list, "羊只品种数据"); + } + + /** + * 获取羊只品种详细信息 + */ + @PreAuthorize("@ss.hasPermi('base:variety:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(basSheepVarietyService.selectBasSheepVarietyById(id)); + } + + /** + * 新增羊只品种 + */ + @PreAuthorize("@ss.hasPermi('base:variety:add')") + @Log(title = "羊只品种", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody BasSheepVariety basSheepVariety) + { + return toAjax(basSheepVarietyService.insertBasSheepVariety(basSheepVariety)); + } + + /** + * 修改羊只品种 + */ + @PreAuthorize("@ss.hasPermi('base:variety:edit')") + @Log(title = "羊只品种", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody BasSheepVariety basSheepVariety) + { + return toAjax(basSheepVarietyService.updateBasSheepVariety(basSheepVariety)); + } + + /** + * 删除羊只品种 + */ + @PreAuthorize("@ss.hasPermi('base:variety:remove')") + @Log(title = "羊只品种", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(basSheepVarietyService.deleteBasSheepVarietyByIds(ids)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/variety/domain/BasSheepVariety.java b/zhyc-module/src/main/java/com/zhyc/module/base/variety/domain/BasSheepVariety.java new file mode 100644 index 0000000..35a541a --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/base/variety/domain/BasSheepVariety.java @@ -0,0 +1,52 @@ +package com.zhyc.module.base.variety.domain; + +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_variety + * + * @author ruoyi + * @date 2025-07-15 + */ +public class BasSheepVariety extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** 品种 */ + @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/variety/mapper/BasSheepVarietyMapper.java b/zhyc-module/src/main/java/com/zhyc/module/base/variety/mapper/BasSheepVarietyMapper.java new file mode 100644 index 0000000..02927cb --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/base/variety/mapper/BasSheepVarietyMapper.java @@ -0,0 +1,61 @@ +package com.zhyc.module.base.variety.mapper; + +import java.util.List; +import com.zhyc.module.base.variety.domain.BasSheepVariety; + +/** + * 羊只品种Mapper接口 + * + * @author ruoyi + * @date 2025-07-15 + */ +public interface BasSheepVarietyMapper +{ + /** + * 查询羊只品种 + * + * @param id 羊只品种主键 + * @return 羊只品种 + */ + public BasSheepVariety selectBasSheepVarietyById(Long id); + + /** + * 查询羊只品种列表 + * + * @param basSheepVariety 羊只品种 + * @return 羊只品种集合 + */ + public List selectBasSheepVarietyList(BasSheepVariety basSheepVariety); + + /** + * 新增羊只品种 + * + * @param basSheepVariety 羊只品种 + * @return 结果 + */ + public int insertBasSheepVariety(BasSheepVariety basSheepVariety); + + /** + * 修改羊只品种 + * + * @param basSheepVariety 羊只品种 + * @return 结果 + */ + public int updateBasSheepVariety(BasSheepVariety basSheepVariety); + + /** + * 删除羊只品种 + * + * @param id 羊只品种主键 + * @return 结果 + */ + public int deleteBasSheepVarietyById(Long id); + + /** + * 批量删除羊只品种 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBasSheepVarietyByIds(Long[] ids); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/variety/service/IBasSheepVarietyService.java b/zhyc-module/src/main/java/com/zhyc/module/base/variety/service/IBasSheepVarietyService.java new file mode 100644 index 0000000..f2fc713 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/base/variety/service/IBasSheepVarietyService.java @@ -0,0 +1,61 @@ +package com.zhyc.module.base.variety.service; + +import java.util.List; +import com.zhyc.module.base.variety.domain.BasSheepVariety; + +/** + * 羊只品种Service接口 + * + * @author ruoyi + * @date 2025-07-15 + */ +public interface IBasSheepVarietyService +{ + /** + * 查询羊只品种 + * + * @param id 羊只品种主键 + * @return 羊只品种 + */ + public BasSheepVariety selectBasSheepVarietyById(Long id); + + /** + * 查询羊只品种列表 + * + * @param basSheepVariety 羊只品种 + * @return 羊只品种集合 + */ + public List selectBasSheepVarietyList(BasSheepVariety basSheepVariety); + + /** + * 新增羊只品种 + * + * @param basSheepVariety 羊只品种 + * @return 结果 + */ + public int insertBasSheepVariety(BasSheepVariety basSheepVariety); + + /** + * 修改羊只品种 + * + * @param basSheepVariety 羊只品种 + * @return 结果 + */ + public int updateBasSheepVariety(BasSheepVariety basSheepVariety); + + /** + * 批量删除羊只品种 + * + * @param ids 需要删除的羊只品种主键集合 + * @return 结果 + */ + public int deleteBasSheepVarietyByIds(Long[] ids); + + /** + * 删除羊只品种信息 + * + * @param id 羊只品种主键 + * @return 结果 + */ + public int deleteBasSheepVarietyById(Long id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/base/variety/service/impl/BasSheepVarietyServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/base/variety/service/impl/BasSheepVarietyServiceImpl.java new file mode 100644 index 0000000..beacc22 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/base/variety/service/impl/BasSheepVarietyServiceImpl.java @@ -0,0 +1,93 @@ +package com.zhyc.module.base.variety.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.base.variety.mapper.BasSheepVarietyMapper; +import com.zhyc.module.base.variety.domain.BasSheepVariety; +import com.zhyc.module.base.variety.service.IBasSheepVarietyService; + +/** + * 羊只品种Service业务层处理 + * + * @author ruoyi + * @date 2025-07-15 + */ +@Service +public class BasSheepVarietyServiceImpl implements IBasSheepVarietyService +{ + @Autowired + private BasSheepVarietyMapper basSheepVarietyMapper; + + /** + * 查询羊只品种 + * + * @param id 羊只品种主键 + * @return 羊只品种 + */ + @Override + public BasSheepVariety selectBasSheepVarietyById(Long id) + { + return basSheepVarietyMapper.selectBasSheepVarietyById(id); + } + + /** + * 查询羊只品种列表 + * + * @param basSheepVariety 羊只品种 + * @return 羊只品种 + */ + @Override + public List selectBasSheepVarietyList(BasSheepVariety basSheepVariety) + { + return basSheepVarietyMapper.selectBasSheepVarietyList(basSheepVariety); + } + + /** + * 新增羊只品种 + * + * @param basSheepVariety 羊只品种 + * @return 结果 + */ + @Override + public int insertBasSheepVariety(BasSheepVariety basSheepVariety) + { + return basSheepVarietyMapper.insertBasSheepVariety(basSheepVariety); + } + + /** + * 修改羊只品种 + * + * @param basSheepVariety 羊只品种 + * @return 结果 + */ + @Override + public int updateBasSheepVariety(BasSheepVariety basSheepVariety) + { + return basSheepVarietyMapper.updateBasSheepVariety(basSheepVariety); + } + + /** + * 批量删除羊只品种 + * + * @param ids 需要删除的羊只品种主键 + * @return 结果 + */ + @Override + public int deleteBasSheepVarietyByIds(Long[] ids) + { + return basSheepVarietyMapper.deleteBasSheepVarietyByIds(ids); + } + + /** + * 删除羊只品种信息 + * + * @param id 羊只品种主键 + * @return 结果 + */ + @Override + public int deleteBasSheepVarietyById(Long id) + { + return basSheepVarietyMapper.deleteBasSheepVarietyById(id); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/QuarantineItemsController.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/QuarantineItemsController.java new file mode 100644 index 0000000..3c1694a --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/QuarantineItemsController.java @@ -0,0 +1,105 @@ +package com.zhyc.module.biosafety.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.zhyc.module.biosafety.domain.QuarantineItems; +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.biosafety.service.IQuarantineItemsService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 检疫项目Controller + * + * @author ruoyi + * @date 2025-07-14 + */ +@RestController +@RequestMapping("/biosafety/items") +public class QuarantineItemsController extends BaseController +{ + @Autowired + private IQuarantineItemsService quarantineItemsService; + + /** + * 查询检疫项目列表 + */ + @PreAuthorize("@ss.hasPermi('biosafety:items:list')") + @GetMapping("/list") + public TableDataInfo list(QuarantineItems quarantineItems) + { + startPage(); + List list = quarantineItemsService.selectQuarantineItemsList(quarantineItems); + return getDataTable(list); + } + + /** + * 导出检疫项目列表 + */ + @PreAuthorize("@ss.hasPermi('biosafety:items:export')") + @Log(title = "检疫项目", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QuarantineItems quarantineItems) + { + List list = quarantineItemsService.selectQuarantineItemsList(quarantineItems); + ExcelUtil util = new ExcelUtil(QuarantineItems.class); + util.exportExcel(response, list, "检疫项目数据"); + } + + /** + * 获取检疫项目详细信息 + */ + @PreAuthorize("@ss.hasPermi('biosafety:items:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(quarantineItemsService.selectQuarantineItemsById(id)); + } + + /** + * 新增检疫项目 + */ + @PreAuthorize("@ss.hasPermi('biosafety:items:add')") + @Log(title = "检疫项目", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QuarantineItems quarantineItems) + { + return toAjax(quarantineItemsService.insertQuarantineItems(quarantineItems)); + } + + /** + * 修改检疫项目 + */ + @PreAuthorize("@ss.hasPermi('biosafety:items:edit')") + @Log(title = "检疫项目", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QuarantineItems quarantineItems) + { + return toAjax(quarantineItemsService.updateQuarantineItems(quarantineItems)); + } + + /** + * 删除检疫项目 + */ + @PreAuthorize("@ss.hasPermi('biosafety:items:remove')") + @Log(title = "检疫项目", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(quarantineItemsService.deleteQuarantineItemsByIds(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 new file mode 100644 index 0000000..5c6847e --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/QuarantineReportController.java @@ -0,0 +1,105 @@ +package com.zhyc.module.biosafety.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.zhyc.module.biosafety.domain.QuarantineReport; +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.biosafety.service.IQuarantineReportService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 检疫记录Controller + * + * @author ruoyi + * @date 2025-07-14 + */ +@RestController +@RequestMapping("/bisosafety/quarantine") +public class QuarantineReportController extends BaseController +{ + @Autowired + private IQuarantineReportService quarantineReportService; + + /** + * 查询检疫记录列表 + */ + @PreAuthorize("@ss.hasPermi('bisosafety:quarantine:list')") + @GetMapping("/list") + public TableDataInfo list(QuarantineReport quarantineReport) + { + startPage(); + List list = quarantineReportService.selectQuarantineReportList(quarantineReport); + return getDataTable(list); + } + + /** + * 导出检疫记录列表 + */ + @PreAuthorize("@ss.hasPermi('bisosafety:quarantine:export')") + @Log(title = "检疫记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QuarantineReport quarantineReport) + { + List list = quarantineReportService.selectQuarantineReportList(quarantineReport); + ExcelUtil util = new ExcelUtil(QuarantineReport.class); + util.exportExcel(response, list, "检疫记录数据"); + } + + /** + * 获取检疫记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('bisosafety:quarantine:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(quarantineReportService.selectQuarantineReportById(id)); + } + + /** + * 新增检疫记录 + */ + @PreAuthorize("@ss.hasPermi('bisosafety:quarantine:add')") + @Log(title = "检疫记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QuarantineReport quarantineReport) + { + return toAjax(quarantineReportService.insertQuarantineReport(quarantineReport)); + } + + /** + * 修改检疫记录 + */ + @PreAuthorize("@ss.hasPermi('bisosafety:quarantine:edit')") + @Log(title = "检疫记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QuarantineReport quarantineReport) + { + return toAjax(quarantineReportService.updateQuarantineReport(quarantineReport)); + } + + /** + * 删除检疫记录 + */ + @PreAuthorize("@ss.hasPermi('bisosafety:quarantine:remove')") + @Log(title = "检疫记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(quarantineReportService.deleteQuarantineReportByIds(ids)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/QuarantineSampleController.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/QuarantineSampleController.java new file mode 100644 index 0000000..439d3fb --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/controller/QuarantineSampleController.java @@ -0,0 +1,105 @@ +package com.zhyc.module.biosafety.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.zhyc.module.biosafety.domain.QuarantineSample; +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.biosafety.service.IQuarantineSampleService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 样品类型Controller + * + * @author ruoyi + * @date 2025-07-14 + */ +@RestController +@RequestMapping("/biosafety/sample") +public class QuarantineSampleController extends BaseController +{ + @Autowired + private IQuarantineSampleService quarantineSampleService; + + /** + * 查询样品类型列表 + */ + @PreAuthorize("@ss.hasPermi('biosafety:sample:list')") + @GetMapping("/list") + public TableDataInfo list(QuarantineSample quarantineSample) + { + startPage(); + List list = quarantineSampleService.selectQuarantineSampleList(quarantineSample); + return getDataTable(list); + } + + /** + * 导出样品类型列表 + */ + @PreAuthorize("@ss.hasPermi('biosafety:sample:export')") + @Log(title = "样品类型", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QuarantineSample quarantineSample) + { + List list = quarantineSampleService.selectQuarantineSampleList(quarantineSample); + ExcelUtil util = new ExcelUtil(QuarantineSample.class); + util.exportExcel(response, list, "样品类型数据"); + } + + /** + * 获取样品类型详细信息 + */ + @PreAuthorize("@ss.hasPermi('biosafety:sample:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(quarantineSampleService.selectQuarantineSampleById(id)); + } + + /** + * 新增样品类型 + */ + @PreAuthorize("@ss.hasPermi('biosafety:sample:add')") + @Log(title = "样品类型", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QuarantineSample quarantineSample) + { + return toAjax(quarantineSampleService.insertQuarantineSample(quarantineSample)); + } + + /** + * 修改样品类型 + */ + @PreAuthorize("@ss.hasPermi('biosafety:sample:edit')") + @Log(title = "样品类型", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QuarantineSample quarantineSample) + { + return toAjax(quarantineSampleService.updateQuarantineSample(quarantineSample)); + } + + /** + * 删除样品类型 + */ + @PreAuthorize("@ss.hasPermi('biosafety:sample:remove')") + @Log(title = "样品类型", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(quarantineSampleService.deleteQuarantineSampleByIds(ids)); + } +} 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 new file mode 100644 index 0000000..eb57ab0 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineItems.java @@ -0,0 +1,52 @@ +package com.zhyc.module.biosafety.domain; + +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; + +/** + * 检疫项目对象 sw_quarantine_items + * + * @author ruoyi + * @date 2025-07-14 + */ +public class QuarantineItems extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long id; + + /** 名称 */ + @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 new file mode 100644 index 0000000..bd70445 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineReport.java @@ -0,0 +1,83 @@ +package com.zhyc.module.biosafety.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +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.apache.ibatis.type.Alias; + +/** + * 检疫记录对象 sw_quarantine_report + * + * @author ruoyi + * @date 2025-07-14 + */ +@Data +@Alias("QuarantineReport") +public class QuarantineReport extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long id; + + /** 羊只 */ + private Long sheepId; + + @Excel(name = "羊只耳号") + private String sheepNo; + @Excel(name = "羊只类别") + private String sheepType; + @Excel(name = "羊只性别") + private String gender; + @Excel(name = "月龄") + private Integer monthAge; + @Excel(name = "胎次") + private Integer parity; + @Excel(name = "繁育状态") + private String breed; + + + /** 检疫日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "检疫日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date datetime; + + /** 检疫项目 */ + + private Long quarItem; + + /** 检疫项目 */ + @Excel(name = "检疫项目") + private String itemName; + + + /** 样品类型 */ + private Long sampleType; + + /** 样品 */ + @Excel(name = "样品类型") + private Long sample; + + + /** 采样员 */ + @Excel(name = "采样员") + private String sampler; + + /** 检疫员 */ + @Excel(name = "检疫员") + private String quarOfficer; + + /** 检疫结果 */ + @Excel(name = "检疫结果") + private Long result; + + /** 状态 */ + @Excel(name = "状态") + private Long status; + + +} 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 new file mode 100644 index 0000000..e9e3ba3 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/domain/QuarantineSample.java @@ -0,0 +1,52 @@ +package com.zhyc.module.biosafety.domain; + +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; + +/** + * 样品类型对象 sw_quarantine_sample + * + * @author ruoyi + * @date 2025-07-14 + */ +public class QuarantineSample extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long id; + + /** 样品类型 */ + @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/mapper/QuarantineItemsMapper.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineItemsMapper.java new file mode 100644 index 0000000..3f4dd36 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineItemsMapper.java @@ -0,0 +1,62 @@ +package com.zhyc.module.biosafety.mapper; + +import java.util.List; + +import com.zhyc.module.biosafety.domain.QuarantineItems; + +/** + * 检疫项目Mapper接口 + * + * @author ruoyi + * @date 2025-07-14 + */ +public interface QuarantineItemsMapper +{ + /** + * 查询检疫项目 + * + * @param id 检疫项目主键 + * @return 检疫项目 + */ + public QuarantineItems selectQuarantineItemsById(Long id); + + /** + * 查询检疫项目列表 + * + * @param quarantineItems 检疫项目 + * @return 检疫项目集合 + */ + public List selectQuarantineItemsList(QuarantineItems quarantineItems); + + /** + * 新增检疫项目 + * + * @param quarantineItems 检疫项目 + * @return 结果 + */ + public int insertQuarantineItems(QuarantineItems quarantineItems); + + /** + * 修改检疫项目 + * + * @param quarantineItems 检疫项目 + * @return 结果 + */ + public int updateQuarantineItems(QuarantineItems quarantineItems); + + /** + * 删除检疫项目 + * + * @param id 检疫项目主键 + * @return 结果 + */ + public int deleteQuarantineItemsById(Long id); + + /** + * 批量删除检疫项目 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQuarantineItemsByIds(Long[] ids); +} 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 new file mode 100644 index 0000000..b913852 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineReportMapper.java @@ -0,0 +1,62 @@ +package com.zhyc.module.biosafety.mapper; + +import java.util.List; + +import com.zhyc.module.biosafety.domain.QuarantineReport; + +/** + * 检疫记录Mapper接口 + * + * @author ruoyi + * @date 2025-07-14 + */ +public interface QuarantineReportMapper +{ + /** + * 查询检疫记录 + * + * @param id 检疫记录主键 + * @return 检疫记录 + */ + public QuarantineReport selectQuarantineReportById(Long id); + + /** + * 查询检疫记录列表 + * + * @param quarantineReport 检疫记录 + * @return 检疫记录集合 + */ + public List selectQuarantineReportList(QuarantineReport quarantineReport); + + /** + * 新增检疫记录 + * + * @param quarantineReport 检疫记录 + * @return 结果 + */ + public int insertQuarantineReport(QuarantineReport quarantineReport); + + /** + * 修改检疫记录 + * + * @param quarantineReport 检疫记录 + * @return 结果 + */ + public int updateQuarantineReport(QuarantineReport quarantineReport); + + /** + * 删除检疫记录 + * + * @param id 检疫记录主键 + * @return 结果 + */ + public int deleteQuarantineReportById(Long id); + + /** + * 批量删除检疫记录 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQuarantineReportByIds(Long[] ids); +} 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 new file mode 100644 index 0000000..76ce1d7 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/mapper/QuarantineSampleMapper.java @@ -0,0 +1,62 @@ +package com.zhyc.module.biosafety.mapper; + +import java.util.List; + +import com.zhyc.module.biosafety.domain.QuarantineSample; + +/** + * 样品类型Mapper接口 + * + * @author ruoyi + * @date 2025-07-14 + */ +public interface QuarantineSampleMapper +{ + /** + * 查询样品类型 + * + * @param id 样品类型主键 + * @return 样品类型 + */ + public QuarantineSample selectQuarantineSampleById(Long id); + + /** + * 查询样品类型列表 + * + * @param quarantineSample 样品类型 + * @return 样品类型集合 + */ + public List selectQuarantineSampleList(QuarantineSample quarantineSample); + + /** + * 新增样品类型 + * + * @param quarantineSample 样品类型 + * @return 结果 + */ + public int insertQuarantineSample(QuarantineSample quarantineSample); + + /** + * 修改样品类型 + * + * @param quarantineSample 样品类型 + * @return 结果 + */ + public int updateQuarantineSample(QuarantineSample quarantineSample); + + /** + * 删除样品类型 + * + * @param id 样品类型主键 + * @return 结果 + */ + public int deleteQuarantineSampleById(Long id); + + /** + * 批量删除样品类型 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteQuarantineSampleByIds(Long[] ids); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/IQuarantineItemsService.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/IQuarantineItemsService.java new file mode 100644 index 0000000..59bbad1 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/IQuarantineItemsService.java @@ -0,0 +1,62 @@ +package com.zhyc.module.biosafety.service; + +import java.util.List; + +import com.zhyc.module.biosafety.domain.QuarantineItems; + +/** + * 检疫项目Service接口 + * + * @author ruoyi + * @date 2025-07-14 + */ +public interface IQuarantineItemsService +{ + /** + * 查询检疫项目 + * + * @param id 检疫项目主键 + * @return 检疫项目 + */ + public QuarantineItems selectQuarantineItemsById(Long id); + + /** + * 查询检疫项目列表 + * + * @param quarantineItems 检疫项目 + * @return 检疫项目集合 + */ + public List selectQuarantineItemsList(QuarantineItems quarantineItems); + + /** + * 新增检疫项目 + * + * @param quarantineItems 检疫项目 + * @return 结果 + */ + public int insertQuarantineItems(QuarantineItems quarantineItems); + + /** + * 修改检疫项目 + * + * @param quarantineItems 检疫项目 + * @return 结果 + */ + public int updateQuarantineItems(QuarantineItems quarantineItems); + + /** + * 批量删除检疫项目 + * + * @param ids 需要删除的检疫项目主键集合 + * @return 结果 + */ + public int deleteQuarantineItemsByIds(Long[] ids); + + /** + * 删除检疫项目信息 + * + * @param id 检疫项目主键 + * @return 结果 + */ + public int deleteQuarantineItemsById(Long id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/IQuarantineReportService.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/IQuarantineReportService.java new file mode 100644 index 0000000..2aaeb26 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/IQuarantineReportService.java @@ -0,0 +1,62 @@ +package com.zhyc.module.biosafety.service; + +import java.util.List; + +import com.zhyc.module.biosafety.domain.QuarantineReport; + +/** + * 检疫记录Service接口 + * + * @author ruoyi + * @date 2025-07-14 + */ +public interface IQuarantineReportService +{ + /** + * 查询检疫记录 + * + * @param id 检疫记录主键 + * @return 检疫记录 + */ + public QuarantineReport selectQuarantineReportById(Long id); + + /** + * 查询检疫记录列表 + * + * @param quarantineReport 检疫记录 + * @return 检疫记录集合 + */ + public List selectQuarantineReportList(QuarantineReport quarantineReport); + + /** + * 新增检疫记录 + * + * @param quarantineReport 检疫记录 + * @return 结果 + */ + public int insertQuarantineReport(QuarantineReport quarantineReport); + + /** + * 修改检疫记录 + * + * @param quarantineReport 检疫记录 + * @return 结果 + */ + public int updateQuarantineReport(QuarantineReport quarantineReport); + + /** + * 批量删除检疫记录 + * + * @param ids 需要删除的检疫记录主键集合 + * @return 结果 + */ + public int deleteQuarantineReportByIds(Long[] ids); + + /** + * 删除检疫记录信息 + * + * @param id 检疫记录主键 + * @return 结果 + */ + public int deleteQuarantineReportById(Long id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/IQuarantineSampleService.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/IQuarantineSampleService.java new file mode 100644 index 0000000..5741045 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/IQuarantineSampleService.java @@ -0,0 +1,62 @@ +package com.zhyc.module.biosafety.service; + +import java.util.List; + +import com.zhyc.module.biosafety.domain.QuarantineSample; + +/** + * 样品类型Service接口 + * + * @author ruoyi + * @date 2025-07-14 + */ +public interface IQuarantineSampleService +{ + /** + * 查询样品类型 + * + * @param id 样品类型主键 + * @return 样品类型 + */ + public QuarantineSample selectQuarantineSampleById(Long id); + + /** + * 查询样品类型列表 + * + * @param quarantineSample 样品类型 + * @return 样品类型集合 + */ + public List selectQuarantineSampleList(QuarantineSample quarantineSample); + + /** + * 新增样品类型 + * + * @param quarantineSample 样品类型 + * @return 结果 + */ + public int insertQuarantineSample(QuarantineSample quarantineSample); + + /** + * 修改样品类型 + * + * @param quarantineSample 样品类型 + * @return 结果 + */ + public int updateQuarantineSample(QuarantineSample quarantineSample); + + /** + * 批量删除样品类型 + * + * @param ids 需要删除的样品类型主键集合 + * @return 结果 + */ + public int deleteQuarantineSampleByIds(Long[] ids); + + /** + * 删除样品类型信息 + * + * @param id 样品类型主键 + * @return 结果 + */ + public int deleteQuarantineSampleById(Long id); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/QuarantineItemsServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/QuarantineItemsServiceImpl.java new file mode 100644 index 0000000..541a759 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/QuarantineItemsServiceImpl.java @@ -0,0 +1,94 @@ +package com.zhyc.module.biosafety.service.impl; + +import java.util.List; + +import com.zhyc.module.biosafety.domain.QuarantineItems; +import com.zhyc.module.biosafety.mapper.QuarantineItemsMapper; +import com.zhyc.module.biosafety.service.IQuarantineItemsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 检疫项目Service业务层处理 + * + * @author ruoyi + * @date 2025-07-14 + */ +@Service +public class QuarantineItemsServiceImpl implements IQuarantineItemsService +{ + @Autowired + private QuarantineItemsMapper quarantineItemsMapper; + + /** + * 查询检疫项目 + * + * @param id 检疫项目主键 + * @return 检疫项目 + */ + @Override + public QuarantineItems selectQuarantineItemsById(Long id) + { + return quarantineItemsMapper.selectQuarantineItemsById(id); + } + + /** + * 查询检疫项目列表 + * + * @param quarantineItems 检疫项目 + * @return 检疫项目 + */ + @Override + public List selectQuarantineItemsList(QuarantineItems quarantineItems) + { + return quarantineItemsMapper.selectQuarantineItemsList(quarantineItems); + } + + /** + * 新增检疫项目 + * + * @param quarantineItems 检疫项目 + * @return 结果 + */ + @Override + public int insertQuarantineItems(QuarantineItems quarantineItems) + { + return quarantineItemsMapper.insertQuarantineItems(quarantineItems); + } + + /** + * 修改检疫项目 + * + * @param quarantineItems 检疫项目 + * @return 结果 + */ + @Override + public int updateQuarantineItems(QuarantineItems quarantineItems) + { + return quarantineItemsMapper.updateQuarantineItems(quarantineItems); + } + + /** + * 批量删除检疫项目 + * + * @param ids 需要删除的检疫项目主键 + * @return 结果 + */ + @Override + public int deleteQuarantineItemsByIds(Long[] ids) + { + return quarantineItemsMapper.deleteQuarantineItemsByIds(ids); + } + + /** + * 删除检疫项目信息 + * + * @param id 检疫项目主键 + * @return 结果 + */ + @Override + public int deleteQuarantineItemsById(Long id) + { + return quarantineItemsMapper.deleteQuarantineItemsById(id); + } +} 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 new file mode 100644 index 0000000..7c693f5 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/QuarantineReportServiceImpl.java @@ -0,0 +1,96 @@ +package com.zhyc.module.biosafety.service.impl; + +import java.util.List; +import com.zhyc.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.biosafety.mapper.QuarantineReportMapper; +import com.zhyc.module.biosafety.domain.QuarantineReport; +import com.zhyc.module.biosafety.service.IQuarantineReportService; + +/** + * 检疫记录Service业务层处理 + * + * @author ruoyi + * @date 2025-07-14 + */ +@Service +public class QuarantineReportServiceImpl implements IQuarantineReportService +{ + @Autowired + private QuarantineReportMapper quarantineReportMapper; + + /** + * 查询检疫记录 + * + * @param id 检疫记录主键 + * @return 检疫记录 + */ + @Override + public QuarantineReport selectQuarantineReportById(Long id) + { + return quarantineReportMapper.selectQuarantineReportById(id); + } + + /** + * 查询检疫记录列表 + * + * @param quarantineReport 检疫记录 + * @return 检疫记录 + */ + @Override + public List selectQuarantineReportList(QuarantineReport quarantineReport) + { + return quarantineReportMapper.selectQuarantineReportList(quarantineReport); + } + + /** + * 新增检疫记录 + * + * @param quarantineReport 检疫记录 + * @return 结果 + */ + @Override + public int insertQuarantineReport(QuarantineReport quarantineReport) + { + quarantineReport.setCreateTime(DateUtils.getNowDate()); + return quarantineReportMapper.insertQuarantineReport(quarantineReport); + } + + /** + * 修改检疫记录 + * + * @param quarantineReport 检疫记录 + * @return 结果 + */ + @Override + public int updateQuarantineReport(QuarantineReport quarantineReport) + { + quarantineReport.setUpdateTime(DateUtils.getNowDate()); + return quarantineReportMapper.updateQuarantineReport(quarantineReport); + } + + /** + * 批量删除检疫记录 + * + * @param ids 需要删除的检疫记录主键 + * @return 结果 + */ + @Override + public int deleteQuarantineReportByIds(Long[] ids) + { + return quarantineReportMapper.deleteQuarantineReportByIds(ids); + } + + /** + * 删除检疫记录信息 + * + * @param id 检疫记录主键 + * @return 结果 + */ + @Override + public int deleteQuarantineReportById(Long id) + { + return quarantineReportMapper.deleteQuarantineReportById(id); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/QuarantineSampleServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/QuarantineSampleServiceImpl.java new file mode 100644 index 0000000..6ac853d --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/biosafety/service/impl/QuarantineSampleServiceImpl.java @@ -0,0 +1,93 @@ +package com.zhyc.module.biosafety.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.biosafety.mapper.QuarantineSampleMapper; +import com.zhyc.module.biosafety.domain.QuarantineSample; +import com.zhyc.module.biosafety.service.IQuarantineSampleService; + +/** + * 样品类型Service业务层处理 + * + * @author ruoyi + * @date 2025-07-14 + */ +@Service +public class QuarantineSampleServiceImpl implements IQuarantineSampleService +{ + @Autowired + private QuarantineSampleMapper quarantineSampleMapper; + + /** + * 查询样品类型 + * + * @param id 样品类型主键 + * @return 样品类型 + */ + @Override + public QuarantineSample selectQuarantineSampleById(Long id) + { + return quarantineSampleMapper.selectQuarantineSampleById(id); + } + + /** + * 查询样品类型列表 + * + * @param quarantineSample 样品类型 + * @return 样品类型 + */ + @Override + public List selectQuarantineSampleList(QuarantineSample quarantineSample) + { + return quarantineSampleMapper.selectQuarantineSampleList(quarantineSample); + } + + /** + * 新增样品类型 + * + * @param quarantineSample 样品类型 + * @return 结果 + */ + @Override + public int insertQuarantineSample(QuarantineSample quarantineSample) + { + return quarantineSampleMapper.insertQuarantineSample(quarantineSample); + } + + /** + * 修改样品类型 + * + * @param quarantineSample 样品类型 + * @return 结果 + */ + @Override + public int updateQuarantineSample(QuarantineSample quarantineSample) + { + return quarantineSampleMapper.updateQuarantineSample(quarantineSample); + } + + /** + * 批量删除样品类型 + * + * @param ids 需要删除的样品类型主键 + * @return 结果 + */ + @Override + public int deleteQuarantineSampleByIds(Long[] ids) + { + return quarantineSampleMapper.deleteQuarantineSampleByIds(ids); + } + + /** + * 删除样品类型信息 + * + * @param id 样品类型主键 + * @return 结果 + */ + @Override + public int deleteQuarantineSampleById(Long id) + { + return quarantineSampleMapper.deleteQuarantineSampleById(id); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/group_management/controller/BasSheepGroupController.java b/zhyc-module/src/main/java/com/zhyc/module/group_management/controller/BasSheepGroupController.java new file mode 100644 index 0000000..167dd65 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/group_management/controller/BasSheepGroupController.java @@ -0,0 +1,102 @@ +package com.zhyc.module.group_management.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.group_management.domain.BasSheepGroup; +import com.zhyc.module.group_management.service.IBasSheepGroupService; +import com.zhyc.common.utils.poi.ExcelUtil; + +/** + * 分组管理Controller + * + * @author wyt + * @date 2025-07-14 + */ +@RestController +@RequestMapping("/group_management/group_management") +public class BasSheepGroupController extends BaseController +{ + @Autowired + private IBasSheepGroupService basSheepGroupService; + + /** + * 查询分组管理列表 + */ + @PreAuthorize("@ss.hasPermi('group_management:group_management:list')") + @GetMapping("/list") + public AjaxResult list(BasSheepGroup basSheepGroup) + { + List list = basSheepGroupService.selectBasSheepGroupList(basSheepGroup); + return success(list); + } + + /** + * 导出分组管理列表 + */ + @PreAuthorize("@ss.hasPermi('group_management:group_management:export')") + @Log(title = "分组管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, BasSheepGroup basSheepGroup) + { + List list = basSheepGroupService.selectBasSheepGroupList(basSheepGroup); + ExcelUtil util = new ExcelUtil(BasSheepGroup.class); + util.exportExcel(response, list, "分组管理数据"); + } + + /** + * 获取分组管理详细信息 + */ + @PreAuthorize("@ss.hasPermi('group_management:group_management:query')") + @GetMapping(value = "/{groupId}") + public AjaxResult getInfo(@PathVariable("groupId") Long groupId) + { + return success(basSheepGroupService.selectBasSheepGroupByGroupId(groupId)); + } + + /** + * 新增分组管理 + */ + @PreAuthorize("@ss.hasPermi('group_management:group_management:add')") + @Log(title = "分组管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody BasSheepGroup basSheepGroup) + { + return toAjax(basSheepGroupService.insertBasSheepGroup(basSheepGroup)); + } + + /** + * 修改分组管理 + */ + @PreAuthorize("@ss.hasPermi('group_management:group_management:edit')") + @Log(title = "分组管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody BasSheepGroup basSheepGroup) + { + return toAjax(basSheepGroupService.updateBasSheepGroup(basSheepGroup)); + } + + /** + * 删除分组管理 + */ + @PreAuthorize("@ss.hasPermi('group_management:group_management:remove')") + @Log(title = "分组管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{groupIds}") + public AjaxResult remove(@PathVariable Long[] groupIds) + { + return toAjax(basSheepGroupService.deleteBasSheepGroupByGroupIds(groupIds)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/group_management/domain/BasSheepGroup.java b/zhyc-module/src/main/java/com/zhyc/module/group_management/domain/BasSheepGroup.java new file mode 100644 index 0000000..09ac54e --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/group_management/domain/BasSheepGroup.java @@ -0,0 +1,74 @@ +package com.zhyc.module.group_management.domain; + +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.TreeEntity; + +/** + * 分组管理对象 bas_sheep_group + * + * @author wyt + * @date 2025-07-14 + */ +public class BasSheepGroup extends TreeEntity +{ + private static final long serialVersionUID = 1L; + + /** 分组ID */ + @Excel(name = "分组ID") + private Long groupId; + + /** 分组名称 */ + @Excel(name = "分组名称") + private String groupName; + + /** 状态(0正常 1停用) */ + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private String status; + + 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("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/group_management/mapper/BasSheepGroupMapper.java b/zhyc-module/src/main/java/com/zhyc/module/group_management/mapper/BasSheepGroupMapper.java new file mode 100644 index 0000000..d3b2bf0 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/group_management/mapper/BasSheepGroupMapper.java @@ -0,0 +1,61 @@ +package com.zhyc.module.group_management.mapper; + +import java.util.List; +import com.zhyc.module.group_management.domain.BasSheepGroup; + +/** + * 分组管理Mapper接口 + * + * @author wyt + * @date 2025-07-14 + */ +public interface BasSheepGroupMapper +{ + /** + * 查询分组管理 + * + * @param groupId 分组管理主键 + * @return 分组管理 + */ + public BasSheepGroup selectBasSheepGroupByGroupId(Long groupId); + + /** + * 查询分组管理列表 + * + * @param basSheepGroup 分组管理 + * @return 分组管理集合 + */ + public List selectBasSheepGroupList(BasSheepGroup basSheepGroup); + + /** + * 新增分组管理 + * + * @param basSheepGroup 分组管理 + * @return 结果 + */ + public int insertBasSheepGroup(BasSheepGroup basSheepGroup); + + /** + * 修改分组管理 + * + * @param basSheepGroup 分组管理 + * @return 结果 + */ + public int updateBasSheepGroup(BasSheepGroup basSheepGroup); + + /** + * 删除分组管理 + * + * @param groupId 分组管理主键 + * @return 结果 + */ + public int deleteBasSheepGroupByGroupId(Long groupId); + + /** + * 批量删除分组管理 + * + * @param groupIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBasSheepGroupByGroupIds(Long[] groupIds); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/group_management/service/IBasSheepGroupService.java b/zhyc-module/src/main/java/com/zhyc/module/group_management/service/IBasSheepGroupService.java new file mode 100644 index 0000000..ec68f13 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/group_management/service/IBasSheepGroupService.java @@ -0,0 +1,61 @@ +package com.zhyc.module.group_management.service; + +import java.util.List; +import com.zhyc.module.group_management.domain.BasSheepGroup; + +/** + * 分组管理Service接口 + * + * @author wyt + * @date 2025-07-14 + */ +public interface IBasSheepGroupService +{ + /** + * 查询分组管理 + * + * @param groupId 分组管理主键 + * @return 分组管理 + */ + public BasSheepGroup selectBasSheepGroupByGroupId(Long groupId); + + /** + * 查询分组管理列表 + * + * @param basSheepGroup 分组管理 + * @return 分组管理集合 + */ + public List selectBasSheepGroupList(BasSheepGroup basSheepGroup); + + /** + * 新增分组管理 + * + * @param basSheepGroup 分组管理 + * @return 结果 + */ + public int insertBasSheepGroup(BasSheepGroup basSheepGroup); + + /** + * 修改分组管理 + * + * @param basSheepGroup 分组管理 + * @return 结果 + */ + public int updateBasSheepGroup(BasSheepGroup basSheepGroup); + + /** + * 批量删除分组管理 + * + * @param groupIds 需要删除的分组管理主键集合 + * @return 结果 + */ + public int deleteBasSheepGroupByGroupIds(Long[] groupIds); + + /** + * 删除分组管理信息 + * + * @param groupId 分组管理主键 + * @return 结果 + */ + public int deleteBasSheepGroupByGroupId(Long groupId); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/group_management/service/impl/BasSheepGroupServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/group_management/service/impl/BasSheepGroupServiceImpl.java new file mode 100644 index 0000000..9543e9e --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/group_management/service/impl/BasSheepGroupServiceImpl.java @@ -0,0 +1,96 @@ +package com.zhyc.module.group_management.service.impl; + +import java.util.List; +import com.zhyc.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.group_management.mapper.BasSheepGroupMapper; +import com.zhyc.module.group_management.domain.BasSheepGroup; +import com.zhyc.module.group_management.service.IBasSheepGroupService; + +/** + * 分组管理Service业务层处理 + * + * @author wyt + * @date 2025-07-14 + */ +@Service +public class BasSheepGroupServiceImpl implements IBasSheepGroupService +{ + @Autowired + private BasSheepGroupMapper basSheepGroupMapper; + + /** + * 查询分组管理 + * + * @param groupId 分组管理主键 + * @return 分组管理 + */ + @Override + public BasSheepGroup selectBasSheepGroupByGroupId(Long groupId) + { + return basSheepGroupMapper.selectBasSheepGroupByGroupId(groupId); + } + + /** + * 查询分组管理列表 + * + * @param basSheepGroup 分组管理 + * @return 分组管理 + */ + @Override + public List selectBasSheepGroupList(BasSheepGroup basSheepGroup) + { + return basSheepGroupMapper.selectBasSheepGroupList(basSheepGroup); + } + + /** + * 新增分组管理 + * + * @param basSheepGroup 分组管理 + * @return 结果 + */ + @Override + public int insertBasSheepGroup(BasSheepGroup basSheepGroup) + { + basSheepGroup.setCreateTime(DateUtils.getNowDate()); + return basSheepGroupMapper.insertBasSheepGroup(basSheepGroup); + } + + /** + * 修改分组管理 + * + * @param basSheepGroup 分组管理 + * @return 结果 + */ + @Override + public int updateBasSheepGroup(BasSheepGroup basSheepGroup) + { + basSheepGroup.setUpdateTime(DateUtils.getNowDate()); + return basSheepGroupMapper.updateBasSheepGroup(basSheepGroup); + } + + /** + * 批量删除分组管理 + * + * @param groupIds 需要删除的分组管理主键 + * @return 结果 + */ + @Override + public int deleteBasSheepGroupByGroupIds(Long[] groupIds) + { + return basSheepGroupMapper.deleteBasSheepGroupByGroupIds(groupIds); + } + + /** + * 删除分组管理信息 + * + * @param groupId 分组管理主键 + * @return 结果 + */ + @Override + public int deleteBasSheepGroupByGroupId(Long groupId) + { + return basSheepGroupMapper.deleteBasSheepGroupByGroupId(groupId); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/ScLambingRecordController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/ScLambingRecordController.java index 77bc4c0..04bce38 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/ScLambingRecordController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/controller/ScLambingRecordController.java @@ -24,24 +24,20 @@ import com.zhyc.common.core.page.TableDataInfo; /** * 产羔记录Controller - * - * @author ruoyi - * @date 2025-07-11 */ @RestController @RequestMapping("/breed/lambing_records") -public class ScLambingRecordController extends BaseController -{ +public class ScLambingRecordController extends BaseController { + @Autowired private IScLambingRecordService scLambingRecordService; /** - * 查询产羔记录列表(包含关联信息) + * 查询产羔记录列表 */ @PreAuthorize("@ss.hasPermi('breed:lambing_records:list')") @GetMapping("/list") - public TableDataInfo list(ScLambingRecord scLambingRecord) - { + public TableDataInfo list(ScLambingRecord scLambingRecord) { startPage(); List list = scLambingRecordService.selectScLambingRecordList(scLambingRecord); return getDataTable(list); @@ -53,8 +49,7 @@ public class ScLambingRecordController extends BaseController @PreAuthorize("@ss.hasPermi('breed:lambing_records:export')") @Log(title = "产羔记录", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, ScLambingRecord scLambingRecord) - { + public void export(HttpServletResponse response, ScLambingRecord scLambingRecord) { List list = scLambingRecordService.selectScLambingRecordList(scLambingRecord); ExcelUtil util = new ExcelUtil(ScLambingRecord.class); util.exportExcel(response, list, "产羔记录数据"); @@ -65,41 +60,41 @@ public class ScLambingRecordController extends BaseController */ @PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { + public AjaxResult getInfo(@PathVariable("id") Long id) { return success(scLambingRecordService.selectScLambingRecordById(id)); } - /** - * 获取产羔记录详细信息(包含关联信息) - */ - @PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") - @GetMapping(value = "/detail/{id}") - public AjaxResult getDetailInfo(@PathVariable("id") Long id) - { - return success(scLambingRecordService.selectScLambingRecordDetailById(id)); - } - - /** - * 查询产羔详情(羔羊信息列表) - */ - @PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") - @GetMapping("/lamb_detail/{lambingRecordId}") - public AjaxResult getLambDetail(@PathVariable("lambingRecordId") Long lambingRecordId) - { - List list = scLambingRecordService.selectLambDetailByLambingRecordId(lambingRecordId); - return success(list); - } - /** * 新增产羔记录(包含羔羊详情) */ @PreAuthorize("@ss.hasPermi('breed:lambing_records:add')") @Log(title = "产羔记录", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody ScLambingRecord scLambingRecord) - { - return toAjax(scLambingRecordService.insertScLambingRecord(scLambingRecord)); + public AjaxResult add(@RequestBody ScLambingRecord scLambingRecord) { + try { + // 设置创建人 + scLambingRecord.setCreateBy(getUsername()); + + // 如果没有设置创建时间,使用当前时间 + if (scLambingRecord.getCreateTime() == null) { + scLambingRecord.setCreateTime(new java.util.Date()); + } + + int result = scLambingRecordService.insertScLambingRecord(scLambingRecord); + + if (result > 0) { + String message = "新增产羔记录成功"; + if (scLambingRecord.getLambDetails() != null && !scLambingRecord.getLambDetails().isEmpty()) { + message += ",同时录入了 " + scLambingRecord.getLambDetails().size() + " 只羔羊详情"; + } + return success(message); + } else { + return error("新增产羔记录失败"); + } + } catch (Exception e) { + logger.error("新增产羔记录异常", e); + return error("新增产羔记录失败:" + e.getMessage()); + } } /** @@ -108,9 +103,15 @@ public class ScLambingRecordController extends BaseController @PreAuthorize("@ss.hasPermi('breed:lambing_records:edit')") @Log(title = "产羔记录", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody ScLambingRecord scLambingRecord) - { - return toAjax(scLambingRecordService.updateScLambingRecord(scLambingRecord)); + public AjaxResult edit(@RequestBody ScLambingRecord scLambingRecord) { + try { + scLambingRecord.setUpdateBy(getUsername()); + scLambingRecord.setUpdateTime(new java.util.Date()); + return toAjax(scLambingRecordService.updateScLambingRecord(scLambingRecord)); + } catch (Exception e) { + logger.error("修改产羔记录异常", e); + return error("修改产羔记录失败:" + e.getMessage()); + } } /** @@ -119,19 +120,27 @@ public class ScLambingRecordController extends BaseController @PreAuthorize("@ss.hasPermi('breed:lambing_records:remove')") @Log(title = "产羔记录", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { - return toAjax(scLambingRecordService.deleteScLambingRecordByIds(ids)); + public AjaxResult remove(@PathVariable Long[] ids) { + try { + return toAjax(scLambingRecordService.deleteScLambingRecordByIds(ids)); + } catch (Exception e) { + logger.error("删除产羔记录异常", e); + return error("删除产羔记录失败:" + e.getMessage()); + } } /** - * 批量新增羔羊详情 + * 查询羔羊详情 */ - @PreAuthorize("@ss.hasPermi('breed:lambing_records:add')") - @Log(title = "羔羊详情", businessType = BusinessType.INSERT) - @PostMapping("/lamb_details/batch") - public AjaxResult addLambDetailsBatch(@RequestBody List lambDetails) - { - return toAjax(scLambingRecordService.insertLambDetailsBatch(lambDetails)); + @PreAuthorize("@ss.hasPermi('breed:lambing_records:query')") + @GetMapping("/lamb_detail/{lambingRecordId}") + public AjaxResult getLambDetail(@PathVariable("lambingRecordId") Long lambingRecordId) { + try { + List lambDetails = scLambingRecordService.selectLambDetailByLambingRecordId(lambingRecordId); + return success(lambDetails); + } catch (Exception e) { + logger.error("查询羔羊详情异常", e); + return error("查询羔羊详情失败:" + e.getMessage()); + } } } \ 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 27973a6..f2bcb3a 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 @@ -2,6 +2,8 @@ package com.zhyc.module.produce.breed.domain; import java.math.BigDecimal; 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; @@ -29,13 +31,13 @@ public class ScLambDetail extends BaseEntity @Excel(name = "羔羊耳号") private String lambEarNumber; - /** 羔羊品种 */ - @Excel(name = "羔羊品种") - private String lambBreed; + /** 羔羊品种ID */ + @Excel(name = "羔羊品种ID") + private Integer lambBreed; // 改为Integer类型,存储品种ID /** 性别 */ @Excel(name = "性别") - private String gender; + private Integer gender; /** 出生重量 */ @Excel(name = "出生重量") @@ -54,6 +56,23 @@ public class ScLambDetail extends BaseEntity @Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd") private Date birthday; + private List lambDetails; + + /** 母羊ID */ + private Long motherId; + + /** 父羊ID */ + private Long fatherId; + + /** 牧场ID */ + private Integer ranchId; + + /** 羊舍ID */ + private Integer sheepfoldId; + + /** 胎次 */ + private Integer parity; + // getter和setter方法 public void setId(Long id) { @@ -85,22 +104,22 @@ public class ScLambDetail extends BaseEntity return lambEarNumber; } - public void setLambBreed(String lambBreed) + public void setLambBreed(Integer lambBreed) // 改为Integer类型 { this.lambBreed = lambBreed; } - public String getLambBreed() + public Integer getLambBreed() // 改为Integer类型 { return lambBreed; } - public void setGender(String gender) + public void setGender(Integer gender) { this.gender = gender; } - public String getGender() + public Integer getGender() { return gender; } @@ -145,6 +164,66 @@ public class ScLambDetail extends BaseEntity 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) @@ -160,4 +239,4 @@ public class ScLambDetail extends BaseEntity .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 5aebf45..895ad55 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 @@ -50,9 +50,9 @@ public class ScLambingRecord extends BaseEntity private String comment; /** 创建日期 */ - @JsonFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd") - private Date createTme; + private Date createTime; // 改为 createTime // ========== 关联查询字段(简化版) ========== @@ -124,6 +124,8 @@ public class ScLambingRecord extends BaseEntity /** 羔羊信息列表(从羊只信息表查询) */ private List lambInfoList; + private List lambDetails; + // ========== 原有getter和setter方法 ========== public void setId(Long id) @@ -206,14 +208,14 @@ public class ScLambingRecord extends BaseEntity return comment; } - public void setCreateTme(Date createTme) + public void setCreateTime(Date createTime) { - this.createTme = createTme; + this.createTime = createTime; } - public Date getCreateTme() + public Date getCreateTime() { - return createTme; + return createTime; } // ========== 简化版关联字段的getter和setter方法 ========== @@ -282,6 +284,7 @@ public class ScLambingRecord extends BaseEntity this.maleBreed = maleBreed; } + public Integer getPregnancyDays() { return pregnancyDays; } @@ -354,6 +357,14 @@ public class ScLambingRecord extends BaseEntity this.lambInfoList = lambInfoList; } + public List getLambDetails() { + return lambDetails; + } + + public void setLambDetails(List lambDetails) { + this.lambDetails = lambDetails; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -366,7 +377,7 @@ public class ScLambingRecord extends BaseEntity .append("score", getScore()) .append("comment", getComment()) .append("createBy", getCreateBy()) - .append("createTme", getCreateTme()) + .append("createTime", getCreateTime()) // 改为 createTime .append("femaleEarNumber", getFemaleEarNumber()) .append("femaleBreed", getFemaleBreed()) .append("farm", getFarm()) @@ -380,7 +391,7 @@ public class ScLambingRecord extends BaseEntity class SheepLambInfo { private String lambEarNumber; // 羔羊耳号 private String lambBreed; // 羔羊品种 - private String gender; // 性别 + private Integer gender; // 性别 private Double birthWeight; // 出生重量 private Boolean isRetained; // 是否留养 private String lineage; // 家系 diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScLambDetailMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScLambDetailMapper.java index c562ae2..2ba02de 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScLambDetailMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/mapper/ScLambDetailMapper.java @@ -2,84 +2,62 @@ package com.zhyc.module.produce.breed.mapper; import java.util.List; import com.zhyc.module.produce.breed.domain.ScLambDetail; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 羔羊详情Mapper接口 - * - * @author ruoyi - * @date 2025-07-11 */ -public interface ScLambDetailMapper -{ - /** - * 查询羔羊详情 - * - * @param id 羔羊详情主键 - * @return 羔羊详情 - */ - public ScLambDetail selectScLambDetailById(Long id); +@Mapper +public interface ScLambDetailMapper { /** * 查询羔羊详情列表 - * - * @param scLambDetail 羔羊详情 - * @return 羔羊详情集合 */ public List selectScLambDetailList(ScLambDetail scLambDetail); - /** - * 根据产羔记录ID查询羔羊详情列表 - * - * @param lambingRecordId 产羔记录ID - * @return 羔羊详情集合 - */ - public List selectScLambDetailByLambingRecordId(Long lambingRecordId); - /** * 新增羔羊详情 - * - * @param scLambDetail 羔羊详情 - * @return 结果 */ public int insertScLambDetail(ScLambDetail scLambDetail); - + public int insertBasSheep(ScLambDetail scLambDetail); /** * 批量新增羔羊详情 - * - * @param lambDetails 羔羊详情列表 - * @return 结果 */ - public int insertScLambDetailBatch(List lambDetails); - + public int insertScLambDetailBatch(@Param("list") List scLambDetailList); + public int insertBasSheepBatch(@Param("list") List scLambDetailList); /** * 修改羔羊详情 - * - * @param scLambDetail 羔羊详情 - * @return 结果 */ public int updateScLambDetail(ScLambDetail scLambDetail); /** * 删除羔羊详情 - * - * @param id 羔羊详情主键 - * @return 结果 */ public int deleteScLambDetailById(Long id); /** * 批量删除羔羊详情 - * - * @param ids 需要删除的数据主键集合 - * @return 结果 */ public int deleteScLambDetailByIds(Long[] ids); /** * 根据产羔记录ID删除羔羊详情 - * - * @param lambingRecordId 产羔记录ID - * @return 结果 */ public int deleteScLambDetailByLambingRecordId(Long lambingRecordId); + + /** + * 查询羔羊详情 + */ + public ScLambDetail selectScLambDetailById(Long id); + + /** + * 根据产羔记录ID查询羔羊详情列表 + */ + public List selectScLambDetailByLambingRecordId(Long lambingRecordId); + + /** + * 检查羔羊耳号是否已存在 + */ + public int checkLambEarNumberExists(@Param("lambEarNumber") String lambEarNumber, @Param("excludeId") Long excludeId); } \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/IScLambingRecordService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/IScLambingRecordService.java index 16338a9..83a6497 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/IScLambingRecordService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/IScLambingRecordService.java @@ -6,81 +6,41 @@ import com.zhyc.module.produce.breed.domain.ScLambDetail; /** * 产羔记录Service接口 - * - * @author ruoyi - * @date 2025-07-11 */ -public interface IScLambingRecordService -{ - /** - * 查询产羔记录 - * - * @param id 产羔记录主键 - * @return 产羔记录 - */ - public ScLambingRecord selectScLambingRecordById(Long id); +public interface IScLambingRecordService { /** - * 查询产羔记录列表(包含关联信息) - * - * @param scLambingRecord 产羔记录 - * @return 产羔记录集合 + * 查询产羔记录列表 */ public List selectScLambingRecordList(ScLambingRecord scLambingRecord); - /** - * 查询产羔记录详细信息(包含关联信息) - * - * @param id 产羔记录主键 - * @return 产羔记录 - */ - public ScLambingRecord selectScLambingRecordDetailById(Long id); - /** * 新增产羔记录(包含羔羊详情) - * - * @param scLambingRecord 产羔记录 - * @return 结果 */ public int insertScLambingRecord(ScLambingRecord scLambingRecord); /** * 修改产羔记录 - * - * @param scLambingRecord 产羔记录 - * @return 结果 */ public int updateScLambingRecord(ScLambingRecord scLambingRecord); /** * 批量删除产羔记录 - * - * @param ids 需要删除的产羔记录主键集合 - * @return 结果 */ public int deleteScLambingRecordByIds(Long[] ids); /** * 删除产羔记录信息 - * - * @param id 产羔记录主键 - * @return 结果 */ public int deleteScLambingRecordById(Long id); /** - * 根据产羔记录ID查询羔羊详情列表 - * - * @param lambingRecordId 产羔记录ID - * @return 羔羊详情列表 + * 查询产羔记录 */ - public List selectLambDetailByLambingRecordId(Long lambingRecordId); + public ScLambingRecord selectScLambingRecordById(Long id); /** - * 批量新增羔羊详情 - * - * @param lambDetails 羔羊详情列表 - * @return 结果 + * 查询羔羊详情 */ - public int insertLambDetailsBatch(List lambDetails); + public List selectLambDetailByLambingRecordId(Long lambingRecordId); } \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/impl/ScLambingRecordServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/impl/ScLambingRecordServiceImpl.java index 2f0998a..74b6715 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/impl/ScLambingRecordServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/breed/service/impl/ScLambingRecordServiceImpl.java @@ -1,112 +1,192 @@ package com.zhyc.module.produce.breed.service.impl; +import java.math.BigDecimal; import java.util.List; - -import com.zhyc.module.produce.breed.domain.ScLambDetail; 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.ScLambingRecordMapper; +import com.zhyc.module.produce.breed.mapper.ScLambDetailMapper; import com.zhyc.module.produce.breed.domain.ScLambingRecord; +import com.zhyc.module.produce.breed.domain.ScLambDetail; import com.zhyc.module.produce.breed.service.IScLambingRecordService; -import java.util.Collections; /** * 产羔记录Service业务层处理 - * - * @author ruoyi - * @date 2025-07-11 */ @Service -public class ScLambingRecordServiceImpl implements IScLambingRecordService -{ +public class ScLambingRecordServiceImpl implements IScLambingRecordService { + @Autowired private ScLambingRecordMapper scLambingRecordMapper; - /** - * 查询产羔记录 - * - * @param id 产羔记录主键 - * @return 产羔记录 - */ - @Override - public ScLambingRecord selectScLambingRecordById(Long id) - { - return scLambingRecordMapper.selectScLambingRecordById(id); - } + @Autowired + private ScLambDetailMapper scLambDetailMapper; /** * 查询产羔记录列表 - * - * @param scLambingRecord 产羔记录 - * @return 产羔记录 */ @Override - public List selectScLambingRecordList(ScLambingRecord scLambingRecord) - { + public List selectScLambingRecordList(ScLambingRecord scLambingRecord) { return scLambingRecordMapper.selectScLambingRecordList(scLambingRecord); } + /** + * 新增产羔记录(包含羔羊详情) + */ @Override - public ScLambingRecord selectScLambingRecordDetailById(Long id) { - return null; + @Transactional + public int insertScLambingRecord(ScLambingRecord scLambingRecord) { + // 1. 插入产羔记录 + int result = scLambingRecordMapper.insertScLambingRecord(scLambingRecord); + + // 2. 如果有羔羊详情,则批量插入羔羊详情 + if (scLambingRecord.getLambDetails() != null && !scLambingRecord.getLambDetails().isEmpty()) { + insertLambDetails(scLambingRecord); + } + + return result; } /** - * 新增产羔记录 - * - * @param scLambingRecord 产羔记录 - * @return 结果 + * 批量插入羔羊详情 */ - @Override - public int insertScLambingRecord(ScLambingRecord scLambingRecord) - { - return scLambingRecordMapper.insertScLambingRecord(scLambingRecord); + private void insertLambDetails(ScLambingRecord scLambingRecord) { + // 遍历羔羊详情列表,逐个插入 + for (ScLambDetail lambDetail : scLambingRecord.getLambDetails()) { + // 设置产羔记录ID + lambDetail.setLambingRecordId(scLambingRecord.getId()); + + // 设置创建信息 + lambDetail.setCreateBy(scLambingRecord.getCreateBy()); + lambDetail.setCreateTime(scLambingRecord.getCreateTime()); + + // 数据验证和转换 + validateAndConvertLambDetail(lambDetail); + + // 插入羔羊详情 + scLambDetailMapper.insertScLambDetail(lambDetail); + scLambDetailMapper.insertBasSheep(lambDetail); + } + } + + + + /** + * 验证和转换羔羊详情 + */ + /** + * 验证和转换羔羊详情 + */ + private void validateAndConvertLambDetail(ScLambDetail lambDetail) { + // 验证必填字段 + if (lambDetail.getLambEarNumber() == null || lambDetail.getLambEarNumber().trim().isEmpty()) { + throw new RuntimeException("羔羊耳号不能为空"); + } + + if (lambDetail.getGender() == null) { // 改为检查Integer类型 + throw new RuntimeException("羔羊性别不能为空"); + } + + // 验证性别值的有效性(假设0=母羊,1=公羊) + if (lambDetail.getGender() < 0 || lambDetail.getGender() > 1) { + throw new RuntimeException("羔羊性别值无效,请使用0(母羊)或1(公羊)"); + } + + // 检查耳号是否已存在 + int count = scLambDetailMapper.checkLambEarNumberExists(lambDetail.getLambEarNumber().trim(), null); + if (count > 0) { + throw new RuntimeException("羔羊耳号 [" + lambDetail.getLambEarNumber() + "] 已存在,请使用其他耳号"); + } + + // 设置默认值 + if (lambDetail.getIsRetained() == null) { + lambDetail.setIsRetained(false); + } + + if (lambDetail.getBirthday() == null) { + lambDetail.setBirthday(new java.util.Date()); + } + + // 处理体重(前端可能传来的是number类型) + if (lambDetail.getBirthWeight() == null) { + lambDetail.setBirthWeight(BigDecimal.ZERO); + } + + // 验证品种ID + if (lambDetail.getLambBreed() == null) { + throw new RuntimeException("羔羊品种不能为空"); + } + + // 去除空格 + lambDetail.setLambEarNumber(lambDetail.getLambEarNumber().trim()); + if (lambDetail.getLineage() != null) { + lambDetail.setLineage(lambDetail.getLineage().trim()); + } } /** * 修改产羔记录 - * - * @param scLambingRecord 产羔记录 - * @return 结果 */ @Override - public int updateScLambingRecord(ScLambingRecord scLambingRecord) - { - return scLambingRecordMapper.updateScLambingRecord(scLambingRecord); + @Transactional + public int updateScLambingRecord(ScLambingRecord scLambingRecord) { + // 更新产羔记录 + int result = scLambingRecordMapper.updateScLambingRecord(scLambingRecord); + + // 如果包含羔羊详情,先删除原有的,再插入新的 + if (scLambingRecord.getLambDetails() != null) { + // 删除原有羔羊详情 + scLambDetailMapper.deleteScLambDetailByLambingRecordId(scLambingRecord.getId()); + + // 插入新的羔羊详情 + if (!scLambingRecord.getLambDetails().isEmpty()) { + insertLambDetails(scLambingRecord); + } + } + + return result; } /** * 批量删除产羔记录 - * - * @param ids 需要删除的产羔记录主键 - * @return 结果 */ @Override - public int deleteScLambingRecordByIds(Long[] ids) - { + @Transactional + public int deleteScLambingRecordByIds(Long[] ids) { + // 先删除关联的羔羊详情 + for (Long id : ids) { + scLambDetailMapper.deleteScLambDetailByLambingRecordId(id); + } + // 再删除产羔记录 return scLambingRecordMapper.deleteScLambingRecordByIds(ids); } /** * 删除产羔记录信息 - * - * @param id 产羔记录主键 - * @return 结果 */ @Override - public int deleteScLambingRecordById(Long id) - { + @Transactional + public int deleteScLambingRecordById(Long id) { + // 先删除关联的羔羊详情 + scLambDetailMapper.deleteScLambDetailByLambingRecordId(id); + // 再删除产羔记录 return scLambingRecordMapper.deleteScLambingRecordById(id); } + /** + * 查询产羔记录 + */ + @Override + public ScLambingRecord selectScLambingRecordById(Long id) { + return scLambingRecordMapper.selectScLambingRecordById(id); + } + /** + * 查询羔羊详情 + */ @Override public List selectLambDetailByLambingRecordId(Long lambingRecordId) { - return Collections.emptyList(); + return scLambDetailMapper.selectScLambDetailByLambingRecordId(lambingRecordId); } - - @Override - public int insertLambDetailsBatch(List lambDetails) { - return 0; - } -} +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/wean/controller/ScWeanRecordController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/wean/controller/ScWeanRecordController.java new file mode 100644 index 0000000..79c05c5 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/wean/controller/ScWeanRecordController.java @@ -0,0 +1,161 @@ +package com.zhyc.module.produce.wean.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.wean.domain.ScWeanRecord; +import com.zhyc.module.produce.wean.service.IScWeanRecordService; +import com.zhyc.common.utils.poi.ExcelUtil; +import com.zhyc.common.core.page.TableDataInfo; + +/** + * 断奶记录Controller + * + * @author zhyc + * @date 2024-01-01 + */ +@RestController +@RequestMapping("/Weaning/weaning_record") +public class ScWeanRecordController extends BaseController { + @Autowired + private IScWeanRecordService scWeanRecordService; + + /** + * 查询断奶记录列表 + */ + @PreAuthorize("@ss.hasPermi('Weaning:weaning_record:list')") + @GetMapping("/list") + public TableDataInfo list(ScWeanRecord scWeanRecord) { + startPage(); + List list = scWeanRecordService.selectScWeanRecordList(scWeanRecord); + return getDataTable(list); + } + + /** + * 导出断奶记录列表 + */ + @PreAuthorize("@ss.hasPermi('Weaning:weaning_record:export')") + @Log(title = "断奶记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ScWeanRecord scWeanRecord) { + List list = scWeanRecordService.selectScWeanRecordList(scWeanRecord); + ExcelUtil util = new ExcelUtil(ScWeanRecord.class); + util.exportExcel(response, list, "断奶记录数据"); + } + + /** + * 获取断奶记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('Weaning:weaning_record:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return success(scWeanRecordService.selectScWeanRecordById(id)); + } + + /** + * 根据耳号查询羊只ID + */ + @PreAuthorize("@ss.hasPermi('Weaning:weaning_record:query')") + @GetMapping(value = "/sheepId/{earNumber}") + public AjaxResult getSheepIdByEarNumber(@PathVariable("earNumber") String earNumber) { + Long sheepId = scWeanRecordService.selectSheepIdByEarNumber(earNumber); + if (sheepId != null) { + return success(sheepId); + } else { + return error("未找到对应的羊只信息"); + } + } + + /** + * 新增断奶记录 + */ + @PreAuthorize("@ss.hasPermi('Weaning:weaning_record:add')") + @Log(title = "断奶记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ScWeanRecord scWeanRecord) { + // 验证耳号是否存在 + if (scWeanRecord.getEarNumber() != null) { + Long sheepId = scWeanRecordService.selectSheepIdByEarNumber(scWeanRecord.getEarNumber()); + if (sheepId == null) { + return error("耳号不存在,请检查后重新输入"); + } + scWeanRecord.setSheepId(sheepId); + } + + // 验证必要字段 + if (scWeanRecord.getSheepId() == null) { + return error("羊只信息不能为空"); + } + if (scWeanRecord.getDatetime() == null) { + return error("断奶日期不能为空"); + } + if (scWeanRecord.getWeight() == null) { + return error("断奶重量不能为空"); + } + if (scWeanRecord.getStatus() == null) { + return error("是否留养不能为空"); + } + + scWeanRecord.setCreateBy(getUsername()); + return toAjax(scWeanRecordService.insertScWeanRecord(scWeanRecord)); + } + + /** + * 修改断奶记录 + */ + @PreAuthorize("@ss.hasPermi('Weaning:weaning_record:edit')") + @Log(title = "断奶记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ScWeanRecord scWeanRecord) { + // 验证耳号是否存在 + if (scWeanRecord.getEarNumber() != null) { + Long sheepId = scWeanRecordService.selectSheepIdByEarNumber(scWeanRecord.getEarNumber()); + if (sheepId == null) { + return error("耳号不存在,请检查后重新输入"); + } + scWeanRecord.setSheepId(sheepId); + } + + // 验证必要字段 + if (scWeanRecord.getId() == null) { + return error("记录ID不能为空"); + } + if (scWeanRecord.getSheepId() == null) { + return error("羊只信息不能为空"); + } + if (scWeanRecord.getDatetime() == null) { + return error("断奶日期不能为空"); + } + if (scWeanRecord.getWeight() == null) { + return error("断奶重量不能为空"); + } + if (scWeanRecord.getStatus() == null) { + return error("是否留养不能为空"); + } + + return toAjax(scWeanRecordService.updateScWeanRecord(scWeanRecord)); + } + + /** + * 删除断奶记录 + */ + @PreAuthorize("@ss.hasPermi('Weaning:weaning_record:remove')") + @Log(title = "断奶记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(scWeanRecordService.deleteScWeanRecordByIds(ids)); + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/wean/domain/ScWeanRecord.java b/zhyc-module/src/main/java/com/zhyc/module/produce/wean/domain/ScWeanRecord.java new file mode 100644 index 0000000..1d11f7d --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/wean/domain/ScWeanRecord.java @@ -0,0 +1,262 @@ +package com.zhyc.module.produce.wean.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.zhyc.common.annotation.Excel; +import com.zhyc.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 断奶记录对象 sc_wean_record + * + * @author zhyc + * @date 2024-01-01 + */ +public class ScWeanRecord extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 羊只ID */ + @Excel(name = "羊只ID") + private Long sheepId; + + /** 断奶日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "断奶日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date datetime; + + /** 断奶重量 */ + @Excel(name = "断奶重量") + private BigDecimal weight; + + /** 是否留养 */ + @Excel(name = "是否留养") + private String status; + + /** 技术员 */ + @Excel(name = "技术员") + private String technician; + + /** 备注 */ + @Excel(name = "备注") + private String comment; + + /** 电子耳号 */ + @Excel(name = "电子耳号") + private String electronicTags; + + // 关联查询字段 + /** 耳号 */ + @Excel(name = "耳号") + private String earNumber; + + /** 品种 */ + @Excel(name = "品种") + private String breed; + + /** 事件类型 */ + @Excel(name = "事件类型") + private String eventType; + + /** 性别 */ + @Excel(name = "性别") + private String gender; + + /** 父号 */ + @Excel(name = "父号") + private String fatherNumber; + + /** 母号 */ + @Excel(name = "母号") + private String motherNumber; + + /** 月龄 */ + @Excel(name = "月龄") + private Integer monthAge; + + /** 出生重量 */ + @Excel(name = "出生重量") + private BigDecimal birthWeight; + + /** 羊舍 */ + @Excel(name = "羊舍") + private String sheepPen; + + /** 繁育状态 */ + @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/wean/mapper/ScWeanRecordMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/wean/mapper/ScWeanRecordMapper.java new file mode 100644 index 0000000..b8b5d5e --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/wean/mapper/ScWeanRecordMapper.java @@ -0,0 +1,68 @@ +package com.zhyc.module.produce.wean.mapper; + +import java.util.List; +import com.zhyc.module.produce.wean.domain.ScWeanRecord; + +/** + * 断奶记录Mapper接口 + * + * @author zhyc + * @date 2024-01-01 + */ +public interface ScWeanRecordMapper { + /** + * 查询断奶记录 + * + * @param id 断奶记录主键 + * @return 断奶记录 + */ + public ScWeanRecord selectScWeanRecordById(Long id); + + /** + * 查询断奶记录列表 + * + * @param scWeanRecord 断奶记录 + * @return 断奶记录集合 + */ + public List selectScWeanRecordList(ScWeanRecord scWeanRecord); + + /** + * 新增断奶记录 + * + * @param scWeanRecord 断奶记录 + * @return 结果 + */ + public int insertScWeanRecord(ScWeanRecord scWeanRecord); + + /** + * 修改断奶记录 + * + * @param scWeanRecord 断奶记录 + * @return 结果 + */ + public int updateScWeanRecord(ScWeanRecord scWeanRecord); + + /** + * 删除断奶记录 + * + * @param id 断奶记录主键 + * @return 结果 + */ + public int deleteScWeanRecordById(Long id); + + /** + * 批量删除断奶记录 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteScWeanRecordByIds(Long[] ids); + + /** + * 根据耳号查询羊只ID + * + * @param earNumber 耳号 + * @return 羊只ID + */ + public Long selectSheepIdByEarNumber(String earNumber); +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/wean/service/IScWeanRecordService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/wean/service/IScWeanRecordService.java new file mode 100644 index 0000000..9926de0 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/wean/service/IScWeanRecordService.java @@ -0,0 +1,68 @@ +package com.zhyc.module.produce.wean.service; + +import java.util.List; +import com.zhyc.module.produce.wean.domain.ScWeanRecord; + +/** + * 断奶记录Service接口 + * + * @author ruoyi + * @date 2025-07-13 + */ +public interface IScWeanRecordService { + /** + * 查询断奶记录 + * + * @param id 断奶记录主键 + * @return 断奶记录 + */ + public ScWeanRecord selectScWeanRecordById(Long id); + + /** + * 查询断奶记录列表 + * + * @param scWeanRecord 断奶记录 + * @return 断奶记录集合 + */ + public List selectScWeanRecordList(ScWeanRecord scWeanRecord); + + /** + * 新增断奶记录 + * + * @param scWeanRecord 断奶记录 + * @return 结果 + */ + public int insertScWeanRecord(ScWeanRecord scWeanRecord); + + /** + * 修改断奶记录 + * + * @param scWeanRecord 断奶记录 + * @return 结果 + */ + public int updateScWeanRecord(ScWeanRecord scWeanRecord); + + /** + * 批量删除断奶记录 + * + * @param ids 需要删除的断奶记录主键集合 + * @return 结果 + */ + public int deleteScWeanRecordByIds(Long[] ids); + + /** + * 删除断奶记录信息 + * + * @param id 断奶记录主键 + * @return 结果 + */ + public int deleteScWeanRecordById(Long id); + + /** + * 根据耳号查询羊只ID + * + * @param earNumber 耳号 + * @return 羊只ID + */ + public Long selectSheepIdByEarNumber(String earNumber); +} \ No newline at end of file diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/wean/service/impl/ScWeanRecordServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/wean/service/impl/ScWeanRecordServiceImpl.java new file mode 100644 index 0000000..2bc63c2 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/wean/service/impl/ScWeanRecordServiceImpl.java @@ -0,0 +1,113 @@ +package com.zhyc.module.produce.wean.service.impl; + +import java.util.List; +import com.zhyc.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.produce.wean.mapper.ScWeanRecordMapper; +import com.zhyc.module.produce.wean.domain.ScWeanRecord; +import com.zhyc.module.produce.wean.service.IScWeanRecordService; + +/** + * 断奶记录Service业务层处理 + * + * @author ruoyi + * @date 2025-07-13 + */ +@Service +public class ScWeanRecordServiceImpl implements IScWeanRecordService { + @Autowired + private ScWeanRecordMapper scWeanRecordMapper; + + /** + * 查询断奶记录 + * + * @param id 断奶记录主键 + * @return 断奶记录 + */ + @Override + public ScWeanRecord selectScWeanRecordById(Long id) { + return scWeanRecordMapper.selectScWeanRecordById(id); + } + + /** + * 查询断奶记录列表 + * + * @param scWeanRecord 断奶记录 + * @return 断奶记录 + */ + @Override + public List selectScWeanRecordList(ScWeanRecord scWeanRecord) { + return scWeanRecordMapper.selectScWeanRecordList(scWeanRecord); + } + + /** + * 新增断奶记录 + * + * @param scWeanRecord 断奶记录 + * @return 结果 + */ + @Override + public int insertScWeanRecord(ScWeanRecord scWeanRecord) { + // 如果前端传递的是耳号,需要先获取羊只ID + if (scWeanRecord.getEarNumber() != null && scWeanRecord.getSheepId() == null) { + Long sheepId = scWeanRecordMapper.selectSheepIdByEarNumber(scWeanRecord.getEarNumber()); + if (sheepId != null) { + scWeanRecord.setSheepId(sheepId); + } + } + scWeanRecord.setCreateTime(DateUtils.getNowDate()); + return scWeanRecordMapper.insertScWeanRecord(scWeanRecord); + } + + /** + * 修改断奶记录 + * + * @param scWeanRecord 断奶记录 + * @return 结果 + */ + @Override + public int updateScWeanRecord(ScWeanRecord scWeanRecord) { + // 如果前端传递的是耳号,需要先获取羊只ID + if (scWeanRecord.getEarNumber() != null && scWeanRecord.getSheepId() == null) { + Long sheepId = scWeanRecordMapper.selectSheepIdByEarNumber(scWeanRecord.getEarNumber()); + if (sheepId != null) { + scWeanRecord.setSheepId(sheepId); + } + } + return scWeanRecordMapper.updateScWeanRecord(scWeanRecord); + } + + /** + * 批量删除断奶记录 + * + * @param ids 需要删除的断奶记录主键 + * @return 结果 + */ + @Override + public int deleteScWeanRecordByIds(Long[] ids) { + return scWeanRecordMapper.deleteScWeanRecordByIds(ids); + } + + /** + * 删除断奶记录信息 + * + * @param id 断奶记录主键 + * @return 结果 + */ + @Override + public int deleteScWeanRecordById(Long id) { + return scWeanRecordMapper.deleteScWeanRecordById(id); + } + + /** + * 根据耳号查询羊只ID + * + * @param earNumber 耳号 + * @return 羊只ID + */ + @Override + public Long selectSheepIdByEarNumber(String earNumber) { + return scWeanRecordMapper.selectSheepIdByEarNumber(earNumber); + } +} \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/Weaning/ScWeanRecordMapper.xml b/zhyc-module/src/main/resources/mapper/Weaning/ScWeanRecordMapper.xml new file mode 100644 index 0000000..a5cdc3b --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/Weaning/ScWeanRecordMapper.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select + wr.id, wr.sheep_id, wr.datetime, wr.weight, wr.status, wr.technician, + wr.comment, wr.create_by, wr.create_time, wr.electronic_tags, + sf.bs_manage_tags, sf.variety, sf.gender, sf.father_manage_tags, sf.mother_manage_tags, + sf.birth_weight, sf.sheepfold_name, sf.breed, sf.month_age, + '断奶' as event_type + from sc_wean_record wr + left join sheep_file sf on wr.sheep_id = sf.id + + + + + + + + + + + + + + insert into sc_wean_record + + sheep_id, + datetime, + weight, + status, + technician, + comment, + create_by, + create_time, + electronic_tags, + + + #{sheepId}, + #{datetime}, + #{weight}, + #{status}, + #{technician}, + #{comment}, + #{createBy}, + #{createTime}, + #{electronicTags}, + + + + + + update sc_wean_record + + sheep_id = #{sheepId}, + datetime = #{datetime}, + weight = #{weight}, + status = #{status}, + technician = #{technician}, + comment = #{comment}, + create_by = #{createBy}, + create_time = #{createTime}, + electronic_tags = #{electronicTags}, + + where id = #{id} + + + + + delete from sc_wean_record where id = #{id} + + + + + delete from sc_wean_record where id in + + #{id} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/biosafety/QuarantineItemsMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/QuarantineItemsMapper.xml new file mode 100644 index 0000000..382970e --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/biosafety/QuarantineItemsMapper.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + select id, name from sw_quarantine_items + + + + + + + + insert into sw_quarantine_items + + name, + + + #{name}, + + + + + update sw_quarantine_items + + name = #{name}, + + where id = #{id} + + + + delete from sw_quarantine_items where id = #{id} + + + + delete from sw_quarantine_items where id in + + #{id} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/biosafety/QuarantineReportMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/QuarantineReportMapper.xml new file mode 100644 index 0000000..525c60c --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/biosafety/QuarantineReportMapper.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select sqr.id, sheep_type,sheep_id, datetime, quar_item, sample_type, sampler, quar_officer, result, status, + sqr.update_by, sqr.update_time, sqr.create_by, sqr.create_time, + sqi.name as item_name, + sqs.name as sample, + sf.bs_manage_tags sheep_no,sf.gender,sf.parity,sf.breed,sf.month_age + from sw_quarantine_report sqr + left join sw_quarantine_items sqi on sqr.quar_item = sqi.id + left join sw_quarantine_sample sqs on sqr.sample_type = sqs.id + left join sheep_file sf on sqr.sheep_id = sf.id + + + + + + + + insert into sw_quarantine_report + + sheep_id, + datetime, + quar_item, + sample_type, + sampler, + quar_officer, + result, + status, + update_by, + update_time, + create_by, + create_time, + + + #{sheepId}, + #{datetime}, + #{quarItem}, + #{sampleType}, + #{sampler}, + #{quarOfficer}, + #{result}, + #{status}, + #{updateBy}, + #{updateTime}, + #{createBy}, + #{createTime}, + + + + + update sw_quarantine_report + + sheep_id = #{sheepId}, + datetime = #{datetime}, + quar_item = #{quarItem}, + sample_type = #{sampleType}, + sampler = #{sampler}, + quar_officer = #{quarOfficer}, + result = #{result}, + status = #{status}, + update_by = #{updateBy}, + update_time = #{updateTime}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from sw_quarantine_report where id = #{id} + + + + delete from sw_quarantine_report where id in + + #{id} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/biosafety/QuarantineSampleMapper.xml b/zhyc-module/src/main/resources/mapper/biosafety/QuarantineSampleMapper.xml new file mode 100644 index 0000000..7deacd0 --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/biosafety/QuarantineSampleMapper.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + select id, name from sw_quarantine_sample + + + + + + + + insert into sw_quarantine_sample + + name, + + + #{name}, + + + + + update sw_quarantine_sample + + name = #{name}, + + where id = #{id} + + + + delete from sw_quarantine_sample where id = #{id} + + + + delete from sw_quarantine_sample where id in + + #{id} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/breed/ScLambDetailMapper.xml b/zhyc-module/src/main/resources/mapper/breed/ScLambDetailMapper.xml new file mode 100644 index 0000000..c94b857 --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/breed/ScLambDetailMapper.xml @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + select id, lambing_record_id, lamb_ear_number, lamb_breed, gender, birth_weight, + is_retained, lineage, birthday, create_by, create_time, update_by, update_time + from sc_lamb_detail + + + + + + + + + + + + + + + + + + insert into sc_lamb_detail + + lambing_record_id, + lamb_ear_number, + lamb_breed, + gender, + birth_weight, + is_retained, + lineage, + birthday, + create_by, + create_time, + + + #{lambingRecordId}, + #{lambEarNumber}, + #{lambBreed}, + #{gender}, + #{birthWeight}, + #{isRetained}, + #{lineage}, + #{birthday}, + #{createBy}, + #{createTime}, + + + + + + insert into bas_sheep + + manage_tags, + variety_id, + gender, + birthday, + birth_weight, + family, + mother_id, + father_id, + ranch_id, + sheepfold_id, + parity, + status_id, + type_id, + breed_status_id, + is_delete, + create_by, + create_time, + + + #{lambEarNumber}, + #{lambBreed}, + #{gender}, + #{birthday}, + #{birthWeight}, + #{lineage}, + #{motherId}, + #{fatherId}, + #{ranchId}, + #{sheepfoldId}, + #{parity}, + #{isRetained}, + 3, + 1, + 0, + #{createBy}, + #{createTime}, + + + + + + + insert into sc_lamb_detail (lambing_record_id, lamb_ear_number, lamb_breed, gender, birth_weight, + is_retained, lineage, birthday, create_by, create_time) + values + + (#{item.lambingRecordId}, #{item.lambEarNumber}, #{item.lambBreed}, #{item.gender}, + #{item.birthWeight}, #{item.isRetained}, #{item.lineage}, #{item.birthday}, + #{item.createBy}, #{item.createTime}) + + + + + + insert into bas_sheep (manage_tags, variety_id, gender, birthday, birth_weight, family, + mother_id, father_id, ranch_id, sheepfold_id, parity, status_id, type_id, breed_status_id, is_delete, create_by, create_time) + values + + (#{item.lambEarNumber}, #{item.lambBreed}, #{item.gender}, #{item.birthday}, + #{item.birthWeight}, #{item.lineage}, #{item.motherId}, #{item.fatherId}, + #{item.ranchId}, #{item.sheepfoldId}, #{item.parity}, #{item.isRetained}, + 3, 1, 0, #{item.createBy}, #{item.createTime}) + + + + + + update sc_lamb_detail + + lambing_record_id = #{lambingRecordId}, + lamb_ear_number = #{lambEarNumber}, + lamb_breed = #{lambBreed}, + gender = #{gender}, + birth_weight = #{birthWeight}, + is_retained = #{isRetained}, + lineage = #{lineage}, + birthday = #{birthday}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + + update bas_sheep + + manage_tags = #{lambEarNumber}, + variety_id = #{lambBreed}, + gender = #{gender}, + birthday = #{birthday}, + birth_weight = #{birthWeight}, + family = #{lineage}, + status_id = #{isRetained}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where manage_tags = #{lambEarNumber} and is_delete = 0 + + + + + delete from sc_lamb_detail where id = #{id} + + + + + update bas_sheep set is_delete = 1 where manage_tags = #{lambEarNumber} + + + + + delete from sc_lamb_detail where id in + + #{id} + + + + + + update bas_sheep set is_delete = 1 where manage_tags in + + #{earNumber} + + + + + + delete from sc_lamb_detail where lambing_record_id = #{lambingRecordId} + + + + + update bas_sheep set is_delete = 1 + where manage_tags in ( + select lamb_ear_number from sc_lamb_detail + where lambing_record_id = #{lambingRecordId} + ) + + + + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/breed/ScLambingRecordMapper.xml b/zhyc-module/src/main/resources/mapper/breed/ScLambingRecordMapper.xml index ed000d9..937834b 100644 --- a/zhyc-module/src/main/resources/mapper/breed/ScLambingRecordMapper.xml +++ b/zhyc-module/src/main/resources/mapper/breed/ScLambingRecordMapper.xml @@ -15,7 +15,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -110,7 +110,7 @@ and lr.score = #{score} and lr.comment LIKE CONCAT('%', #{comment}, '%') and lr.create_by = #{createBy} - and DATE(lr.create_tme) = #{createTme} + and DATE(lr.create_tme) = #{createTime} and DATE(br.create_time) >= #{params.beginBreedingDate} @@ -134,27 +134,23 @@ where lr.id = #{id} and mother.is_delete = 0 - - SELECT - sheep.manage_tags as lambEarNumber, - sheep.variety_id as lambBreed, - CASE sheep.gender - WHEN 1 THEN 'male' - WHEN 0 THEN 'female' - ELSE 'unknown' - END as gender, - sheep.birth_weight as birthWeight, - CASE sheep.status_id - WHEN 1 THEN true - ELSE false - END as isRetained, - sheep.family as lineage, - sheep.birthday - FROM bas_sheep sheep - WHERE sheep.mother_id = (SELECT sheep_id FROM sc_lambing_record WHERE id = #{lambingRecordId}) - AND sheep.is_delete = 0 - ORDER BY sheep.birthday ASC + id, + lambing_record_id as lambingRecordId, + lamb_ear_number as lambEarNumber, + lamb_breed as lambBreed, + gender, + birth_weight as birthWeight, + is_retained as isRetained, + lineage, + birthday, + create_by as createBy, + create_time as createTime + FROM sc_lamb_detail + WHERE lambing_record_id = #{lambingRecordId} + ORDER BY create_time ASC @@ -169,7 +165,7 @@ score, comment, create_by, - create_tme, + create_tme, #{sheepId}, @@ -180,7 +176,7 @@ #{score}, #{comment}, #{createBy}, - #{createTme}, + #{createTime}, @@ -196,7 +192,7 @@ score = #{score}, comment = #{comment}, create_by = #{createBy}, - create_tme = #{createTme}, + create_tme = #{createTime}, where id = #{id} diff --git a/zhyc-module/src/main/resources/mapper/group_management/BasSheepGroupMapper.xml b/zhyc-module/src/main/resources/mapper/group_management/BasSheepGroupMapper.xml new file mode 100644 index 0000000..cf8ba5e --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/group_management/BasSheepGroupMapper.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + select group_id, parent_id, group_name, ancestors, status, create_by, create_time, update_by, update_time from bas_sheep_group + + + + + + + + insert into bas_sheep_group + + parent_id, + group_name, + ancestors, + status, + create_by, + create_time, + update_by, + update_time, + + + #{parentId}, + #{groupName}, + #{ancestors}, + #{status}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update bas_sheep_group + + parent_id = #{parentId}, + group_name = #{groupName}, + ancestors = #{ancestors}, + status = #{status}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where group_id = #{groupId} + + + + delete from bas_sheep_group where group_id = #{groupId} + + + + delete from bas_sheep_group where group_id in + + #{groupId} + + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/variety/BasSheepVarietyMapper.xml b/zhyc-module/src/main/resources/mapper/variety/BasSheepVarietyMapper.xml new file mode 100644 index 0000000..dcc97fc --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/variety/BasSheepVarietyMapper.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + select id, variety from bas_sheep_variety + + + + + + + + insert into bas_sheep_variety + + variety, + + + #{variety}, + + + + + update bas_sheep_variety + + variety = #{variety}, + + where id = #{id} + + + + delete from bas_sheep_variety where id = #{id} + + + + delete from bas_sheep_variety where id in + + #{id} + + + \ No newline at end of file