|
|
@ -1,6 +1,5 @@ |
|
|
|
package org.jeecg.modules.system.controller; |
|
|
|
package org.jeecg.modules.system.controller; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
@ -17,7 +16,6 @@ import org.jeecg.common.system.query.QueryGenerator; |
|
|
|
import org.jeecg.common.system.util.JwtUtil; |
|
|
|
import org.jeecg.common.system.util.JwtUtil; |
|
|
|
import org.jeecg.common.system.vo.LoginUser; |
|
|
|
import org.jeecg.common.system.vo.LoginUser; |
|
|
|
import org.jeecg.common.util.ImportExcelUtil; |
|
|
|
import org.jeecg.common.util.ImportExcelUtil; |
|
|
|
import org.jeecg.common.util.YouBianCodeUtil; |
|
|
|
|
|
|
|
import org.jeecg.common.util.oConvertUtils; |
|
|
|
import org.jeecg.common.util.oConvertUtils; |
|
|
|
import org.jeecg.config.mybatis.MybatisPlusSaasConfig; |
|
|
|
import org.jeecg.config.mybatis.MybatisPlusSaasConfig; |
|
|
|
import org.jeecg.modules.system.entity.SysDepart; |
|
|
|
import org.jeecg.modules.system.entity.SysDepart; |
|
|
@ -67,6 +65,7 @@ public class SysDepartController { |
|
|
|
private ISysUserService sysUserService; |
|
|
|
private ISysUserService sysUserService; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private ISysUserDepartService sysUserDepartService; |
|
|
|
private ISysUserDepartService sysUserDepartService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查询数据 查出我的部门,并以树结构数据格式响应给前端 |
|
|
|
* 查询数据 查出我的部门,并以树结构数据格式响应给前端 |
|
|
|
* |
|
|
|
* |
|
|
@ -127,6 +126,7 @@ public class SysDepartController { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 异步查询部门list |
|
|
|
* 异步查询部门list |
|
|
|
|
|
|
|
* |
|
|
|
* @param parentId 父节点 异步加载时传递 |
|
|
|
* @param parentId 父节点 异步加载时传递 |
|
|
|
* @param ids 前端回显是传递 |
|
|
|
* @param ids 前端回显是传递 |
|
|
|
* @param primaryKey 主键字段(id或者orgCode) |
|
|
|
* @param primaryKey 主键字段(id或者orgCode) |
|
|
@ -147,6 +147,29 @@ public class SysDepartController { |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @description: 根据当前登录角色查询 下级部门数据 |
|
|
|
|
|
|
|
* @param: [parentId, ids, primaryKey] |
|
|
|
|
|
|
|
* @return: org.jeecg.common.api.vo.Result<java.util.List<org.jeecg.modules.system.model.SysDepartTreeModel>> |
|
|
|
|
|
|
|
* @author: z.h.c |
|
|
|
|
|
|
|
* @date: 24/11/9 16:07 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@RequestMapping(value = "/queryDepartTreeSync4ZhuGuanBuMen", method = RequestMethod.GET) |
|
|
|
|
|
|
|
public Result<List<SysDepartTreeModel>> queryDepartTreeSync4ZhuGuanBuMen(@RequestParam(name = "parentOrgCode", required = false) String parentOrgCode, @RequestParam(name = "ids", required = false) String ids, @RequestParam(name = "primaryKey", required = false) String primaryKey) { |
|
|
|
|
|
|
|
Result<List<SysDepartTreeModel>> result = new Result<>(); |
|
|
|
|
|
|
|
SysDepart sysDepart = sysDepartService.getOne(new LambdaQueryWrapper<SysDepart>().eq(SysDepart::getOrgCode, parentOrgCode)); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
List<SysDepartTreeModel> list = sysDepartService.queryTreeListByPid(sysDepart.getId(), ids, primaryKey); |
|
|
|
|
|
|
|
result.setResult(list); |
|
|
|
|
|
|
|
result.setSuccess(true); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error(e.getMessage(), e); |
|
|
|
|
|
|
|
result.setSuccess(false); |
|
|
|
|
|
|
|
result.setMessage("查询失败"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取某个部门的所有父级部门的ID |
|
|
|
* 获取某个部门的所有父级部门的ID |
|
|
|
* |
|
|
|
* |
|
|
@ -189,7 +212,13 @@ public class SysDepartController { |
|
|
|
// List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>()
|
|
|
|
// List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>()
|
|
|
|
QueryWrapper<SysDepart> queryWrapper = QueryGenerator.initQueryWrapper(depart, req.getParameterMap()); |
|
|
|
QueryWrapper<SysDepart> queryWrapper = QueryGenerator.initQueryWrapper(depart, req.getParameterMap()); |
|
|
|
queryWrapper.eq("del_flag", 0); |
|
|
|
queryWrapper.eq("del_flag", 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//单位法人角色时,只查询自己部门
|
|
|
|
|
|
|
|
if ("faren_admin".equals(user.getRoleCode())) { |
|
|
|
|
|
|
|
queryWrapper.eq("id", user.getOrgId()); |
|
|
|
|
|
|
|
} else { // 查询下级部门
|
|
|
|
queryWrapper.eq("parent_id", user.getOrgId()); |
|
|
|
queryWrapper.eq("parent_id", user.getOrgId()); |
|
|
|
|
|
|
|
} |
|
|
|
return sysDepartService.queryPageList(req, queryWrapper, pageSize, pageNo); |
|
|
|
return sysDepartService.queryPageList(req, queryWrapper, pageSize, pageNo); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -229,7 +258,7 @@ public class SysDepartController { |
|
|
|
* @param sysDepart |
|
|
|
* @param sysDepart |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@RequiresPermissions("system:depart:add") |
|
|
|
// @RequiresPermissions("system:depart:add")
|
|
|
|
@RequestMapping(value = "/add", method = RequestMethod.POST) |
|
|
|
@RequestMapping(value = "/add", method = RequestMethod.POST) |
|
|
|
@CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true) |
|
|
|
@CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true) |
|
|
|
public Result<SysDepart> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) { |
|
|
|
public Result<SysDepart> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) { |
|
|
@ -255,7 +284,7 @@ public class SysDepartController { |
|
|
|
* @param sysDepart |
|
|
|
* @param sysDepart |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@RequiresPermissions("system:depart:edit") |
|
|
|
// @RequiresPermissions("system:depart:edit")
|
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
|
|
|
@CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true) |
|
|
|
@CacheEvict(value = {CacheConstant.SYS_DEPARTS_CACHE, CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries = true) |
|
|
|
public Result<SysDepart> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) { |
|
|
|
public Result<SysDepart> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) { |
|
|
@ -280,6 +309,7 @@ public class SysDepartController { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 通过id删除 |
|
|
|
* 通过id删除 |
|
|
|
|
|
|
|
* |
|
|
|
* @param id |
|
|
|
* @param id |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -544,6 +574,7 @@ public class SysDepartController { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查询所有部门信息 |
|
|
|
* 查询所有部门信息 |
|
|
|
|
|
|
|
* |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@GetMapping("listAll") |
|
|
|
@GetMapping("listAll") |
|
|
@ -560,6 +591,7 @@ public class SysDepartController { |
|
|
|
result.setResult(ls); |
|
|
|
result.setResult(ls); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查询数据 查出所有部门,并以树结构数据格式响应给前端 |
|
|
|
* 查询数据 查出所有部门,并以树结构数据格式响应给前端 |
|
|
|
* |
|
|
|
* |
|
|
@ -619,9 +651,9 @@ public class SysDepartController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @功能:根据id 批量查询 |
|
|
|
|
|
|
|
* @param deptIds |
|
|
|
* @param deptIds |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
|
|
|
|
* @功能:根据id 批量查询 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@RequestMapping(value = "/queryByIds", method = RequestMethod.GET) |
|
|
|
@RequestMapping(value = "/queryByIds", method = RequestMethod.GET) |
|
|
|
public Result<Collection<SysDepart>> queryByIds(@RequestParam(name = "deptIds") String deptIds) { |
|
|
|
public Result<Collection<SysDepart>> queryByIds(@RequestParam(name = "deptIds") String deptIds) { |
|
|
@ -642,6 +674,7 @@ public class SysDepartController { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 异步查询部门list |
|
|
|
* 异步查询部门list |
|
|
|
|
|
|
|
* |
|
|
|
* @param parentId 父节点 异步加载时传递 |
|
|
|
* @param parentId 父节点 异步加载时传递 |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -662,6 +695,7 @@ public class SysDepartController { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 通过部门id和租户id获取用户 【低代码应用: 用于选择部门负责人】 |
|
|
|
* 通过部门id和租户id获取用户 【低代码应用: 用于选择部门负责人】 |
|
|
|
|
|
|
|
* |
|
|
|
* @param departId |
|
|
|
* @param departId |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|