|
|
@@ -3,7 +3,6 @@ package com.jzg.service.impl;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.jzg.commons.constants.SystemConstants;
|
|
|
@@ -88,12 +87,14 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
|
|
|
.collect(Collectors.groupingBy(SysUserRole::getUserId));
|
|
|
List<SysUserRole> userRoles = nameMap.get(vo.getId());
|
|
|
List<String> roleNames = new ArrayList<>();
|
|
|
- userRoles.forEach(sysUserRole -> {
|
|
|
- if(StringUtils.isNotEmpty(sysUserRole.getName())){
|
|
|
- roleNames.add(sysUserRole.getName());
|
|
|
- }
|
|
|
- });
|
|
|
- vo.setRoleNameList(roleNames);
|
|
|
+ if(CollUtil.isNotEmpty(userRoles)){
|
|
|
+ userRoles.forEach(sysUserRole -> {
|
|
|
+ if(StringUtils.isNotEmpty(sysUserRole.getName())){
|
|
|
+ roleNames.add(sysUserRole.getName());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ vo.setRoleNameList(roleNames);
|
|
|
+ }
|
|
|
return vo;
|
|
|
}
|
|
|
|
|
|
@@ -186,13 +187,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
|
|
|
BeanUtils.copyProperties(param, user);
|
|
|
this.updateById(user);
|
|
|
|
|
|
- SysUserPlateInfo info = sysUserPlateInfoMapper.selectOne(new LambdaQueryWrapper<SysUserPlateInfo>()
|
|
|
- .eq(SysUserPlateInfo::getUserId, user.getId()));
|
|
|
-
|
|
|
// 删除当前用户与角色的关联信息
|
|
|
- LambdaUpdateWrapper<SysUserRole> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.eq(SysUserRole::getUserId, info.getId());
|
|
|
- sysUserRoleMapper.delete(updateWrapper);
|
|
|
+ sysUserRoleMapper.deleteByUserId(user.getId());
|
|
|
|
|
|
// 角色信息关联
|
|
|
List<String> roleList = param.getRoleIdList();
|
|
|
@@ -210,7 +206,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean deleteByIds(List<String> ids) {
|
|
|
// 删除当前用户与角色的关联信息
|
|
|
- LambdaUpdateWrapper<SysUserRole> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ LambdaQueryWrapper<SysUserRole> updateWrapper = new LambdaQueryWrapper<>();
|
|
|
updateWrapper.in(SysUserRole::getUserId, ids);
|
|
|
sysUserRoleMapper.delete(updateWrapper);
|
|
|
sysUserPlateInfoMapper.delete(new LambdaQueryWrapper<SysUserPlateInfo>().in(SysUserPlateInfo::getUserId, ids));
|