feat:部门权限

This commit is contained in:
dzc committed 2025-06-23 15:41:52 +08:00
1 parent 203cfb5966
commit 2468be98eb
3 files changed
+14 -4

No files matched your search

@@ -26,6 +26,7 @@ import com.bsd.pjcloud.admin.api.vo.DeptExcelVO;
import com.bsd.pjcloud.admin.mapper.SysDeptMapper;
import com.bsd.pjcloud.admin.service.SysDeptService;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.tenant.TenantContextHolder;
import com.bsd.pjcloud.common.excel.annotation.RequestExcel;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
@@ -101,7 +102,15 @@ public class SysDeptController {
if (ObjectUtil.isEmpty(parentId)) {
parentId = deptId;
}
return R.ok(sysDeptService.selectTree(deptName, parentId));
return R.ok(sysDeptService.selectTree(deptName, parentId, DataScope.of()));
}
/**
* 返回树形菜单集合
*/
@GetMapping(value = "/tree-select")
public R getTreeSelect(String deptName, Long parentId) {
return R.ok(sysDeptService.selectTree(deptName, parentId, null));
}
@@ -26,6 +26,7 @@ import com.bsd.pjcloud.admin.api.entity.SysDept;
import com.bsd.pjcloud.admin.api.vo.DeptExcelVO;
import com.bsd.pjcloud.admin.api.vo.OrgTreeVO;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import jakarta.validation.Valid;
import org.springframework.validation.BindingResult;
@@ -48,7 +49,7 @@ public interface SysDeptService extends IService<SysDept> {
* @param deptName 部门名称
* @return 树
*/
List<Tree<Long>> selectTree(String deptName, Long parentId);
List<Tree<Long>> selectTree(String deptName, Long parentId, DataScope dataScope);
List<Tree<Long>> selectSimpleTree(String deptName, Long parentId);
@@ -132,11 +132,11 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
* @return 树 部门名称
*/
@Override
public List<Tree<Long>> selectTree(String deptName, Long parentId) {
public List<Tree<Long>> selectTree(String deptName, Long parentId, DataScope dataScope) {
List<SysDept> deptAllList = new ArrayList<>();
// 查询全部部门
LambdaQueryWrapper<SysDept> queryWrapper = Wrappers.<SysDept>lambdaQuery().like(StrUtil.isNotBlank(deptName), SysDept::getName, deptName);
deptAllList = deptMapper.selectListByScope(queryWrapper, DataScope.of());
deptAllList = deptMapper.selectListByScope(queryWrapper, dataScope);
// 查询数据权限内部门
List<Long> deptOwnIdList = deptMapper
.selectListByScope(