1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 23:11:24 +08:00

Added getNoticeUser

This commit is contained in:
2023-06-04 02:26:06 +08:00
parent 860700ffea
commit b7962aa012
5 changed files with 53 additions and 0 deletions

View File

@@ -55,6 +55,13 @@ public class UserController {
return ResponseResult.databaseSaveSuccess(userService.getDepartmentUser());
}
@GetMapping("/notice")
@PreAuthorize("hasAuthority('notice:manage:get')")
@Operation(summary = "获取拥有发布公告权限的用户")
public ResponseResult<List<User>> getNoticeUser() {
return ResponseResult.databaseSaveSuccess(userService.getNoticeUser());
}
@GetMapping
@PreAuthorize("hasAuthority('system:user:get')")
@Operation(summary = "获取所有用户(权限管理相关)")

View File

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

View File

@@ -22,6 +22,8 @@ public interface IUserService extends IService<User> {
List<User> getDepartmentUser();
List<User> getNoticeUser();
IPage<User> getAllUser(Long currentPage, Long pageSize, String searchName, List<Long> searchRole, List<Long> searchGroup, Integer searchEnable);
User getUser(long id);

View File

@@ -89,6 +89,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
return userMapper.getAllDepartmentUser(departmentId);
}
@Override
public List<User> getNoticeUser() {
return userMapper.getAllNoticeUser();
}
@Override
public IPage<User> getAllUser(Long currentPage, Long pageSize, String searchName, List<Long> searchRole, List<Long> searchGroup, Integer searchEnable) {
IPage<User> userIPage = PageDTO.of(currentPage, pageSize);

View File

@@ -220,6 +220,42 @@
and t_user.department_id = #{departmentId}
</select>
<select id="getAllNoticeUser" resultMap="userWithRoleMap">
select distinct t_user.id as user_id,
t_user.username as user_username,
t_user.department_id as user_department_id,
t_user.enable as user_enable,
t_user.deleted as user_deleted,
t_user.version as user_version,
ts.id as staff_id,
ts.first_name as staff_first_name,
ts.last_name as staff_last_name,
ts.deleted as staff_deleted,
ts.version as staff_version,
tr.id as role_id,
tr.enable as role_enable,
tr.name as role_name,
tr.deleted as role_deleted,
tr.version as role_version,
tg.id as group_id,
tg.name as group_name,
tg.enable as group_enable,
tg.deleted as group_deleted,
tg.version as group_version
from t_user
left join (select * from t_staff where deleted = 0) as ts on ts.user_id = t_user.id
left join (select * from t_user_role where deleted = 0) as tur on t_user.id = tur.user_id
left join (select * from t_role where deleted = 0) as tr on tr.id = tur.role_id
left join (select * from t_user_group where deleted = 0) as tug on t_user.id = tug.user_id
left join (select * from t_group where deleted = 0) as tg on tg.id = tug.group_id
left join (select * from t_power_role where deleted = 0) as tpr on tpr.role_id = tr.id
left join t_power as tp on tp.id = tpr.power_id
left join (select * from t_operation) as t on t.power_id = tp.id
where t_user.deleted = 0
and t_user.id != 1
and t.code = 'notice:manage:get'
</select>
<resultMap id="userBase" type="user">
<id property="id" column="user_id"/>
<result property="username" column="user_username"/>