mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-06 04:18:07 +00:00
update 处理 find_in_set 函数多类型数据库兼容性问题
This commit is contained in:
@@ -49,7 +49,7 @@ public class RemoteDataScopeServiceImpl implements RemoteDataScopeService {
|
||||
.select(SysDept::getDeptId)
|
||||
.eq(SysDept::getDeptId, deptId)
|
||||
.or()
|
||||
.apply("find_in_set({0},ancestors)", deptId));
|
||||
.apply("find_in_set({0},ancestors) <> 0", deptId));
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
return list.stream().map(d -> Convert.toStr(d.getDeptId())).collect(Collectors.joining(","));
|
||||
}
|
||||
|
@@ -108,7 +108,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||
public long selectNormalChildrenDeptById(Long deptId) {
|
||||
return baseMapper.selectCount(new LambdaQueryWrapper<SysDept>()
|
||||
.eq(SysDept::getStatus, UserConstants.DEPT_NORMAL)
|
||||
.apply("find_in_set({0}, ancestors)", deptId));
|
||||
.apply("find_in_set({0}, ancestors) <> 0", deptId));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,7 +234,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||
*/
|
||||
public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) {
|
||||
List<SysDept> children = baseMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
||||
.apply("find_in_set({0},ancestors)", deptId));
|
||||
.apply("find_in_set({0},ancestors) <> 0", deptId));
|
||||
List<SysDept> list = new ArrayList<>();
|
||||
for (SysDept child : children) {
|
||||
SysDept dept = new SysDept();
|
||||
|
@@ -81,7 +81,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
||||
.and(ObjectUtil.isNotNull(user.getDeptId()), w -> {
|
||||
List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
||||
.select(SysDept::getDeptId)
|
||||
.apply("find_in_set({0},ancestors)", user.getDeptId()));
|
||||
.apply("find_in_set({0},ancestors) <> 0", user.getDeptId()));
|
||||
w.eq("u.dept_id", user.getDeptId())
|
||||
.or()
|
||||
.in("u.dept_id", deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList()));
|
||||
|
Reference in New Issue
Block a user