From 7b795e60ef59b78f0bbe01c3fd92e6fe5fb08f1f Mon Sep 17 00:00:00 2001 From: zyh <2066096076@qq.com> Date: Fri, 18 Jul 2025 11:34:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E8=B9=84=E9=83=A8=E5=88=86=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E8=80=B3=E5=8F=B7=E7=9A=84=E7=9B=B8=E5=85=B3=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ScTransGroupController.java | 20 ++---- .../trans_group/domain/ScTransGroup.java | 58 +++++++++++----- .../mapper/ScTransGroupMapper.java | 18 ++--- .../service/IScTransGroupService.java | 18 ++--- .../domain/ScTransitionInfo.java | 55 +++++++++++---- .../controller/ScFixHoofController.java | 12 ++-- .../other/fixHoof/domain/ScFixHoof.java | 5 +- .../other/fixHoof/mapper/ScFixHoofMapper.java | 22 +++--- .../fixHoof/service/IScFixHoofService.java | 9 +++ .../service/impl/ScFixHoofServiceImpl.java | 66 ++++++++++++------ .../sheep/controller/BasSheepController.java | 25 ++++--- .../module/produce/sheep/domain/BasSheep.java | 1 + .../produce/sheep/mapper/BasSheepMapper.java | 9 +++ .../sheep/service/IBasSheepService.java | 2 + .../service/impl/BasSheepServiceImpl.java | 6 ++ .../ScTransitionInfoMapper.xml | 69 ++++++++++++------- .../produce/other/fixHoof/ScFixHoofMapper.xml | 14 ++-- .../mapper/produce/sheep/BasSheepMapper.xml | 31 +++++++-- 18 files changed, 299 insertions(+), 141 deletions(-) diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/controller/ScTransGroupController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/controller/ScTransGroupController.java index 44b8ccf..3c303ff 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/controller/ScTransGroupController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/controller/ScTransGroupController.java @@ -25,14 +25,13 @@ import com.zhyc.common.core.page.TableDataInfo; /** * 转群记录Controller - * + * * @author ruoyi * @date 2025-07-10 */ @RestController @RequestMapping("produce/manage_sheep/trans_group") -public class ScTransGroupController extends BaseController -{ +public class ScTransGroupController extends BaseController { @Autowired private IScTransGroupService scTransGroupService; @@ -41,8 +40,7 @@ public class ScTransGroupController extends BaseController */ @PreAuthorize("@ss.hasPermi('produce:trans_group:list')") @GetMapping("/list") - public TableDataInfo list(ScTransGroup scTransGroup) - { + public TableDataInfo list(ScTransGroup scTransGroup) { startPage(); List list = scTransGroupService.selectScTransGroupList(scTransGroup); return getDataTable(list); @@ -65,8 +63,7 @@ public class ScTransGroupController extends BaseController */ @PreAuthorize("@ss.hasPermi('produce:trans_group:query')") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Integer id) - { + public AjaxResult getInfo(@PathVariable("id") Integer id) { return success(scTransGroupService.selectScTransGroupById(id)); } @@ -76,8 +73,7 @@ public class ScTransGroupController extends BaseController @PreAuthorize("@ss.hasPermi('produce:trans_group:add')") @Log(title = "转群记录", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody ScTransGroup scTransGroup) - { + public AjaxResult add(@RequestBody ScTransGroup scTransGroup) { return toAjax(scTransGroupService.insertScTransGroup(scTransGroup)); } @@ -87,8 +83,7 @@ public class ScTransGroupController extends BaseController @PreAuthorize("@ss.hasPermi('produce:trans_group:edit')") @Log(title = "转群记录", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody ScTransGroup scTransGroup) - { + public AjaxResult edit(@RequestBody ScTransGroup scTransGroup) { return toAjax(scTransGroupService.updateScTransGroup(scTransGroup)); } @@ -98,8 +93,7 @@ public class ScTransGroupController extends BaseController @PreAuthorize("@ss.hasPermi('produce:trans_group:remove')") @Log(title = "转群记录", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Integer[] ids) - { + public AjaxResult remove(@PathVariable Integer[] ids) { return toAjax(scTransGroupService.deleteScTransGroupByIds(ids)); } } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/domain/ScTransGroup.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/domain/ScTransGroup.java index 8ae62eb..bee29eb 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/domain/ScTransGroup.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/domain/ScTransGroup.java @@ -11,66 +11,90 @@ import org.springframework.beans.factory.annotation.Autowired; /** * 转群记录对象 sc_trans_group - * + * * @author ruoyi * @date 2025-07-10 */ @Data @AllArgsConstructor @NoArgsConstructor -public class ScTransGroup extends BaseEntity -{ +public class ScTransGroup extends BaseEntity { private static final long serialVersionUID = 1L; - /** $column.columnComment */ + /** + * $column.columnComment + */ private Integer id; - /** 羊只id */ + /** + * 羊只id + */ @Excel(name = "羊只id") private Integer sheepId; - /** 转入羊舍 */ + /** + * 转入羊舍 + */ private String foldTo; - /** 转出羊舍 */ + /** + * 转出羊舍 + */ private String foldFrom; - /** 转出羊舍名称 */ + /** + * 转出羊舍名称 + */ @Excel(name = "转出羊舍") private String foldFromName; - /** 转入羊舍名称 */ + /** + * 转入羊舍名称 + */ @Excel(name = "转入羊舍") private String foldToName; /** 转群原因 */ - /** 品种id */ + /** + * 品种id + */ private Long varietyId; - /** 品种名称(联表查询返回,非数据库字段) */ + /** + * 品种名称(联表查询返回,非数据库字段) + */ @Excel(name = "品种") private String varietyName; private Integer reason; - /** 转群原因描述 用于导出*/ + /** + * 转群原因描述 用于导出 + */ @Excel(name = "转群原因") private String reasonText; - /** 技术员 */ + /** + * 技术员 + */ @Excel(name = "技术员") private String technician; - /** 状态 */ + /** + * 状态 + */ private Integer status; - /** 状态描述 用于导出*/ + /** + * 状态描述 用于导出 + */ @Excel(name = "状态") private String statusText; - /** 备注 */ + /** + * 备注 + */ @Excel(name = "备注") private String comment; - } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/mapper/ScTransGroupMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/mapper/ScTransGroupMapper.java index 288f672..3e4820e 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/mapper/ScTransGroupMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/mapper/ScTransGroupMapper.java @@ -1,19 +1,19 @@ package com.zhyc.module.produce.manage_sheep.trans_group.mapper; import java.util.List; + import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup; /** * 转群记录Mapper接口 - * + * * @author ruoyi * @date 2025-07-10 */ -public interface ScTransGroupMapper -{ +public interface ScTransGroupMapper { /** * 查询转群记录 - * + * * @param id 转群记录主键 * @return 转群记录 */ @@ -21,7 +21,7 @@ public interface ScTransGroupMapper /** * 查询转群记录列表 - * + * * @param scTransGroup 转群记录 * @return 转群记录集合 */ @@ -29,7 +29,7 @@ public interface ScTransGroupMapper /** * 新增转群记录 - * + * * @param scTransGroup 转群记录 * @return 结果 */ @@ -37,7 +37,7 @@ public interface ScTransGroupMapper /** * 修改转群记录 - * + * * @param scTransGroup 转群记录 * @return 结果 */ @@ -45,7 +45,7 @@ public interface ScTransGroupMapper /** * 删除转群记录 - * + * * @param id 转群记录主键 * @return 结果 */ @@ -53,7 +53,7 @@ public interface ScTransGroupMapper /** * 批量删除转群记录 - * + * * @param ids 需要删除的数据主键集合 * @return 结果 */ diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/service/IScTransGroupService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/service/IScTransGroupService.java index 2e249f5..a5053db 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/service/IScTransGroupService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/trans_group/service/IScTransGroupService.java @@ -1,19 +1,19 @@ package com.zhyc.module.produce.manage_sheep.trans_group.service; import java.util.List; + import com.zhyc.module.produce.manage_sheep.trans_group.domain.ScTransGroup; /** * 转群记录Service接口 - * + * * @author ruoyi * @date 2025-07-10 */ -public interface IScTransGroupService -{ +public interface IScTransGroupService { /** * 查询转群记录 - * + * * @param id 转群记录主键 * @return 转群记录 */ @@ -21,7 +21,7 @@ public interface IScTransGroupService /** * 查询转群记录列表 - * + * * @param scTransGroup 转群记录 * @return 转群记录集合 */ @@ -29,7 +29,7 @@ public interface IScTransGroupService /** * 新增转群记录 - * + * * @param scTransGroup 转群记录 * @return 结果 */ @@ -37,7 +37,7 @@ public interface IScTransGroupService /** * 修改转群记录 - * + * * @param scTransGroup 转群记录 * @return 结果 */ @@ -45,7 +45,7 @@ public interface IScTransGroupService /** * 批量删除转群记录 - * + * * @param ids 需要删除的转群记录主键集合 * @return 结果 */ @@ -53,7 +53,7 @@ public interface IScTransGroupService /** * 删除转群记录信息 - * + * * @param id 转群记录主键 * @return 结果 */ diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/transition_info/domain/ScTransitionInfo.java b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/transition_info/domain/ScTransitionInfo.java index bce520a..419d406 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/transition_info/domain/ScTransitionInfo.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/manage_sheep/transition_info/domain/ScTransitionInfo.java @@ -10,45 +10,76 @@ import com.zhyc.common.core.domain.BaseEntity; /** * 转场对象 sc_transition_info - * + * * @author ruoyi * @date 2025-07-10 */ @Data @AllArgsConstructor @NoArgsConstructor -public class ScTransitionInfo extends BaseEntity -{ +public class ScTransitionInfo extends BaseEntity { private static final long serialVersionUID = 1L; - /** */ + /** + * + */ private Integer id; - /** 羊只id */ + /** + * 羊只id + */ @Excel(name = "羊只id") private Integer sheepId; - /** 转入牧场 */ + /** + * 品种id + */ + private Long varietyId; + + /** + * 品种名称(联表返回,非数据库字段) + */ + @Excel(name = "品种") + private String varietyName; + + /** + * 转入牧场 + */ @Excel(name = "转入牧场") private String transTo; - /** 当前牧场 */ + /** + * 当前牧场 + */ @Excel(name = "当前牧场") private String transFrom; - /** 转场类型 */ - @Excel(name = "转场类型") + /** + * 转场类型 + */ private Integer transType; - /** 技术员 */ + /** + * 转场类型名称 只用于导出 + */ + @Excel(name = "转场类型") + private String transTypeText; + + /** + * 技术员 + */ @Excel(name = "技术员") private String technician; - /** 状态 */ + /** + * 状态 + */ @Excel(name = "状态") private Integer status; - /** 备注 */ + /** + * 备注 + */ @Excel(name = "备注") private String comment; diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/controller/ScFixHoofController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/controller/ScFixHoofController.java index fe6de0d..4fabe07 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/controller/ScFixHoofController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/controller/ScFixHoofController.java @@ -77,9 +77,9 @@ public class ScFixHoofController extends BaseController @PreAuthorize("@ss.hasPermi('produce:fixHoof:add')") @Log(title = "修蹄", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody ScFixHoof scFixHoof) - { - return toAjax(scFixHoofService.insertScFixHoof(scFixHoof)); + public AjaxResult add(@RequestBody ScFixHoof dto){ + dto.setSheepId(scFixHoofService.findIdByManageTags(dto.getManageTags()).intValue()); + return toAjax(scFixHoofService.insertScFixHoof(dto)); } /** @@ -88,9 +88,9 @@ public class ScFixHoofController extends BaseController @PreAuthorize("@ss.hasPermi('produce:fixHoof:edit')") @Log(title = "修蹄", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody ScFixHoof scFixHoof) - { - return toAjax(scFixHoofService.updateScFixHoof(scFixHoof)); + public AjaxResult edit(@RequestBody ScFixHoof dto){ + dto.setSheepId(scFixHoofService.findIdByManageTags(dto.getManageTags()).intValue()); + return toAjax(scFixHoofService.updateScFixHoof(dto)); } /** diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/domain/ScFixHoof.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/domain/ScFixHoof.java index 57bd187..03cd9e3 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/domain/ScFixHoof.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/domain/ScFixHoof.java @@ -25,8 +25,11 @@ public class ScFixHoof extends BaseEntity private Integer id; /** 羊只id */ - @Excel(name = "羊只id") private Integer sheepId; + /** 管理耳号(仅用于接收参数/返回视图,不存库) */ + @Excel(name = "管理耳号") +// @TableField(exist = false) // ← 非数据库字段 + private String manageTags; /** 羊舍id */ private Integer sheepfold; diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/mapper/ScFixHoofMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/mapper/ScFixHoofMapper.java index a5d71a1..e2bea53 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/mapper/ScFixHoofMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/mapper/ScFixHoofMapper.java @@ -1,19 +1,21 @@ package com.zhyc.module.produce.other.fixHoof.mapper; import java.util.List; + import com.zhyc.module.produce.other.fixHoof.domain.ScFixHoof; +import com.zhyc.module.produce.sheep.domain.BasSheep; +import org.apache.ibatis.annotations.Param; /** * 修蹄Mapper接口 - * + * * @author ruoyi * @date 2025-07-10 */ -public interface ScFixHoofMapper -{ +public interface ScFixHoofMapper { /** * 查询修蹄 - * + * * @param id 修蹄主键 * @return 修蹄 */ @@ -21,7 +23,7 @@ public interface ScFixHoofMapper /** * 查询修蹄列表 - * + * * @param scFixHoof 修蹄 * @return 修蹄集合 */ @@ -29,7 +31,7 @@ public interface ScFixHoofMapper /** * 新增修蹄 - * + * * @param scFixHoof 修蹄 * @return 结果 */ @@ -37,7 +39,7 @@ public interface ScFixHoofMapper /** * 修改修蹄 - * + * * @param scFixHoof 修蹄 * @return 结果 */ @@ -45,7 +47,7 @@ public interface ScFixHoofMapper /** * 删除修蹄 - * + * * @param id 修蹄主键 * @return 结果 */ @@ -53,9 +55,11 @@ public interface ScFixHoofMapper /** * 批量删除修蹄 - * + * * @param ids 需要删除的数据主键集合 * @return 结果 */ public int deleteScFixHoofByIds(Integer[] ids); + + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/IScFixHoofService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/IScFixHoofService.java index 01a2272..11cda69 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/IScFixHoofService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/IScFixHoofService.java @@ -58,4 +58,13 @@ public interface IScFixHoofService * @return 结果 */ public int deleteScFixHoofById(Integer id); + + /** + * 根据管理耳号查询 + * @param manageTags + * @return + */ + Long findIdByManageTags(String manageTags); + + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/impl/ScFixHoofServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/impl/ScFixHoofServiceImpl.java index 5bf5e2a..e60ec7a 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/impl/ScFixHoofServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/other/fixHoof/service/impl/ScFixHoofServiceImpl.java @@ -1,95 +1,119 @@ package com.zhyc.module.produce.other.fixHoof.service.impl; import java.util.List; + +import com.zhyc.common.exception.ServiceException; import com.zhyc.common.utils.DateUtils; +import com.zhyc.common.utils.StringUtils; import com.zhyc.module.produce.other.fixHoof.domain.ScFixHoof; import com.zhyc.module.produce.other.fixHoof.mapper.ScFixHoofMapper; +import com.zhyc.module.produce.sheep.domain.BasSheep; +import com.zhyc.module.produce.sheep.mapper.BasSheepMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zhyc.module.produce.other.fixHoof.service.IScFixHoofService; +import org.springframework.transaction.annotation.Transactional; /** * 修蹄Service业务层处理 - * + * * @author ruoyi * @date 2025-07-10 */ @Service -public class ScFixHoofServiceImpl implements IScFixHoofService -{ +public class ScFixHoofServiceImpl implements IScFixHoofService { @Autowired private ScFixHoofMapper scFixHoofMapper; + @Autowired + private BasSheepMapper basSheepMapper; + /** * 查询修蹄 - * + * * @param id 修蹄主键 * @return 修蹄 */ @Override - public ScFixHoof selectScFixHoofById(Integer id) - { + public ScFixHoof selectScFixHoofById(Integer id) { return scFixHoofMapper.selectScFixHoofById(id); } /** * 查询修蹄列表 - * + * * @param scFixHoof 修蹄 * @return 修蹄 */ @Override - public List selectScFixHoofList(ScFixHoof scFixHoof) - { + public List selectScFixHoofList(ScFixHoof scFixHoof) { return scFixHoofMapper.selectScFixHoofList(scFixHoof); } /** * 新增修蹄 - * + * * @param scFixHoof 修蹄 * @return 结果 */ @Override - public int insertScFixHoof(ScFixHoof scFixHoof) - { + public int insertScFixHoof(ScFixHoof scFixHoof) { + // 校验羊只是否存在 + BasSheep sheep = basSheepMapper.selectBasSheepById(scFixHoof.getSheepId().longValue()); + if (sheep == null) { + throw new ServiceException("该羊只ID不存在,请检查后再添加"); + } scFixHoof.setCreateTime(DateUtils.getNowDate()); return scFixHoofMapper.insertScFixHoof(scFixHoof); } /** * 修改修蹄 - * + * * @param scFixHoof 修蹄 * @return 结果 */ @Override - public int updateScFixHoof(ScFixHoof scFixHoof) - { + public int updateScFixHoof(ScFixHoof scFixHoof) { return scFixHoofMapper.updateScFixHoof(scFixHoof); } /** * 批量删除修蹄 - * + * * @param ids 需要删除的修蹄主键 * @return 结果 */ @Override - public int deleteScFixHoofByIds(Integer[] ids) - { + public int deleteScFixHoofByIds(Integer[] ids) { return scFixHoofMapper.deleteScFixHoofByIds(ids); } /** * 删除修蹄信息 - * + * * @param id 修蹄主键 * @return 结果 */ @Override - public int deleteScFixHoofById(Integer id) - { + public int deleteScFixHoofById(Integer id) { return scFixHoofMapper.deleteScFixHoofById(id); } + + + /** + * 根据管理耳号查询 + */ + @Override + public Long findIdByManageTags(String manageTags){ + if(StringUtils.isBlank(manageTags)) + throw new ServiceException("管理耳号不能为空"); + BasSheep sheep = basSheepMapper.selectBasSheepByManageTags(manageTags.trim()); + if(sheep == null) + throw new ServiceException("管理耳号不存在:" + manageTags); + return sheep.getId(); + } + + + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/controller/BasSheepController.java b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/controller/BasSheepController.java index 7efd886..4726cf1 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/controller/BasSheepController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/controller/BasSheepController.java @@ -1,20 +1,17 @@ package com.zhyc.module.produce.sheep.controller; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; import com.zhyc.module.produce.sheep.domain.BasSheep; +import com.zhyc.module.produce.sheep.mapper.BasSheepMapper; import com.zhyc.module.produce.sheep.service.IBasSheepService; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.zhyc.common.annotation.Log; import com.zhyc.common.core.controller.BaseController; import com.zhyc.common.core.domain.AjaxResult; @@ -35,6 +32,8 @@ public class BasSheepController extends BaseController @Autowired private IBasSheepService basSheepService; + @Autowired + private BasSheepMapper basSheepMapper; /** * 查询羊只基本信息列表 */ @@ -102,4 +101,14 @@ public class BasSheepController extends BaseController { return toAjax(basSheepService.deleteBasSheepByIds(ids)); } + + + @GetMapping("/byManageTags/{manageTags}") + public AjaxResult byManageTags(@PathVariable String manageTags){ + BasSheep sheep = basSheepService.selectBasSheepByManageTags(manageTags.trim()); + return success(sheep); + } + + + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/domain/BasSheep.java b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/domain/BasSheep.java index 84e2ac6..c75cf31 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/domain/BasSheep.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/domain/BasSheep.java @@ -38,6 +38,7 @@ public class BasSheep extends BaseEntity /** 羊舍id */ @Excel(name = "羊舍id") private Long sheepfoldId; + private String sheepfoldName; /** 电子耳号 */ @Excel(name = "电子耳号") diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/mapper/BasSheepMapper.java b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/mapper/BasSheepMapper.java index e223d22..d31d003 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/mapper/BasSheepMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/mapper/BasSheepMapper.java @@ -2,6 +2,7 @@ package com.zhyc.module.produce.sheep.mapper; import java.util.List; import com.zhyc.module.produce.sheep.domain.BasSheep; +import org.apache.ibatis.annotations.Param; /** * 羊只基本信息Mapper接口 @@ -58,4 +59,12 @@ public interface BasSheepMapper * @return 结果 */ public int deleteBasSheepByIds(Long[] ids); + + + /** + * 根据管理耳号查询 + */ + BasSheep selectBasSheepByManageTags(String manageTags); + + } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/service/IBasSheepService.java b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/service/IBasSheepService.java index 76efcf7..3d94ce2 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/service/IBasSheepService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/service/IBasSheepService.java @@ -58,4 +58,6 @@ public interface IBasSheepService * @return 结果 */ public int deleteBasSheepById(Long id); + + BasSheep selectBasSheepByManageTags(String trim); } diff --git a/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/service/impl/BasSheepServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/service/impl/BasSheepServiceImpl.java index cdc9cdd..5c4aa1c 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/service/impl/BasSheepServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/produce/sheep/service/impl/BasSheepServiceImpl.java @@ -93,4 +93,10 @@ public class BasSheepServiceImpl implements IBasSheepService { return basSheepMapper.deleteBasSheepById(id); } + + + @Override + public BasSheep selectBasSheepByManageTags(String manageTags){ + return basSheepMapper.selectBasSheepByManageTags(manageTags); + } } diff --git a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/transition_info/ScTransitionInfoMapper.xml b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/transition_info/ScTransitionInfoMapper.xml index dc1c5c5..027b6f3 100644 --- a/zhyc-module/src/main/resources/mapper/produce/manage_sheep/transition_info/ScTransitionInfoMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/manage_sheep/transition_info/ScTransitionInfoMapper.xml @@ -1,45 +1,60 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - + + + + + + + + + + + + + - select id, sheep_id, trans_to, trans_from, trans_type, technician, status, comment, create_by, create_time from sc_transition_info + SELECT t.*, bv.variety AS varietyName, + CASE t.trans_type + WHEN 0 THEN '内部转场' + WHEN 1 THEN '跨场转场' + WHEN 2 THEN '销售转场' + ELSE '未知' + END AS trans_type_text + FROM sc_transition_info t + LEFT JOIN bas_sheep_variety bv ON t.variety_id = bv.id - + insert into sc_transition_info sheep_id, + variety_id, trans_to, trans_from, trans_type, @@ -48,9 +63,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" comment, create_by, create_time, - + #{sheepId}, + #{varietyId}, #{transTo}, #{transFrom}, #{transType}, @@ -59,13 +75,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{comment}, #{createBy}, #{createTime}, - + update sc_transition_info sheep_id = #{sheepId}, + variety_id = #{varietyId}, trans_to = #{transTo}, trans_from = #{transFrom}, trans_type = #{transType}, @@ -79,11 +96,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from sc_transition_info where id = #{id} + delete + from sc_transition_info + where id = #{id} - delete from sc_transition_info where id in + delete from sc_transition_info where id in #{id} diff --git a/zhyc-module/src/main/resources/mapper/produce/other/fixHoof/ScFixHoofMapper.xml b/zhyc-module/src/main/resources/mapper/produce/other/fixHoof/ScFixHoofMapper.xml index d3e7661..fdd5659 100644 --- a/zhyc-module/src/main/resources/mapper/produce/other/fixHoof/ScFixHoofMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/other/fixHoof/ScFixHoofMapper.xml @@ -6,7 +6,7 @@ - + @@ -18,16 +18,17 @@ select fh.id, - fh.sheep_id, + bs.manage_tags AS manageTags, fh.sheepfold, - sf.sheepfold_name as sheepfoldName, + sf.sheepfold_name AS sheepfoldName, fh.variety_id, - bv.variety as varietyName, + bv.variety AS varietyName, fh.comment, fh.technician, fh.create_by, fh.create_time from sc_fix_hoof fh + left join bas_sheep bs on fh.sheep_id = bs.id left join da_sheepfold sf on fh.sheepfold = sf.id left join bas_sheep_variety bv on fh.variety_id = bv.id @@ -43,6 +44,9 @@ and create_time between #{params.beginCreateTime} and #{params.endCreateTime} + + and bs.manage_tags like concat('%', #{manageTags}, '%') + @@ -97,4 +101,6 @@ #{id} + + \ No newline at end of file diff --git a/zhyc-module/src/main/resources/mapper/produce/sheep/BasSheepMapper.xml b/zhyc-module/src/main/resources/mapper/produce/sheep/BasSheepMapper.xml index 18ece91..de4fe9f 100644 --- a/zhyc-module/src/main/resources/mapper/produce/sheep/BasSheepMapper.xml +++ b/zhyc-module/src/main/resources/mapper/produce/sheep/BasSheepMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - + SELECT s.id, + s.sheepfold_id AS sheepfoldId, + sf.sheepfold_name AS sheepfoldName, + s.variety_id AS varietyId, + bv.variety AS varietyName + FROM bas_sheep s + LEFT JOIN da_sheepfold sf ON s.sheepfold_id = sf.id + LEFT JOIN bas_sheep_variety bv ON s.variety_id = bv.id + WHERE s.id = #{id} + + + @@ -234,9 +249,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from bas_sheep where id in + delete from bas_sheep where id in #{id} + + \ No newline at end of file