提交 24f9f80b authored 作者: gongwenjie's avatar gongwenjie

代码修改

上级 cb6dd4c1
......@@ -61,7 +61,7 @@ public class AuthorityController {
}
@ApiOperation("查询所有权限")
@PutMapping("/findAuthority")
@GetMapping("/findAuthority")
public ResponseEntity findAuthority(){
return ok(iAuthorityService.findAuthority());
}
......
......@@ -68,7 +68,7 @@ public class ConfigController {
}
@ApiOperation("清除所有节假日数据")
@GetMapping("/deleteAll")
@DeleteMapping("/deleteAll")
public ResponseEntity deleteAll(){return ok(configService.deleteAll());}
}
......@@ -71,7 +71,7 @@ public class DepartController {
if(b){
return ok("删除部门成功");
}
return ok("删除部门失败,可能原因是部门下有角色或者用户");
return ok("删除部门失败,可能原因是部门下还有部门,或者有角色、用户");
}
......
......@@ -17,4 +17,11 @@ public interface AuthorityDao extends MongoRepository<Authority, String> {
* @return list
*/
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 {
@Override
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);
}
......@@ -63,7 +69,10 @@ public class DepartmentServiceImpl implements IDepartmentService {
public boolean deleteDepartment(String id) {
List<Role> roles = roleDao.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);
return true;
}
......
......@@ -43,7 +43,7 @@ public class UserManageController {
return ok(userManageService.findUserList(pageRequest));
}
@ApiOperation(value = "查询可查看部门列表", response = User.class)
@ApiOperation(value = "根据权限查询可查看部门列表", response = User.class)
@GetMapping("/findDepartmentList/{id}")
public ResponseEntity findDepartmentList(@PathVariable("id") String id) {
return ok(userManageService.findDepartmentList(id));
......
......@@ -137,8 +137,11 @@ public class UserManageServiceImpl implements UserManageService {
for (RoleAuthority roleAuthority : roleAuthorities) {
authorityIds.add(roleAuthority.getAuthorityId());
}
List<Authority> authorities = authorityDao.findAllByIdIn(authorityIds);
role.setAuthorities(authorities);
Authority authority = authorityDao.findByIdInAndName(authorityIds, "查看人员");
if(authority!=null){
}
}
List<Role> roleList = new ArrayList<>();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论