| | |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.launch.constant.AppConstant; |
| | | import org.springblade.core.log.annotation.ApiLog; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | |
| | | 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.entity.User; |
| | | import org.springblade.modules.system.node.TreeNodes; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.system.vo.DeptVO; |
| | | import org.springblade.modules.system.wrapper.DeptWrapper; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | public class DeptController extends BladeController { |
| | | |
| | | private final IDeptService deptService; |
| | | |
| | | private final IUserService userService; |
| | | |
| | | /** |
| | | * 详情 |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构(包含用户数据)app |
| | | * @param type 1:保安对保安 2:保安向民警 3:民警向民警 |
| | | * @return |
| | | */ |
| | | @GetMapping("/lazy-tree-user-app") |
| | | public List<DeptVO> lazyTreeUser(Integer type,String userId) { |
| | | if (null!=userId && userId!=""){ |
| | | //查询用户信息 |
| | | User user = userService.getById(userId); |
| | | type = 4; |
| | | if (null!=user.getJurisdiction() && user.getJurisdiction()!="") { |
| | | return deptService.lazyTreeUserApp(type, user.getJurisdiction()); |
| | | } |
| | | return deptService.lazyTreeUserApp(type,null); |
| | | } |
| | | return deptService.lazyTreeUserApp(type,null); |
| | | } |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构,不包含顶级管理员公安局 |
| | | */ |
| | | @GetMapping("/security_lazy-tree") |
| | | @ApiOperation(value = "懒加载树形结构", notes = "树形结构") |
| | | public R<List<DeptVO>> securityLazyTree(String tenantId, Long parentId, BladeUser bladeUser) { |
| | | List<DeptVO> tree = deptService.securityLazyTree(Func.toStrWithEmpty(tenantId, bladeUser.getTenantId()), parentId); |
| | | public R<List<DeptVO>> securityLazyTree(String jurisdiction, Long parentId) { |
| | | List<DeptVO> tree = deptService.securityLazyTree(jurisdiction, parentId); |
| | | return R.data(tree); |
| | | } |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构(按分类查询) |
| | | */ |
| | | @GetMapping("/lazy-tree-type") |
| | | @ApiOperation(value = "懒加载树形结构", notes = "树形结构") |
| | | public R<List<DeptVO>> LazyTreeType(String deptCategory, Long parentId) { |
| | | List<DeptVO> tree = deptService.lazyTreeType(deptCategory, parentId); |
| | | return R.data(tree); |
| | | } |
| | | |
| | |
| | | return R.status(deptService.removeDept(ids)); |
| | | } |
| | | |
| | | @ApiLog("Blog详情") |
| | | @GetMapping("/selectInfo") |
| | | public R<List<DeptVO>> selectInfo() { |
| | | List<DeptVO> tree =deptService.selectInfo(); |
| | | return R.data(tree); |
| | | } |
| | | |
| | | @GetMapping("/selectIn") |
| | | public R selectIn() { |
| | | return R.data(deptService.selectIn()); |
| | | } |
| | | |
| | | } |