宿州处理机构带字母问题

ds-suzhou
luyya 2025-10-16 11:56:11 +08:00
parent fa72e2e1d9
commit 83dcb14325
7 changed files with 24 additions and 7 deletions

View File

@ -59,7 +59,7 @@ public class SysDeptController extends BaseController {
*/ */
@SaCheckPermission("system:dept:list") @SaCheckPermission("system:dept:list")
@GetMapping("/list/exclude/{deptId}") @GetMapping("/list/exclude/{deptId}")
public R<List<SysDeptVo>> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) { public R<List<SysDeptVo>> excludeChild(@PathVariable(value = "deptId", required = false) String deptId) {
List<SysDeptVo> depts = deptService.selectDeptList(new SysDeptBo()); List<SysDeptVo> depts = deptService.selectDeptList(new SysDeptBo());
depts.removeIf(d -> d.getDeptId().equals(deptId) depts.removeIf(d -> d.getDeptId().equals(deptId)
|| StringUtils.splitList(d.getAncestors()).contains(Convert.toStr(deptId))); || StringUtils.splitList(d.getAncestors()).contains(Convert.toStr(deptId)));

View File

@ -21,7 +21,7 @@ public class DeptTreeSelectVo implements Serializable {
/** /**
* *
*/ */
private List<Long> checkedKeys; private List<String> checkedKeys;
/** /**
* *

View File

@ -16,6 +16,7 @@ import org.dromara.system.mapper.SysRoleDeptMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* *
@ -63,6 +64,22 @@ public class RemoteDataScopeServiceImpl implements RemoteDataScopeService {
@Override @Override
public String getDeptAndChild(String deptId) { public String getDeptAndChild(String deptId) {
if (ObjectUtil.isNull(deptId)) { if (ObjectUtil.isNull(deptId)) {
return "'-1'";
}
List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
.select(SysDept::getDeptId)
.apply(DataBaseHelper.findInSet(deptId, "ancestors")));
List<String> ids = StreamUtils.toList(deptList, SysDept::getDeptId);
ids.add(deptId);
if (CollUtil.isNotEmpty(ids)) {
// 每个 ID 都加上单引号,并用逗号连接
return ids.stream()
.map(id -> "'" + id.replace("'", "''") + "'") // 转义单引号
.collect(Collectors.joining(","));
}
return "'-1'";
/*if (ObjectUtil.isNull(deptId)) {
return "-1"; return "-1";
} }
List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>() List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
@ -73,7 +90,7 @@ public class RemoteDataScopeServiceImpl implements RemoteDataScopeService {
if (CollUtil.isNotEmpty(ids)) { if (CollUtil.isNotEmpty(ids)) {
return StreamUtils.join(ids, Convert::toStr); return StreamUtils.join(ids, Convert::toStr);
} }
return "-1"; return "-1";*/
} }
} }

View File

@ -41,7 +41,7 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
* @param deptCheckStrictly * @param deptCheckStrictly
* @return * @return
*/ */
List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); List<String> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
List<SysDeptVo> deviceStatics(@Param("deviceType") String deviceType); List<SysDeptVo> deviceStatics(@Param("deviceType") String deviceType);

View File

@ -42,7 +42,7 @@ public interface ISysDeptService {
* @param roleId ID * @param roleId ID
* @return * @return
*/ */
List<Long> selectDeptListByRoleId(Long roleId); List<String> selectDeptListByRoleId(Long roleId);
/** /**
* ID * ID

View File

@ -116,7 +116,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
* @return * @return
*/ */
@Override @Override
public List<Long> selectDeptListByRoleId(Long roleId) { public List<String> selectDeptListByRoleId(Long roleId) {
SysRole role = roleMapper.selectById(roleId); SysRole role = roleMapper.selectById(roleId);
return baseMapper.selectDeptListByRoleId(roleId, role.getDeptCheckStrictly()); return baseMapper.selectDeptListByRoleId(roleId, role.getDeptCheckStrictly());
} }

View File

@ -22,7 +22,7 @@
select count(*) from sys_dept where del_flag = '0' and dept_id = #{deptId} select count(*) from sys_dept where del_flag = '0' and dept_id = #{deptId}
</select> </select>
<select id="selectDeptListByRoleId" resultType="Long"> <select id="selectDeptListByRoleId" resultType="String">
select d.dept_id select d.dept_id
from sys_dept d from sys_dept d
left join sys_role_dept rd on d.dept_id = rd.dept_id left join sys_role_dept rd on d.dept_id = rd.dept_id