From b8fe4c7b5f4f03dcfadff95702a07040ab9a1b57 Mon Sep 17 00:00:00 2001 From: cjl <276999030@qq.com> Date: Wed, 27 Sep 2023 11:08:28 +0800 Subject: [PATCH] feat:补充提交 --- screen-api/src/main/resources/mapper/UserMapper.xml | 2 screen-api/src/main/java/com/moral/api/pojo/query/allocationextension/AllocationExtensionPageCond.java | 4 ++ screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java | 4 ++ screen-api/src/main/resources/mapper/AllocationExtensionMapper.xml | 6 +++ screen-api/src/main/java/com/moral/api/pojo/query/allocation/AllocationPageCond.java | 4 ++ screen-api/src/main/java/com/moral/api/service/AllocationService.java | 2 + screen-api/src/main/java/com/moral/api/mapper/ResponsibilityUnitMapper.java | 15 +++++++ screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java | 22 ++++++++++- screen-api/src/main/resources/mapper/ResponsibilityUnitMapper.xml | 42 +++++++++++++++++++++ screen-api/src/main/resources/mapper/AllocationMapper.xml | 7 +++ 10 files changed, 105 insertions(+), 3 deletions(-) diff --git a/screen-api/src/main/java/com/moral/api/mapper/ResponsibilityUnitMapper.java b/screen-api/src/main/java/com/moral/api/mapper/ResponsibilityUnitMapper.java index 424b762..f7c0a00 100644 --- a/screen-api/src/main/java/com/moral/api/mapper/ResponsibilityUnitMapper.java +++ b/screen-api/src/main/java/com/moral/api/mapper/ResponsibilityUnitMapper.java @@ -3,6 +3,21 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.moral.api.entity.ResponsibilityUnit; +import org.apache.ibatis.annotations.Param; + +import java.util.List; public interface ResponsibilityUnitMapper extends BaseMapper<ResponsibilityUnit> { + + /** + * ������������������id + * @param id + * @return + */ + List<Integer> selectResultList(@Param("id") Integer id); + + /** + * ������������id + */ + List<Integer> selectCodeList(@Param("code") String code,@Param("id") Integer id); } diff --git a/screen-api/src/main/java/com/moral/api/pojo/query/allocation/AllocationPageCond.java b/screen-api/src/main/java/com/moral/api/pojo/query/allocation/AllocationPageCond.java index a9f41f7..8cc2b87 100644 --- a/screen-api/src/main/java/com/moral/api/pojo/query/allocation/AllocationPageCond.java +++ b/screen-api/src/main/java/com/moral/api/pojo/query/allocation/AllocationPageCond.java @@ -8,6 +8,7 @@ import lombok.experimental.Accessors; import java.io.Serializable; +import java.util.List; /** * <p> @@ -51,4 +52,7 @@ @ApiModelProperty(value = "������������") private PageCond page; + @ApiModelProperty(value = "������������list") + private List<Integer> unitList; + } diff --git a/screen-api/src/main/java/com/moral/api/pojo/query/allocationextension/AllocationExtensionPageCond.java b/screen-api/src/main/java/com/moral/api/pojo/query/allocationextension/AllocationExtensionPageCond.java index 63d70bf..f40422d 100644 --- a/screen-api/src/main/java/com/moral/api/pojo/query/allocationextension/AllocationExtensionPageCond.java +++ b/screen-api/src/main/java/com/moral/api/pojo/query/allocationextension/AllocationExtensionPageCond.java @@ -8,6 +8,7 @@ import lombok.experimental.Accessors; import java.io.Serializable; +import java.util.List; /** * <p> @@ -46,4 +47,7 @@ @ApiModelProperty(value = "������������") private PageCond page; + + @ApiModelProperty(value = "������������list") + private List<Integer> unitList; } diff --git a/screen-api/src/main/java/com/moral/api/service/AllocationService.java b/screen-api/src/main/java/com/moral/api/service/AllocationService.java index 8fb6916..1d5a924 100644 --- a/screen-api/src/main/java/com/moral/api/service/AllocationService.java +++ b/screen-api/src/main/java/com/moral/api/service/AllocationService.java @@ -29,6 +29,8 @@ List<Allocation> selectAll(Map<String,Object> map); + List<Integer> unitResult(); + Map<String, Object> selectUnitView(Map<String,Object> map); diff --git a/screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java index ff1f734..86b05aa 100644 --- a/screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java +++ b/screen-api/src/main/java/com/moral/api/service/impl/AllocationExtensionServiceImpl.java @@ -20,6 +20,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.List; + /** * <p> * ��������������� ��������������� @@ -64,6 +66,8 @@ @Override public Page<AllocationExtensionPageExt> extPage(AllocationExtensionPageCond allocationExtensionPageCond) { + List<Integer> unitList = allocationService.unitResult(); + allocationExtensionPageCond.setUnitList(unitList); return this.baseMapper.extPage(allocationExtensionPageCond.getPage().convertPage(), allocationExtensionPageCond); } diff --git a/screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java index 35a76ce..2a0cad4 100644 --- a/screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java +++ b/screen-api/src/main/java/com/moral/api/service/impl/AllocationServiceImpl.java @@ -18,6 +18,7 @@ import com.moral.api.service.AllocationExtensionService; import com.moral.api.service.ApproveTableService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; @@ -69,9 +70,9 @@ @Autowired private SysDictTypeMapper sysDictTypeMapper; @Autowired - private SysDictDataMapper sysDictDataMapper; - @Autowired private ResponsibilityUnitMapper responsibilityUnitMapper; + @Autowired + private SysDictDataMapper sysDictDataMapper; @Autowired private RedisTemplate redisTemplate; @Autowired @@ -455,6 +456,8 @@ @Override public Page<AllocationPageExt> extPage(AllocationPageCond allocationPageCond) { + List<Integer> unitList = unitResult(); + allocationPageCond.setUnitList(unitList); return this.baseMapper.extPage(allocationPageCond.getPage().convertPage(), allocationPageCond); } @@ -576,4 +579,19 @@ fileTableService.upDateResult(allocationExtensionAddCond.getFileList(),allocationExtension.getId(), FileTableEnum.ALLOCATION_EXTENSION.value); return true; } + + @Override + public List<Integer> unitResult() { + QxUser user = UserHelper.getCurrentUser(); + Integer unitId = Objects.nonNull(user.getUnitId())?user.getUnitId():0; + List<Integer> userList = responsibilityUnitMapper.selectCodeList("JBD",user.getUserId()); + if(CollectionUtils.isNotEmpty(userList)){ + return new ArrayList<>(); + } + userList = responsibilityUnitMapper.selectResultList(unitId); + if(CollectionUtils.isNotEmpty(userList)){ + return userList; + } + return Arrays.asList(0); + } } diff --git a/screen-api/src/main/resources/mapper/AllocationExtensionMapper.xml b/screen-api/src/main/resources/mapper/AllocationExtensionMapper.xml index dfaa03c..2b48a42 100644 --- a/screen-api/src/main/resources/mapper/AllocationExtensionMapper.xml +++ b/screen-api/src/main/resources/mapper/AllocationExtensionMapper.xml @@ -64,6 +64,12 @@ <if test="allocation.endTime != null and allocation.endTime !='' "> and date(t1.escalation_time) <![CDATA[<=]]> #{allocation.endTime} </if> + <if test="allocation.unitList != null and allocation.unitList.size !=0"> + and t1.unit_id in + <foreach collection="allocation.unitList" item="id" index="index" open="(" close=")" separator=","> + #{id} + </foreach> + </if> </where> order by t1.escalation_time desc,t1.allocation_id desc diff --git a/screen-api/src/main/resources/mapper/AllocationMapper.xml b/screen-api/src/main/resources/mapper/AllocationMapper.xml index 32c9a32..409e0a6 100644 --- a/screen-api/src/main/resources/mapper/AllocationMapper.xml +++ b/screen-api/src/main/resources/mapper/AllocationMapper.xml @@ -90,6 +90,13 @@ <if test="allocation.endTime != null and allocation.endTime !='' "> and date(allocation.escalation_time) <![CDATA[<=]]> #{allocation.endTime} </if> + <if test="allocation.unitList != null and allocation.unitList.size !=0"> + and allocation.unit_id in + <foreach collection="allocation.unitList" item="id" index="index" open="(" close=")" separator=","> + #{id} + </foreach> + + </if> </where> order by allocation.escalation_time desc,allocation.allocation_id desc </select> diff --git a/screen-api/src/main/resources/mapper/ResponsibilityUnitMapper.xml b/screen-api/src/main/resources/mapper/ResponsibilityUnitMapper.xml new file mode 100644 index 0000000..5433c08 --- /dev/null +++ b/screen-api/src/main/resources/mapper/ResponsibilityUnitMapper.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.moral.api.mapper.ResponsibilityUnitMapper"> + + + <select id="selectResultList" resultType="java.lang.Integer"> + select c.unit_id + from responsibility_unit c where c.area_code in ( + + SELECT area_code from sys_area where area_code = (select area_code from responsibility_unit where unit_id = #{id}) + union + SELECT + area_code + FROM + ( + SELECT + t1.area_code,t1.area_name, + IF(FIND_IN_SET(parent_code,@pids), @pids := concat(@pids, ',', area_code), 0) as ischild + FROM + ( + SELECT + area_code, parent_code, area_name + FROM + sys_area + ORDER BY area_code + )t1, + (SELECT @pids := (select area_code from responsibility_unit where unit_id = #{id}) ) t2 + )t3 where ischild != 0 + + ) + </select> + + <select id="selectCodeList" resultType="java.lang.Integer"> + select t.id from sys_dict_type t + left join sys_dict_data t1 on t1.dict_type_id = t.id + + where t.is_delete = 0 and t.name = #{code} and t1.dataKey = #{id} and t1.is_delete = 0 + + + </select> + +</mapper> \ No newline at end of file diff --git a/screen-api/src/main/resources/mapper/UserMapper.xml b/screen-api/src/main/resources/mapper/UserMapper.xml index fa2b662..9d655cf 100644 --- a/screen-api/src/main/resources/mapper/UserMapper.xml +++ b/screen-api/src/main/resources/mapper/UserMapper.xml @@ -38,7 +38,7 @@ <select id="selectUserInfo" resultMap="userInfoMap"> SELECT u.id, u.account, u.password, u.user_name, u.email, u.mobile, u.wechat ,u.organization_id, u.expire_time, u.is_delete,u.is_Admin, o.name, o.location_level_code, o.expire_time org_expire_time, - a.id group_id , a.group_name + a.id group_id , a.group_name,u.unit_id FROM `user` u LEFT JOIN (SELECT ug.user_id,g.id,g.group_name FROM `user_group` ug ,`group` g WHERE ug.group_id=g.id AND g.is_delete = 0 -- Gitblit v1.8.0