提交 14c65967 authored 作者: gongwenjie's avatar gongwenjie

合并分支 'gwj' 到 'master'

Gwj 查看合并请求 !20
流水线 #26 已取消 于阶段
...@@ -61,7 +61,7 @@ public class AuthorityController { ...@@ -61,7 +61,7 @@ public class AuthorityController {
} }
@ApiOperation("查询所有权限") @ApiOperation("查询所有权限")
@PutMapping("/findAuthority") @GetMapping("/findAuthority")
public ResponseEntity findAuthority(){ public ResponseEntity findAuthority(){
return ok(iAuthorityService.findAuthority()); return ok(iAuthorityService.findAuthority());
} }
......
...@@ -68,7 +68,7 @@ public class ConfigController { ...@@ -68,7 +68,7 @@ public class ConfigController {
} }
@ApiOperation("清除所有节假日数据") @ApiOperation("清除所有节假日数据")
@GetMapping("/deleteAll") @DeleteMapping("/deleteAll")
public ResponseEntity deleteAll(){return ok(configService.deleteAll());} public ResponseEntity deleteAll(){return ok(configService.deleteAll());}
} }
...@@ -71,7 +71,7 @@ public class DepartController { ...@@ -71,7 +71,7 @@ public class DepartController {
if(b){ if(b){
return ok("删除部门成功"); return ok("删除部门成功");
} }
return ok("删除部门失败,可能原因是部门下有角色或者用户"); return ok("删除部门失败,可能原因是部门下还有部门,或者有角色、用户");
} }
......
...@@ -17,4 +17,11 @@ public interface AuthorityDao extends MongoRepository<Authority, String> { ...@@ -17,4 +17,11 @@ public interface AuthorityDao extends MongoRepository<Authority, String> {
* @return list * @return list
*/ */
List<Authority> findAllByIdIn(List<String> ids); List<Authority> findAllByIdIn(List<String> ids);
/**
* 根据id和名称查找权限
* @param ids
* @return
*/
Authority findByIdInAndName(List<String> ids,String name);
} }
...@@ -37,6 +37,12 @@ public class DepartmentServiceImpl implements IDepartmentService { ...@@ -37,6 +37,12 @@ public class DepartmentServiceImpl implements IDepartmentService {
@Override @Override
public Department addDepartments(Department department) { public Department addDepartments(Department department) {
Optional<Department> optional = departmentDao.findById(department.getParentId());
if(optional.isPresent()){
Department department1 = optional.get();
int level = Integer.parseInt(department1.getLevel())+1;
department.setLevel(level+"");
}
return departmentDao.save(department); return departmentDao.save(department);
} }
...@@ -63,7 +69,10 @@ public class DepartmentServiceImpl implements IDepartmentService { ...@@ -63,7 +69,10 @@ public class DepartmentServiceImpl implements IDepartmentService {
public boolean deleteDepartment(String id) { public boolean deleteDepartment(String id) {
List<Role> roles = roleDao.findAllByDepartmentId(id); List<Role> roles = roleDao.findAllByDepartmentId(id);
List<User> users = pasUserDao.findAllByDepartmentId(id); List<User> users = pasUserDao.findAllByDepartmentId(id);
if(roles!=null && roles.size()!=0 && users!=null && users.size()!=0){ List<Department> departments = departmentDao.findAllByParentId(id);
if((roles==null || roles.size()==0)
&& (users==null || users.size()!=0)
&& (departments!=null || departments.size()!=0)){
departmentDao.deleteById(id); departmentDao.deleteById(id);
return true; return true;
} }
......
...@@ -43,7 +43,7 @@ public class UserManageController { ...@@ -43,7 +43,7 @@ public class UserManageController {
return ok(userManageService.findUserList(pageRequest)); return ok(userManageService.findUserList(pageRequest));
} }
@ApiOperation(value = "查询可查看部门列表", response = User.class) @ApiOperation(value = "根据权限查询可查看部门列表", response = User.class)
@GetMapping("/findDepartmentList/{id}") @GetMapping("/findDepartmentList/{id}")
public ResponseEntity findDepartmentList(@PathVariable("id") String id) { public ResponseEntity findDepartmentList(@PathVariable("id") String id) {
return ok(userManageService.findDepartmentList(id)); return ok(userManageService.findDepartmentList(id));
......
...@@ -137,8 +137,11 @@ public class UserManageServiceImpl implements UserManageService { ...@@ -137,8 +137,11 @@ public class UserManageServiceImpl implements UserManageService {
for (RoleAuthority roleAuthority : roleAuthorities) { for (RoleAuthority roleAuthority : roleAuthorities) {
authorityIds.add(roleAuthority.getAuthorityId()); authorityIds.add(roleAuthority.getAuthorityId());
} }
List<Authority> authorities = authorityDao.findAllByIdIn(authorityIds); Authority authority = authorityDao.findByIdInAndName(authorityIds, "查看人员");
role.setAuthorities(authorities); if(authority!=null){
}
} }
List<Role> roleList = new ArrayList<>(); List<Role> roleList = new ArrayList<>();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论