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:
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
//个人签到
|
||||
|
||||
@@ -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 = "获取所有用户(权限管理相关)")
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -19,6 +19,8 @@ public interface IUserService extends IService<User> {
|
||||
|
||||
List<User> getAffairUser();
|
||||
|
||||
List<User> getDepartmentUser();
|
||||
|
||||
List<User> getAllUser();
|
||||
|
||||
User getUser(long id);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user