fix(crm): 修复客户限制配置查询逻辑,将用户和部门的 AND 条件改为 OR

This commit is contained in:
YunaiV
2026-03-08 16:52:15 +08:00
parent d844f06f5c
commit 82037d0271

View File

@@ -27,10 +27,12 @@ public interface CrmCustomerLimitConfigMapper extends BaseMapperX<CrmCustomerLim
Integer type, Long userId, Long deptId) {
LambdaQueryWrapperX<CrmCustomerLimitConfigDO> query = new LambdaQueryWrapperX<CrmCustomerLimitConfigDO>()
.eq(CrmCustomerLimitConfigDO::getType, type);
query.apply("FIND_IN_SET({0}, user_ids) > 0", userId);
if (deptId != null) {
query.apply("FIND_IN_SET({0}, dept_ids) > 0", deptId);
}
query.and(w -> {
w.apply("FIND_IN_SET({0}, user_ids) > 0", userId);
if (deptId != null) {
w.or().apply("FIND_IN_SET({0}, dept_ids) > 0", deptId);
}
});
return selectList(query);
}