diff --git a/.gitignore b/.gitignore index ed8368a..7feea44 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ nbdist/ !*/build/*.java !*/build/*.html !*/build/*.xml +/zhyc-module/src/main/java/com/zhyc/module/group_management/service/impl/GroupServiceImpl.java diff --git a/zhyc-module/src/main/java/com/zhyc/module/fileManagement/controller/BasSheepGroupMappingController.java b/zhyc-module/src/main/java/com/zhyc/module/fileManagement/controller/BasSheepGroupMappingController.java index b1d3417..99aac40 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/fileManagement/controller/BasSheepGroupMappingController.java +++ b/zhyc-module/src/main/java/com/zhyc/module/fileManagement/controller/BasSheepGroupMappingController.java @@ -1,17 +1,14 @@ package com.zhyc.module.fileManagement.controller; +import java.util.Arrays; import java.util.List; +import java.util.Map; import javax.servlet.http.HttpServletResponse; + +import com.zhyc.common.utils.StringUtils; 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; @@ -46,6 +43,24 @@ public class BasSheepGroupMappingController extends BaseController return getDataTable(list); } + @PreAuthorize("@ss.hasPermi('sheep_grouping:sheep_grouping:list')") + @GetMapping("/listJoin") + public TableDataInfo list( + @RequestParam(required = false) Long sheepId, + @RequestParam(required = false) Long groupId, + @RequestParam(required = false) String bsManageTags) { + + List earList = null; + if (StringUtils.hasText(bsManageTags)) { + earList = Arrays.asList(bsManageTags.split("[,,\\s]+")); + } + startPage(); + List> list = basSheepGroupMappingService + .selectBasSheepGroupMappingList(sheepId, groupId, earList); + return getDataTable(list); + } + + /** * 导出羊只分组关联列表 */ diff --git a/zhyc-module/src/main/java/com/zhyc/module/fileManagement/mapper/BasSheepGroupMappingMapper.java b/zhyc-module/src/main/java/com/zhyc/module/fileManagement/mapper/BasSheepGroupMappingMapper.java index f38bf34..d919e95 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/fileManagement/mapper/BasSheepGroupMappingMapper.java +++ b/zhyc-module/src/main/java/com/zhyc/module/fileManagement/mapper/BasSheepGroupMappingMapper.java @@ -1,8 +1,10 @@ package com.zhyc.module.fileManagement.mapper; import java.util.List; -import com.zhyc.module.fileManagement.domain.BasSheepGroupMapping; +import java.util.Map; +import com.zhyc.module.fileManagement.domain.BasSheepGroupMapping; +import org.apache.ibatis.annotations.Param; /** * 羊只分组关联Mapper接口 * @@ -27,6 +29,20 @@ public interface BasSheepGroupMappingMapper */ public List selectBasSheepGroupMappingList(BasSheepGroupMapping basSheepGroupMapping); + + /** + * 联表查询羊只分组关联列表(支持耳号列表) + */ + List> selectBasSheepGroupMappingList( + @Param("sheepId") Long sheepId, + @Param("groupId") Long groupId, + @Param("bsManageTags") List bsManageTags + ); + + + + + /** * 新增羊只分组关联 * diff --git a/zhyc-module/src/main/java/com/zhyc/module/fileManagement/service/IBasSheepGroupMappingService.java b/zhyc-module/src/main/java/com/zhyc/module/fileManagement/service/IBasSheepGroupMappingService.java index febb461..0c543e4 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/fileManagement/service/IBasSheepGroupMappingService.java +++ b/zhyc-module/src/main/java/com/zhyc/module/fileManagement/service/IBasSheepGroupMappingService.java @@ -1,6 +1,8 @@ package com.zhyc.module.fileManagement.service; import java.util.List; +import java.util.Map; + import com.zhyc.module.fileManagement.domain.BasSheepGroupMapping; /** @@ -27,6 +29,13 @@ public interface IBasSheepGroupMappingService */ public List selectBasSheepGroupMappingList(BasSheepGroupMapping basSheepGroupMapping); + + /** + * 联表查询羊只分组关联列表(支持耳号列表) + */ + List> selectBasSheepGroupMappingList(Long sheepId, Long groupId, List bsManageTags); + + /** * 新增羊只分组关联 * @@ -58,6 +67,4 @@ public interface IBasSheepGroupMappingService * @return 结果 */ public int deleteBasSheepGroupMappingById(Long id); - - } diff --git a/zhyc-module/src/main/java/com/zhyc/module/fileManagement/service/impl/BasSheepGroupMappingServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/fileManagement/service/impl/BasSheepGroupMappingServiceImpl.java index d428848..f119bed 100644 --- a/zhyc-module/src/main/java/com/zhyc/module/fileManagement/service/impl/BasSheepGroupMappingServiceImpl.java +++ b/zhyc-module/src/main/java/com/zhyc/module/fileManagement/service/impl/BasSheepGroupMappingServiceImpl.java @@ -1,6 +1,8 @@ package com.zhyc.module.fileManagement.service.impl; import java.util.List; +import java.util.Map; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zhyc.module.fileManagement.mapper.BasSheepGroupMappingMapper; @@ -43,6 +45,13 @@ public class BasSheepGroupMappingServiceImpl implements IBasSheepGroupMappingSer return basSheepGroupMappingMapper.selectBasSheepGroupMappingList(basSheepGroupMapping); } + + @Override + public List> selectBasSheepGroupMappingList( + Long sheepId, Long groupId, List bsManageTags) { + return basSheepGroupMappingMapper.selectBasSheepGroupMappingList(sheepId, groupId, bsManageTags); + } + /** * 新增羊只分组关联 * @@ -91,6 +100,4 @@ public class BasSheepGroupMappingServiceImpl implements IBasSheepGroupMappingSer return basSheepGroupMappingMapper.deleteBasSheepGroupMappingById(id); } - - } diff --git a/zhyc-module/src/main/resources/mapper/fileManagement/BasSheepGroupMappingMapper.xml b/zhyc-module/src/main/resources/mapper/fileManagement/BasSheepGroupMappingMapper.xml index ef8d1de..f67f033 100644 --- a/zhyc-module/src/main/resources/mapper/fileManagement/BasSheepGroupMappingMapper.xml +++ b/zhyc-module/src/main/resources/mapper/fileManagement/BasSheepGroupMappingMapper.xml @@ -14,13 +14,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select id, sheep_id, group_id from bas_sheep_group_mapping - + + SELECT + m.id, + m.sheep_id, + m.group_id, + s.id AS bs_sheep_id, + s.bs_manage_tags, + s.variety, + s.gender, + s.name, + s.birthday, + s.parity, + s.month_age, + s.breed, + s.birth_weight, + s.weaning_weight, + s.current_weight, + s.father_manage_tags, + s.mother_manage_tags, + s.family + FROM bas_sheep_group_mapping m + JOIN sheep_file s ON s.id = m.sheep_id + + AND m.sheep_id = #{sheepId} + AND m.group_id = #{groupId} + + AND s.bs_manage_tags IN + + #{bsManageTag} + + + ORDER BY m.id + + + + + +