Commit 82037d02713d06f72a1e5736b1cb15652276fa68
1 parent
d844f06f
fix(crm): 修复客户限制配置查询逻辑,将用户和部门的 AND 条件改为 OR
Showing
1 changed file
with
6 additions
and
4 deletions
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/customer/CrmCustomerLimitConfigMapper.java
| ... | ... | @@ -27,10 +27,12 @@ public interface CrmCustomerLimitConfigMapper extends BaseMapperX<CrmCustomerLim |
| 27 | 27 | Integer type, Long userId, Long deptId) { |
| 28 | 28 | LambdaQueryWrapperX<CrmCustomerLimitConfigDO> query = new LambdaQueryWrapperX<CrmCustomerLimitConfigDO>() |
| 29 | 29 | .eq(CrmCustomerLimitConfigDO::getType, type); |
| 30 | - query.apply("FIND_IN_SET({0}, user_ids) > 0", userId); | |
| 31 | - if (deptId != null) { | |
| 32 | - query.apply("FIND_IN_SET({0}, dept_ids) > 0", deptId); | |
| 33 | - } | |
| 30 | + query.and(w -> { | |
| 31 | + w.apply("FIND_IN_SET({0}, user_ids) > 0", userId); | |
| 32 | + if (deptId != null) { | |
| 33 | + w.or().apply("FIND_IN_SET({0}, dept_ids) > 0", deptId); | |
| 34 | + } | |
| 35 | + }); | |
| 34 | 36 | return selectList(query); |
| 35 | 37 | } |
| 36 | 38 | ... | ... |