1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-06 07:21:24 +08:00

Added api /user/department

This commit is contained in:
2023-05-29 08:35:49 +08:00
parent fed1594fc3
commit d773913d2c
8 changed files with 63 additions and 4 deletions

View File

@@ -66,7 +66,6 @@ public class AttendanceController {
attendance.setModifyId(1652714496280469506L);
return attendanceService.saveOrUpdate(attendance) ? ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", attendance) :
ResponseResult.build(ResponseCode.DATABASE_SAVE_ERROR, "error", null);
}
//个人签到

View File

@@ -46,6 +46,13 @@ public class UserController {
return ResponseResult.databaseSelectSuccess(userService.getAffairUser());
}
@GetMapping("/department")
@PreAuthorize("hasAuthority('attendance:manage:modify')")
@Operation(summary = "获取同部门下所有用户")
public ResponseResult<List<User>> getDepartmentUser() {
return ResponseResult.databaseSaveSuccess(userService.getDepartmentUser());
}
@GetMapping
@PreAuthorize("hasAnyAuthority('system:user:all', 'system:user:add', 'system:user:modify')")
@Operation(summary = "获取所有用户(权限管理相关)")

View File

@@ -21,6 +21,8 @@ public interface UserMapper extends BaseMapper<User> {
List<User> getAllAffairUser();
List<User> getAllDepartmentUser(@Param("departmentId")long departmentId);
User getOneById(@Param("id") long id);
User getOneWithPowerByUsername(@Param("username") String username);

View File

@@ -19,6 +19,8 @@ public interface IUserService extends IService<User> {
List<User> getAffairUser();
List<User> getDepartmentUser();
List<User> getAllUser();
User getUser(long id);

View File

@@ -78,6 +78,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
return userMapper.getAllAffairUser();
}
@Override
public List<User> getDepartmentUser() {
Long departmentId = WebUtil.getLoginUser().getUser().getDepartmentId();
if (departmentId == null) {
return List.of();
}
return userMapper.getAllDepartmentUser(departmentId);
}
@Override
public List<User> getAllUser() {
List<User> users = userMapper.getAll();