宣城位置汇聚处理带字母机构
parent
81e9cdfdc1
commit
359b92a7f1
|
|
@ -59,7 +59,7 @@ public class SysDeptController extends BaseController {
|
|||
*/
|
||||
@SaCheckPermission("system:dept:list")
|
||||
@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());
|
||||
depts.removeIf(d -> d.getDeptId().equals(deptId)
|
||||
|| StringUtils.splitList(d.getAncestors()).contains(Convert.toStr(deptId)));
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class DeptTreeSelectVo implements Serializable {
|
|||
/**
|
||||
* 选中部门列表
|
||||
*/
|
||||
private List<Long> checkedKeys;
|
||||
private List<String> checkedKeys;
|
||||
|
||||
/**
|
||||
* 下拉树结构列表
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import org.dromara.system.mapper.SysRoleDeptMapper;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 数据权限 实现
|
||||
|
|
@ -63,6 +64,22 @@ public class RemoteDataScopeServiceImpl implements RemoteDataScopeService {
|
|||
@Override
|
||||
public String getDeptAndChild(String 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";
|
||||
}
|
||||
List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
||||
|
|
@ -73,7 +90,7 @@ public class RemoteDataScopeServiceImpl implements RemoteDataScopeService {
|
|||
if (CollUtil.isNotEmpty(ids)) {
|
||||
return StreamUtils.join(ids, Convert::toStr);
|
||||
}
|
||||
return "-1";
|
||||
return "-1";*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
|
|||
* @param deptCheckStrictly 部门树选择项是否关联显示
|
||||
* @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);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public interface ISysDeptService {
|
|||
* @param roleId 角色ID
|
||||
* @return 选中部门列表
|
||||
*/
|
||||
List<Long> selectDeptListByRoleId(Long roleId);
|
||||
List<String> selectDeptListByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 根据部门ID查询信息
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
|||
* @return 选中部门列表
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectDeptListByRoleId(Long roleId) {
|
||||
public List<String> selectDeptListByRoleId(Long roleId) {
|
||||
SysRole role = roleMapper.selectById(roleId);
|
||||
return baseMapper.selectDeptListByRoleId(roleId, role.getDeptCheckStrictly());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
select count(*) from sys_dept where del_flag = '0' and dept_id = #{deptId}
|
||||
</select>
|
||||
|
||||
<select id="selectDeptListByRoleId" resultType="Long">
|
||||
<select id="selectDeptListByRoleId" resultType="String">
|
||||
select d.dept_id
|
||||
from sys_dept d
|
||||
left join sys_role_dept rd on d.dept_id = rd.dept_id
|
||||
|
|
|
|||
Loading…
Reference in New Issue