From bd5ab921857b0871f7b7f5b96408dae7239c13a0 Mon Sep 17 00:00:00 2001 From: LSH Date: 星期四, 02 十一月 2023 13:25:14 +0800 Subject: [PATCH] # --- src/main/java/com/zy/crm/manager/service/CstmrService.java | 7 ++- src/main/java/com/zy/crm/manager/controller/CstmrController.java | 6 +++ src/main/java/com/zy/crm/manager/service/impl/CstmrServiceImpl.java | 16 ++++---- src/main/resources/mapper/CstmrMapper.xml | 64 +++++++++++++++----------------- src/main/java/com/zy/crm/manager/mapper/CstmrMapper.java | 8 ++-- 5 files changed, 52 insertions(+), 49 deletions(-) diff --git a/src/main/java/com/zy/crm/manager/controller/CstmrController.java b/src/main/java/com/zy/crm/manager/controller/CstmrController.java index 2b89d7a..4e9fb14 100644 --- a/src/main/java/com/zy/crm/manager/controller/CstmrController.java +++ b/src/main/java/com/zy/crm/manager/controller/CstmrController.java @@ -119,6 +119,7 @@ } } + Long director = null; if (deptId==null && userId == null){ if (getRole().getId()==3){ userId = getUserId(); @@ -126,12 +127,14 @@ deptId = getDeptId(); userId = null; } + director = getUserId(); } return R.ok(cstmrService.getPage3(new Page<>(curr, limit) , getHostId() , deptId == null ? null : String.valueOf(deptId) , userId + , director , Cools.isEmpty(followerName) ? null : ids , conditionName , condition) @@ -172,6 +175,7 @@ } } + Long director = null; if (deptId==null && userId == null){ if (getRole().getId()==3){ userId = getUserId(); @@ -179,12 +183,14 @@ deptId = getDeptId(); userId = null; } + director = getUserId(); } return R.ok(cstmrService.getPage33(new Page<>(curr, limit) , getHostId() , deptId == null ? null : String.valueOf(deptId) , userId + , director , Cools.isEmpty(followerName) ? null : ids , conditionName , condition) diff --git a/src/main/java/com/zy/crm/manager/mapper/CstmrMapper.java b/src/main/java/com/zy/crm/manager/mapper/CstmrMapper.java index 74c052d..3b42a91 100644 --- a/src/main/java/com/zy/crm/manager/mapper/CstmrMapper.java +++ b/src/main/java/com/zy/crm/manager/mapper/CstmrMapper.java @@ -18,10 +18,10 @@ Cstmr selectCstmrByNewestUuid(@Param("hostId") Long hostId); List<Cstmr> listByPage2(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") Long deptId, @Param("userId") Long userId,@Param("roleId") Long roleId, @Param("conditionName") String conditionName ,@Param("condition") String condition); - List<Cstmr> listByPage1(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId, @Param("conditionName") String conditionName ,@Param("condition") String condition); - List<Cstmr> listByPage11(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId, @Param("conditionName") String conditionName ,@Param("condition") String condition); - List<Cstmr> listByPage3(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("cstmrIds") List<Integer> cstmrIds, @Param("conditionName") String conditionName ,@Param("condition") String condition); - List<Cstmr> listByPage33(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("cstmrIds") List<Integer> cstmrIds, @Param("conditionName") String conditionName ,@Param("condition") String condition); + List<Cstmr> listByPage1(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("director")Long director, @Param("conditionName") String conditionName ,@Param("condition") String condition); + List<Cstmr> listByPage11(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("director")Long director, @Param("conditionName") String conditionName ,@Param("condition") String condition); + List<Cstmr> listByPage3(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("director")Long director,@Param("cstmrIds") List<Integer> cstmrIds, @Param("conditionName") String conditionName ,@Param("condition") String condition); + List<Cstmr> listByPage33(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("director")Long director,@Param("cstmrIds") List<Integer> cstmrIds, @Param("conditionName") String conditionName ,@Param("condition") String condition); List<Cstmr> listByPage(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("condition") String condition); List<Cstmr> listByPageCstmr2(Page<Cstmr> page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("userId") Long userId,@Param("condition") String condition); diff --git a/src/main/java/com/zy/crm/manager/service/CstmrService.java b/src/main/java/com/zy/crm/manager/service/CstmrService.java index aad8426..249df21 100644 --- a/src/main/java/com/zy/crm/manager/service/CstmrService.java +++ b/src/main/java/com/zy/crm/manager/service/CstmrService.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.service.IService; import com.zy.crm.manager.entity.Cstmr; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -13,9 +14,9 @@ String getUuid(Long hostId); Page<Cstmr> getPage2(Page<Cstmr> page, Long hostId, Long deptId, Long userId,Long roleId, String conditionName, String condition); - Page<Cstmr> getPage1(Page<Cstmr> page, Long hostId, String deptId, Long userId, String conditionName, String condition); - Page<Cstmr> getPage3(Page<Cstmr> page, Long hostId, String deptId, Long userId, List<Integer> cstmrIds, String conditionName, String condition); - Page<Cstmr> getPage33(Page<Cstmr> page, Long hostId, String deptId, Long userId, List<Integer> cstmrIds, String conditionName, String condition); + Page<Cstmr> getPage1(Page<Cstmr> page, Long hostId, String deptId, Long userId,Long director, String conditionName, String condition); + Page<Cstmr> getPage3(Page<Cstmr> page, Long hostId, String deptId, Long userId,Long director, List<Integer> cstmrIds, String conditionName, String condition); + Page<Cstmr> getPage33(Page<Cstmr> page, Long hostId, String deptId, Long userId,Long director, List<Integer> cstmrIds, String conditionName, String condition); Page<Cstmr> getPage(Page<Cstmr> page, Long hostId, String deptId, Long userId, String condition); Page<Cstmr> getPageCstmr2(Page<Cstmr> page, Long hostId, String deptId, Long userId, String condition); diff --git a/src/main/java/com/zy/crm/manager/service/impl/CstmrServiceImpl.java b/src/main/java/com/zy/crm/manager/service/impl/CstmrServiceImpl.java index c206eea..0a38ccc 100644 --- a/src/main/java/com/zy/crm/manager/service/impl/CstmrServiceImpl.java +++ b/src/main/java/com/zy/crm/manager/service/impl/CstmrServiceImpl.java @@ -47,25 +47,25 @@ } @Override - public Page<Cstmr> getPage1(Page<Cstmr> page, Long hostId, String deptId, Long userId,String conditionName, String condition) { - return page.setRecords(baseMapper.listByPage1(page, hostId, deptId, userId,conditionName, condition)); + public Page<Cstmr> getPage1(Page<Cstmr> page, Long hostId, String deptId, Long userId, Long director, String conditionName, String condition) { + return page.setRecords(baseMapper.listByPage1(page, hostId, deptId, userId, director, conditionName, condition)); } @Override - public Page<Cstmr> getPage3(Page<Cstmr> page, Long hostId, String deptId, Long userId, List<Integer> cstmrIds, String conditionName, String condition) { + public Page<Cstmr> getPage3(Page<Cstmr> page, Long hostId, String deptId, Long userId, Long director, List<Integer> cstmrIds, String conditionName, String condition) { if (cstmrIds==null){ - return page.setRecords(baseMapper.listByPage1(page, hostId, deptId, userId,conditionName, condition)); + return page.setRecords(baseMapper.listByPage1(page, hostId, deptId, userId, director,conditionName, condition)); }else { - return page.setRecords(baseMapper.listByPage3(page, hostId, deptId, userId,cstmrIds,conditionName, condition)); + return page.setRecords(baseMapper.listByPage3(page, hostId, deptId, userId, director,cstmrIds,conditionName, condition)); } } @Override - public Page<Cstmr> getPage33(Page<Cstmr> page, Long hostId, String deptId, Long userId, List<Integer> cstmrIds, String conditionName, String condition) { + public Page<Cstmr> getPage33(Page<Cstmr> page, Long hostId, String deptId, Long userId, Long director, List<Integer> cstmrIds, String conditionName, String condition) { if (cstmrIds==null){ - return page.setRecords(baseMapper.listByPage11(page, hostId, deptId, userId,conditionName, condition)); + return page.setRecords(baseMapper.listByPage11(page, hostId, deptId, userId, director,conditionName, condition)); }else { - return page.setRecords(baseMapper.listByPage33(page, hostId, deptId, userId,cstmrIds,conditionName, condition)); + return page.setRecords(baseMapper.listByPage33(page, hostId, deptId, userId, director,cstmrIds,conditionName, condition)); } } diff --git a/src/main/resources/mapper/CstmrMapper.xml b/src/main/resources/mapper/CstmrMapper.xml index 75c8584..605cc1f 100644 --- a/src/main/resources/mapper/CstmrMapper.xml +++ b/src/main/resources/mapper/CstmrMapper.xml @@ -170,14 +170,11 @@ and ( <if test="userId != null and userId != ''"> - user_id = #{userId} + mc.mp.user_id = #{userId} + or + mc.mp.director = #{userId} + or </if> - <if test="userId == null or userId == ''"> - user_id is not null - </if> - or - director = #{userId} - or mc.id in ( select @@ -240,6 +237,9 @@ </if> </otherwise> </choose> + <if test="director != null and director != ''"> + or mc.director = #{director} + </if> ORDER BY mc.create_time DESC </select> @@ -256,7 +256,7 @@ (CHARINDEX(','+#{deptId}+',', ','+sd.path+',') > 0 OR sd.id = #{deptId}) or ( - user_id = #{userId} + mc.user_id = #{userId} or mc.id in ( @@ -273,14 +273,11 @@ and ( <if test="userId != null and userId != ''"> - user_id = #{userId} + mc.mp.user_id = #{userId} + or + mc.mp.director = #{userId} + or </if> - <if test="userId == null or userId == ''"> - user_id is not null - </if> - or - director = #{userId} - or mc.id in ( select @@ -343,6 +340,9 @@ </if> </otherwise> </choose> + <if test="director != null and director != ''"> + or mc.director = #{director} + </if> ORDER BY mc.create_time DESC </select> @@ -445,14 +445,11 @@ and ( <if test="userId != null and userId != ''"> - user_id = #{userId} + mc.mp.user_id = #{userId} + or + mc.mp.director = #{userId} + or </if> - <if test="userId == null or userId == ''"> - user_id is not null - </if> - or - director = #{userId} - or mc.id in ( select @@ -521,12 +518,13 @@ </if> </otherwise> </choose> - - + <if test="director != null and director != ''"> + or mc.director = #{director} + </if> ORDER BY mc.create_time DESC </select> - <select id="listByPage3" resultMap="BaseResultMap"> + <select id="listByPage33" resultMap="BaseResultMap"> SELECT mc.* FROM man_cstmr mc @@ -556,14 +554,11 @@ and ( <if test="userId != null and userId != ''"> - user_id = #{userId} + mc.mp.user_id = #{userId} + or + mc.mp.director = #{userId} + or </if> - <if test="userId == null or userId == ''"> - user_id is not null - </if> - or - director = #{userId} - or mc.id in ( select @@ -632,8 +627,9 @@ </if> </otherwise> </choose> - - + <if test="director != null and director != ''"> + or mc.director = #{director} + </if> ORDER BY mc.create_time DESC </select> -- Gitblit v1.9.1