|
@@ -3,19 +3,17 @@ package com.flyer.foster.service.impl;
|
|
|
import cn.dev33.satoken.session.SaSession;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
-import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.crypto.SecureUtil;
|
|
|
import cn.hutool.crypto.asymmetric.KeyType;
|
|
|
import cn.hutool.crypto.asymmetric.RSA;
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.flyer.exception.BusinessException;
|
|
|
import com.flyer.foster.consts.LoginDevice;
|
|
|
import com.flyer.foster.consts.RedisKeyConst;
|
|
|
import com.flyer.foster.dto.LoginDTO;
|
|
|
import com.flyer.foster.dto.UserAddDto;
|
|
|
-import com.flyer.foster.dto.UserAddOrUpdateDTO;
|
|
|
-import com.flyer.foster.dto.UserSearchDTO;
|
|
|
+import com.flyer.foster.dto.UserQueryDTO;
|
|
|
+import com.flyer.foster.dto.UserRespDTO;
|
|
|
import com.flyer.foster.entity.Role;
|
|
|
import com.flyer.foster.entity.User;
|
|
|
import com.flyer.foster.entity.UserRole;
|
|
@@ -113,17 +111,17 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public IPage<UserSearchDTO> selectByPage(IPage<User> page, UserSearchDTO searchDTO) {
|
|
|
+ public IPage<UserRespDTO> getPageList(IPage<User> page, UserQueryDTO queryDTO) {
|
|
|
int tenantId = StpUtil.getTokenSession().getInt("tenantId");
|
|
|
- searchDTO.setTenantId(tenantId);
|
|
|
+ queryDTO.setTenantId(tenantId);
|
|
|
// 查询管理员角色的账号
|
|
|
Role adminRole = iRoleService.lambdaQuery().eq(Role::getIsAdmin, 1).eq(Role::getTenantId, tenantId).one();
|
|
|
// 获取管理员用户id
|
|
|
UserRole userRole = iUserRoleService.lambdaQuery().eq(UserRole::getRoleId, adminRole.getId()).one();
|
|
|
- searchDTO.setAdminUserId(userRole.getUserId());
|
|
|
- IPage<UserSearchDTO> pageResult = baseMapper.selectByPage(page, searchDTO);
|
|
|
+ queryDTO.setAdminUserId(userRole.getUserId());
|
|
|
+ IPage<UserRespDTO> pageResult = baseMapper.getPageList(page, queryDTO);
|
|
|
// 获取单个视频对象的标签集合
|
|
|
- for (UserSearchDTO record : pageResult.getRecords()) {
|
|
|
+ for (UserRespDTO record : pageResult.getRecords()) {
|
|
|
List<Integer> roleIdList = iUserRoleService.lambdaQuery()
|
|
|
.eq(UserRole::getUserId, record.getId()).list()
|
|
|
.stream().map(UserRole::getRoleId).collect(Collectors.toList());
|
|
@@ -178,4 +176,16 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
|
|
|
iUserRoleService.save(userRole);
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<UserRespDTO> getList(UserQueryDTO queryDTO) {
|
|
|
+ int tenantId = StpUtil.getTokenSession().getInt("tenantId");
|
|
|
+ queryDTO.setTenantId(tenantId);
|
|
|
+ // 查询管理员角色的账号
|
|
|
+ Role adminRole = iRoleService.lambdaQuery().eq(Role::getIsAdmin, 1).eq(Role::getTenantId, tenantId).one();
|
|
|
+ // 获取管理员用户id
|
|
|
+ UserRole userRole = iUserRoleService.lambdaQuery().eq(UserRole::getRoleId, adminRole.getId()).one();
|
|
|
+ queryDTO.setAdminUserId(userRole.getUserId());
|
|
|
+ return baseMapper.getList(queryDTO);
|
|
|
+ }
|
|
|
}
|