| | |
| | | import org.springblade.core.tool.support.Kv; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.node.TreeNodes; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | import org.springblade.modules.system.vo.DeptVO; |
| | | import org.springblade.modules.system.wrapper.DeptWrapper; |
| | |
| | | @AllArgsConstructor |
| | | @RequestMapping(AppConstant.APPLICATION_SYSTEM_NAME + "/dept") |
| | | @Api(value = "部门", tags = "部门") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public class DeptController extends BladeController { |
| | | |
| | | private final IDeptService deptService; |
| | |
| | | return R.data(tree); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构 |
| | | */ |
| | | @GetMapping("/lazy-trees") |
| | | @ApiOperation(value = "懒加载树形结构", notes = "树形结构") |
| | | public R<List<DeptVO>> lazyTrees() { |
| | | List<DeptVO> tree = deptService.lazyTrees(); |
| | | return R.data(tree); |
| | | } |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构(包含用户数据) |
| | | * @return |
| | | */ |
| | | @GetMapping("/lazy-tree-user") |
| | | public R<List<DeptVO>> lazyTreeUser(String tenantId, Long parentId, BladeUser bladeUser) { |
| | | List<DeptVO> tree = deptService.lazyTreeUser(Func.toStrWithEmpty(tenantId, bladeUser.getTenantId()), parentId); |
| | | return R.data(tree); |
| | | } |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构(包含用户数据),只查下一级的数据 |
| | | * @return |
| | | */ |
| | | @GetMapping("/lazy-tree-users") |
| | | public R<List<TreeNodes>> lazyTreeUsers(Integer type, Long deptId) { |
| | | List<TreeNodes> tree = deptService.lazyTreeUsers(type,deptId); |
| | | return R.data(tree); |
| | | } |
| | | |
| | | /** |
| | | * 新增或修改 |
| | | */ |
| | |
| | | CacheUtil.clear(SYS_CACHE); |
| | | return R.status(deptService.removeDept(ids)); |
| | | } |
| | | @GetMapping("/selectIn") |
| | | public R selectIn() { |
| | | return R.data(deptService.selectIn()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构,不包含顶级管理员公安局 |
| | | */ |
| | | @GetMapping("/security_lazy-tree") |
| | | @ApiOperation(value = "懒加载树形结构", notes = "树形结构") |
| | | public R<List<DeptVO>> securityLazyTree(String jurisdiction, Long parentId,Long deptId) { |
| | | List<DeptVO> tree = deptService.securityLazyTree(jurisdiction,parentId,deptId); |
| | | return R.data(tree); |
| | | } |
| | | } |