【8.0】【sys】更新角色下查询人员的方法

pull/57/head
fengshuonan 2023-07-15 22:31:20 +08:00
parent 1ea17b193c
commit 0927501eac
2 changed files with 21 additions and 0 deletions

View File

@ -18,4 +18,12 @@ public interface SysUserRoleServiceApi {
*/
List<Long> getUserRoleIdList(Long userId);
/**
* idid
*
* @author fengshuonan
* @since 2023/5/26 14:08
*/
List<Long> findUserIdsByRoleId(Long roleId);
}

View File

@ -145,6 +145,16 @@ public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUs
return userRoleQueryResult;
}
@Override
public List<Long> findUserIdsByRoleId(Long roleId) {
SysUserRoleRequest userRoleRequest = new SysUserRoleRequest();
userRoleRequest.setRoleId(roleId);
LambdaQueryWrapper<SysUserRole> queryWrapper = this.createWrapper(userRoleRequest);
queryWrapper.select(SysUserRole::getUserId);
List<SysUserRole> list = this.list(queryWrapper);
return list.stream().map(SysUserRole::getUserId).collect(Collectors.toList());
}
/**
* wrapper
*
@ -157,6 +167,9 @@ public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUs
Long userId = sysUserRoleRequest.getUserId();
queryWrapper.eq(ObjectUtil.isNotNull(userId), SysUserRole::getUserId, userId);
Long roleId = sysUserRoleRequest.getRoleId();
queryWrapper.eq(ObjectUtil.isNotNull(roleId), SysUserRole::getRoleId, roleId);
return queryWrapper;
}