Commit 7cbd447b694bd25bc47530df9432789c7891f020

Authored by YunaiV
1 parent 945d3796

【代码优化】CRM:移除多余的 selectBatchIds 逻辑

yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/clue/CrmClueMapper.java
@@ -10,9 +10,6 @@ import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum; @@ -10,9 +10,6 @@ import cn.iocoder.yudao.module.crm.enums.common.CrmSceneTypeEnum;
10 import cn.iocoder.yudao.module.crm.util.CrmPermissionUtils; 10 import cn.iocoder.yudao.module.crm.util.CrmPermissionUtils;
11 import org.apache.ibatis.annotations.Mapper; 11 import org.apache.ibatis.annotations.Mapper;
12 12
13 -import java.util.Collection;  
14 -import java.util.List;  
15 -  
16 /** 13 /**
17 * 线索 Mapper 14 * 线索 Mapper
18 * 15 *
@@ -40,15 +37,6 @@ public interface CrmClueMapper extends BaseMapperX<CrmClueDO> { @@ -40,15 +37,6 @@ public interface CrmClueMapper extends BaseMapperX<CrmClueDO> {
40 return selectJoinPage(pageReqVO, CrmClueDO.class, query); 37 return selectJoinPage(pageReqVO, CrmClueDO.class, query);
41 } 38 }
42 39
43 - default List<CrmClueDO> selectBatchIds(Collection<Long> ids, Long userId) {  
44 - MPJLambdaWrapperX<CrmClueDO> query = new MPJLambdaWrapperX<>();  
45 - // 拼接数据权限的查询条件  
46 - CrmPermissionUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CLUE.getType(), ids, userId);  
47 - query.selectAll(CrmClueDO.class).in(CrmClueDO::getId, ids).orderByDesc(CrmClueDO::getId);  
48 - // 拼接自身的查询条件  
49 - return selectJoinList(CrmClueDO.class, query);  
50 - }  
51 -  
52 default Long selectCountByFollow(Long userId) { 40 default Long selectCountByFollow(Long userId) {
53 MPJLambdaWrapperX<CrmClueDO> query = new MPJLambdaWrapperX<>(); 41 MPJLambdaWrapperX<CrmClueDO> query = new MPJLambdaWrapperX<>();
54 // 我负责的 + 非公海 42 // 我负责的 + 非公海
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractMapper.java
@@ -15,7 +15,6 @@ import cn.iocoder.yudao.module.crm.util.CrmPermissionUtils; @@ -15,7 +15,6 @@ import cn.iocoder.yudao.module.crm.util.CrmPermissionUtils;
15 import org.apache.ibatis.annotations.Mapper; 15 import org.apache.ibatis.annotations.Mapper;
16 16
17 import java.time.LocalDateTime; 17 import java.time.LocalDateTime;
18 -import java.util.Collection;  
19 import java.util.List; 18 import java.util.List;
20 19
21 /** 20 /**
@@ -77,15 +76,6 @@ public interface CrmContractMapper extends BaseMapperX&lt;CrmContractDO&gt; { @@ -77,15 +76,6 @@ public interface CrmContractMapper extends BaseMapperX&lt;CrmContractDO&gt; {
77 return selectJoinPage(pageReqVO, CrmContractDO.class, query); 76 return selectJoinPage(pageReqVO, CrmContractDO.class, query);
78 } 77 }
79 78
80 - default List<CrmContractDO> selectBatchIds(Collection<Long> ids, Long userId) {  
81 - MPJLambdaWrapperX<CrmContractDO> query = new MPJLambdaWrapperX<>();  
82 - // 构建数据权限连表条件  
83 - CrmPermissionUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTRACT.getType(), ids, userId);  
84 - // 拼接自身的查询条件  
85 - query.selectAll(CrmContractDO.class).in(CrmContractDO::getId, ids).orderByDesc(CrmContractDO::getId);  
86 - return selectJoinList(CrmContractDO.class, query);  
87 - }  
88 -  
89 default Long selectCountByContactId(Long contactId) { 79 default Long selectCountByContactId(Long contactId) {
90 return selectCount(CrmContractDO::getSignContactId, contactId); 80 return selectCount(CrmContractDO::getSignContactId, contactId);
91 } 81 }
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerMapper.java
@@ -20,7 +20,6 @@ import org.springframework.lang.Nullable; @@ -20,7 +20,6 @@ import org.springframework.lang.Nullable;
20 import org.springframework.util.Assert; 20 import org.springframework.util.Assert;
21 21
22 import java.time.LocalDateTime; 22 import java.time.LocalDateTime;
23 -import java.util.Collection;  
24 import java.util.List; 23 import java.util.List;
25 24
26 /** 25 /**
@@ -85,15 +84,6 @@ public interface CrmCustomerMapper extends BaseMapperX&lt;CrmCustomerDO&gt; { @@ -85,15 +84,6 @@ public interface CrmCustomerMapper extends BaseMapperX&lt;CrmCustomerDO&gt; {
85 return selectJoinPage(pageReqVO, CrmCustomerDO.class, query); 84 return selectJoinPage(pageReqVO, CrmCustomerDO.class, query);
86 } 85 }
87 86
88 - default List<CrmCustomerDO> selectBatchIds(Collection<Long> ids, Long ownerUserId) {  
89 - MPJLambdaWrapperX<CrmCustomerDO> query = new MPJLambdaWrapperX<>();  
90 - // 拼接数据权限的查询条件  
91 - CrmPermissionUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CUSTOMER.getType(), ids, ownerUserId);  
92 - // 拼接自身的查询条件  
93 - query.selectAll(CrmCustomerDO.class).in(CrmCustomerDO::getId, ids).orderByDesc(CrmCustomerDO::getId);  
94 - return selectJoinList(CrmCustomerDO.class, query);  
95 - }  
96 -  
97 default CrmCustomerDO selectByCustomerName(String name) { 87 default CrmCustomerDO selectByCustomerName(String name) {
98 return selectOne(CrmCustomerDO::getName, name); 88 return selectOne(CrmCustomerDO::getName, name);
99 } 89 }
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivableMapper.java
@@ -59,15 +59,6 @@ public interface CrmReceivableMapper extends BaseMapperX&lt;CrmReceivableDO&gt; { @@ -59,15 +59,6 @@ public interface CrmReceivableMapper extends BaseMapperX&lt;CrmReceivableDO&gt; {
59 return selectJoinPage(pageReqVO, CrmReceivableDO.class, query); 59 return selectJoinPage(pageReqVO, CrmReceivableDO.class, query);
60 } 60 }
61 61
62 - default List<CrmReceivableDO> selectBatchIds(Collection<Long> ids, Long userId) {  
63 - MPJLambdaWrapperX<CrmReceivableDO> query = new MPJLambdaWrapperX<>();  
64 - // 拼接数据权限的查询条件  
65 - CrmPermissionUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE.getType(), ids, userId);  
66 - // 拼接自身的查询条件  
67 - query.selectAll(CrmReceivableDO.class).in(CrmReceivableDO::getId, ids).orderByDesc(CrmReceivableDO::getId);  
68 - return selectJoinList(CrmReceivableDO.class, query);  
69 - }  
70 -  
71 default Long selectCountByAudit(Long userId) { 62 default Long selectCountByAudit(Long userId) {
72 MPJLambdaWrapperX<CrmReceivableDO> query = new MPJLambdaWrapperX<>(); 63 MPJLambdaWrapperX<CrmReceivableDO> query = new MPJLambdaWrapperX<>();
73 // 我负责的 + 非公海 64 // 我负责的 + 非公海
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/receivable/CrmReceivablePlanMapper.java
@@ -13,8 +13,6 @@ import cn.iocoder.yudao.module.crm.util.CrmPermissionUtils; @@ -13,8 +13,6 @@ import cn.iocoder.yudao.module.crm.util.CrmPermissionUtils;
13 import org.apache.ibatis.annotations.Mapper; 13 import org.apache.ibatis.annotations.Mapper;
14 14
15 import java.time.LocalDateTime; 15 import java.time.LocalDateTime;
16 -import java.util.Collection;  
17 -import java.util.List;  
18 import java.util.Objects; 16 import java.util.Objects;
19 17
20 /** 18 /**
@@ -74,15 +72,6 @@ public interface CrmReceivablePlanMapper extends BaseMapperX&lt;CrmReceivablePlanDO @@ -74,15 +72,6 @@ public interface CrmReceivablePlanMapper extends BaseMapperX&lt;CrmReceivablePlanDO
74 return selectJoinPage(pageReqVO, CrmReceivablePlanDO.class, query); 72 return selectJoinPage(pageReqVO, CrmReceivablePlanDO.class, query);
75 } 73 }
76 74
77 - default List<CrmReceivablePlanDO> selectBatchIds(Collection<Long> ids, Long userId) {  
78 - MPJLambdaWrapperX<CrmReceivablePlanDO> query = new MPJLambdaWrapperX<>();  
79 - // 拼接数据权限的查询条件  
80 - CrmPermissionUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_RECEIVABLE_PLAN.getType(), ids, userId);  
81 - // 拼接自身的查询条件  
82 - query.selectAll(CrmReceivablePlanDO.class).in(CrmReceivablePlanDO::getId, ids).orderByDesc(CrmReceivablePlanDO::getId);  
83 - return selectJoinList(CrmReceivablePlanDO.class, query);  
84 - }  
85 -  
86 default Long selectReceivablePlanCountByRemind(Long userId) { 75 default Long selectReceivablePlanCountByRemind(Long userId) {
87 MPJLambdaWrapperX<CrmReceivablePlanDO> query = new MPJLambdaWrapperX<>(); 76 MPJLambdaWrapperX<CrmReceivablePlanDO> query = new MPJLambdaWrapperX<>();
88 // 我负责的 + 非公海 77 // 我负责的 + 非公海
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueService.java
@@ -8,8 +8,6 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO; @@ -8,8 +8,6 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO;
8 import jakarta.validation.Valid; 8 import jakarta.validation.Valid;
9 9
10 import java.time.LocalDateTime; 10 import java.time.LocalDateTime;
11 -import java.util.Collection;  
12 -import java.util.List;  
13 11
14 /** 12 /**
15 * 线索 Service 接口 13 * 线索 Service 接口
@@ -58,14 +56,6 @@ public interface CrmClueService { @@ -58,14 +56,6 @@ public interface CrmClueService {
58 CrmClueDO getClue(Long id); 56 CrmClueDO getClue(Long id);
59 57
60 /** 58 /**
61 - * 获得线索列表  
62 - *  
63 - * @param ids 编号  
64 - * @return 线索列表  
65 - */  
66 - List<CrmClueDO> getClueList(Collection<Long> ids, Long userId);  
67 -  
68 - /**  
69 * 获得线索分页 59 * 获得线索分页
70 * 60 *
71 * @param pageReqVO 分页查询 61 * @param pageReqVO 分页查询
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java
1 package cn.iocoder.yudao.module.crm.service.clue; 1 package cn.iocoder.yudao.module.crm.service.clue;
2 2
3 import cn.hutool.core.collection.CollUtil; 3 import cn.hutool.core.collection.CollUtil;
4 -import cn.hutool.core.collection.ListUtil;  
5 import cn.hutool.core.lang.Assert; 4 import cn.hutool.core.lang.Assert;
6 import cn.iocoder.yudao.framework.common.pojo.PageResult; 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
7 import cn.iocoder.yudao.framework.common.util.object.BeanUtils; 6 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
@@ -32,7 +31,6 @@ import org.springframework.transaction.annotation.Transactional; @@ -32,7 +31,6 @@ import org.springframework.transaction.annotation.Transactional;
32 import org.springframework.validation.annotation.Validated; 31 import org.springframework.validation.annotation.Validated;
33 32
34 import java.time.LocalDateTime; 33 import java.time.LocalDateTime;
35 -import java.util.Collection;  
36 import java.util.List; 34 import java.util.List;
37 import java.util.Objects; 35 import java.util.Objects;
38 36
@@ -221,14 +219,6 @@ public class CrmClueServiceImpl implements CrmClueService { @@ -221,14 +219,6 @@ public class CrmClueServiceImpl implements CrmClueService {
221 } 219 }
222 220
223 @Override 221 @Override
224 - public List<CrmClueDO> getClueList(Collection<Long> ids, Long userId) {  
225 - if (CollUtil.isEmpty(ids)) {  
226 - return ListUtil.empty();  
227 - }  
228 - return clueMapper.selectBatchIds(ids, userId);  
229 - }  
230 -  
231 - @Override  
232 public PageResult<CrmClueDO> getCluePage(CrmCluePageReqVO pageReqVO, Long userId) { 222 public PageResult<CrmClueDO> getCluePage(CrmCluePageReqVO pageReqVO, Long userId) {
233 return clueMapper.selectPage(pageReqVO, userId); 223 return clueMapper.selectPage(pageReqVO, userId);
234 } 224 }