返回数据
This commit is contained in:
@@ -86,7 +86,7 @@ public class SysLoginController extends AbstractController {
|
||||
user.setIsChannel(1);
|
||||
user.setQdRate(new BigDecimal("0.01"));
|
||||
user.setStatus(1);
|
||||
user.setRoleIdList(Collections.singletonList(4L));
|
||||
user.setRoleIdList(Collections.singletonList("4"));
|
||||
ValidatorUtils.validateEntity(user, AddGroup.class);
|
||||
user.setUserId(InvitationCodeUtil.getSnowFlakeId());
|
||||
sysUserService.saveUser(user);
|
||||
|
||||
@@ -88,7 +88,7 @@ public class SysUserController extends AbstractController {
|
||||
SysUserEntity user = sysUserService.getById(userId);
|
||||
|
||||
//获取用户所属的角色列表
|
||||
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(userId);
|
||||
List<String> roleIdList = sysUserRoleService.queryRoleIdList(userId);
|
||||
user.setRoleIdList(roleIdList);
|
||||
|
||||
return Result.success().put("user", user);
|
||||
|
||||
@@ -12,11 +12,11 @@ import java.util.List;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysUserRoleDao extends BaseMapper<SysUserRoleEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户ID,获取角色ID列表
|
||||
*/
|
||||
List<Long> queryRoleIdList(Long userId);
|
||||
List<String> queryRoleIdList(Long userId);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,7 +72,7 @@ public class SysUserEntity implements Serializable {
|
||||
* 角色ID列表
|
||||
*/
|
||||
@TableField(exist=false)
|
||||
private List<Long> roleIdList;
|
||||
private List<String> roleIdList;
|
||||
|
||||
/**
|
||||
* 创建者ID
|
||||
|
||||
@@ -12,13 +12,13 @@ import java.util.List;
|
||||
*
|
||||
*/
|
||||
public interface SysUserRoleService extends IService<SysUserRoleEntity> {
|
||||
|
||||
void saveOrUpdate(Long userId, List<Long> roleIdList);
|
||||
|
||||
|
||||
void saveOrUpdate(Long userId, List<String> roleIdList);
|
||||
|
||||
/**
|
||||
* 根据用户ID,获取角色ID列表
|
||||
*/
|
||||
List<Long> queryRoleIdList(Long userId);
|
||||
List<String> queryRoleIdList(Long userId);
|
||||
|
||||
/**
|
||||
* 根据角色ID数组,批量删除
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.List;
|
||||
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleDao, SysUserRoleEntity> implements SysUserRoleService {
|
||||
|
||||
@Override
|
||||
public void saveOrUpdate(Long userId, List<Long> roleIdList) {
|
||||
public void saveOrUpdate(Long userId, List<String> roleIdList) {
|
||||
if (roleIdList == null || roleIdList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -27,17 +27,17 @@ public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleDao, SysUserR
|
||||
this.removeByMap(new MapUtils().put("user_id", userId));
|
||||
|
||||
//保存用户与角色关系
|
||||
for (Long roleId : roleIdList) {
|
||||
for (String roleId : roleIdList) {
|
||||
SysUserRoleEntity sysUserRoleEntity = new SysUserRoleEntity();
|
||||
sysUserRoleEntity.setUserId(userId);
|
||||
sysUserRoleEntity.setRoleId(roleId);
|
||||
sysUserRoleEntity.setRoleId(Long.parseLong(roleId));
|
||||
|
||||
this.save(sysUserRoleEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> queryRoleIdList(Long userId) {
|
||||
public List<String> queryRoleIdList(Long userId) {
|
||||
return baseMapper.queryRoleIdList(userId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user