修改羊只分组功能
This commit is contained in:
commit
0aeff5f82f
1
.gitignore
vendored
1
.gitignore
vendored
@ -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
|
||||
|
@ -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<String> earList = null;
|
||||
if (StringUtils.hasText(bsManageTags)) {
|
||||
earList = Arrays.asList(bsManageTags.split("[,,\\s]+"));
|
||||
}
|
||||
startPage();
|
||||
List<Map<String,Object>> list = basSheepGroupMappingService
|
||||
.selectBasSheepGroupMappingList(sheepId, groupId, earList);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出羊只分组关联列表
|
||||
*/
|
||||
|
@ -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<BasSheepGroupMapping> selectBasSheepGroupMappingList(BasSheepGroupMapping basSheepGroupMapping);
|
||||
|
||||
|
||||
/**
|
||||
* 联表查询羊只分组关联列表(支持耳号列表)
|
||||
*/
|
||||
List<Map<String, Object>> selectBasSheepGroupMappingList(
|
||||
@Param("sheepId") Long sheepId,
|
||||
@Param("groupId") Long groupId,
|
||||
@Param("bsManageTags") List<String> bsManageTags
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增羊只分组关联
|
||||
*
|
||||
|
@ -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<BasSheepGroupMapping> selectBasSheepGroupMappingList(BasSheepGroupMapping basSheepGroupMapping);
|
||||
|
||||
|
||||
/**
|
||||
* 联表查询羊只分组关联列表(支持耳号列表)
|
||||
*/
|
||||
List<Map<String, Object>> selectBasSheepGroupMappingList(Long sheepId, Long groupId, List<String> bsManageTags);
|
||||
|
||||
|
||||
/**
|
||||
* 新增羊只分组关联
|
||||
*
|
||||
@ -58,6 +67,4 @@ public interface IBasSheepGroupMappingService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasSheepGroupMappingById(Long id);
|
||||
|
||||
|
||||
}
|
||||
|
@ -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<Map<String, Object>> selectBasSheepGroupMappingList(
|
||||
Long sheepId, Long groupId, List<String> bsManageTags) {
|
||||
return basSheepGroupMappingMapper.selectBasSheepGroupMappingList(sheepId, groupId, bsManageTags);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增羊只分组关联
|
||||
*
|
||||
@ -91,6 +100,4 @@ public class BasSheepGroupMappingServiceImpl implements IBasSheepGroupMappingSer
|
||||
return basSheepGroupMappingMapper.deleteBasSheepGroupMappingById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -14,14 +14,58 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select id, sheep_id, group_id from bas_sheep_group_mapping
|
||||
</sql>
|
||||
|
||||
<select id="selectBasSheepGroupMappingList" parameterType="BasSheepGroupMapping" resultMap="BasSheepGroupMappingResult">
|
||||
<include refid="selectBasSheepGroupMappingVo"/>
|
||||
<!-- <select id="selectBasSheepGroupMappingList" parameterType="BasSheepGroupMapping" resultMap="BasSheepGroupMappingResult">-->
|
||||
<!-- <include refid="selectBasSheepGroupMappingVo"/>-->
|
||||
<!-- <where> -->
|
||||
<!-- <if test="sheepId != null "> and sheep_id = #{sheepId}</if>-->
|
||||
<!-- <if test="groupId != null "> and group_id = #{groupId}</if>-->
|
||||
<!-- </where>-->
|
||||
<!-- </select>-->
|
||||
|
||||
<select id="selectBasSheepGroupMappingList"
|
||||
parameterType="map"
|
||||
resultType="map"> <!-- 1. 返回 map 方便前端直接取值 -->
|
||||
|
||||
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
|
||||
<where>
|
||||
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
|
||||
<if test="groupId != null "> and group_id = #{groupId}</if>
|
||||
<if test="sheepId != null"> AND m.sheep_id = #{sheepId}</if>
|
||||
<if test="groupId != null"> AND m.group_id = #{groupId}</if>
|
||||
<if test="bsManageTags != null and bsManageTags.size > 0">
|
||||
AND s.bs_manage_tags IN
|
||||
<foreach collection="bsManageTags" item="bsManageTag " open="(" separator="," close=")">
|
||||
#{bsManageTag}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY m.id
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectBasSheepGroupMappingById" parameterType="Long" resultMap="BasSheepGroupMappingResult">
|
||||
<include refid="selectBasSheepGroupMappingVo"/>
|
||||
where id = #{id}
|
||||
|
Loading…
x
Reference in New Issue
Block a user