src/main/java/org/springblade/modules/system/controller/DeptController.java
@@ -175,8 +175,8 @@ */ @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); } src/main/java/org/springblade/modules/system/controller/UserController.java
@@ -44,9 +44,12 @@ import org.springblade.core.tool.support.Kv; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DigestUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringPool; import org.springblade.modules.experience.entity.Experience; import org.springblade.modules.experience.service.IExperienceService; import org.springblade.modules.jurisdiction.entity.Jurisdiction; import org.springblade.modules.jurisdiction.service.JurisdictionService; import org.springblade.modules.system.entity.Dept; import org.springblade.modules.system.entity.Role; import org.springblade.modules.system.entity.User; @@ -88,6 +91,8 @@ private final IDeptService iDeptService; private final IRoleService roleService; private final IExperienceService experienceService; private final JurisdictionService jurisdictionService; /** * 查询单条 @@ -183,6 +188,16 @@ } } //根据 deptId 查询dept信息,公安管理员 Dept dept = iDeptService.getById(user.getDeptId()); Long sid = 1123598813738675201L; if (dept.getParentId().equals(sid)){ //获取辖区的数据 Jurisdiction jurisdiction = new Jurisdiction(); jurisdiction.setDeptName(dept.getDeptName()); Jurisdiction one = jurisdictionService.getOne(Condition.getQueryWrapper(jurisdiction)); user.setJurisdiction(one.getId().toString()); } return R.status(userService.submit(user)); } @@ -449,6 +464,10 @@ user.setRoleId(oneRole.getId().toString()); } } //密码加密 if (Func.isNotEmpty(user.getPassword())) { user.setPassword(DigestUtil.encrypt(user.getPassword())); } //用户新增 boolean status = userService.save(user); //获取从业记录 src/main/java/org/springblade/modules/system/mapper/DeptMapper.java
@@ -88,7 +88,7 @@ /** * 懒加载获取部门树形结构,不包含顶级管理员公安局 */ List<DeptVO> securityLazyTree(String tenantId, Long parentId); List<DeptVO> securityLazyTree(String jurisdiction, Long parentId); /** * 懒加载获取部门树形结构(包含用户数据) src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
@@ -119,11 +119,15 @@ ) AS "has_children" FROM blade_dept dept left join sys_information si on si.departmentid = dept.id WHERE dept.parent_id = #{param2} AND dept.is_deleted = 0 and dept_category = 1 <if test="param1!=null and param1!=''"> and dept.tenant_id = #{param1} and si.jurisdiction = #{param1} </if> ORDER BY dept.sort </select> src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -60,6 +60,10 @@ on bu.dept_id = bd.id left join sys_information si on si.departmentid = bd.id left join sys_live_location sll on sll.worker_id = bu.id @@ -88,7 +92,7 @@ and bu.status = #{user.status} </if> <if test="user.jurisdiction!=null and user.jurisdiction != '' and user.jurisdiction!='1123598813738675201'"> and bu.jurisdiction = #{user.jurisdiction} and si.jurisdiction = #{user.jurisdiction} </if> <if test="user.realName!=null and user.realName != ''"> and bu.real_name like concat('%', #{user.realName},'%') src/main/java/org/springblade/modules/system/service/IDeptService.java
@@ -130,7 +130,7 @@ /** * 懒加载获取部门树形结构,不包含顶级管理员公安局 */ List<DeptVO> securityLazyTree(String tenantId, Long parentId); List<DeptVO> securityLazyTree(String jurisdiction, Long parentId); List<String> selectIn(); /** src/main/java/org/springblade/modules/system/service/impl/DeptServiceImpl.java
@@ -191,11 +191,8 @@ * 懒加载获取部门树形结构,不包含顶级管理员公安局 */ @Override public List<DeptVO> securityLazyTree(String tenantId, Long parentId) { if (AuthUtil.isAdministrator()) { tenantId = StringPool.EMPTY; } return ForestNodeMerger.merge(baseMapper.securityLazyTree(tenantId, parentId)); public List<DeptVO> securityLazyTree(String jurisdiction, Long parentId) { return ForestNodeMerger.merge(baseMapper.securityLazyTree(jurisdiction, parentId)); } @Override