系统用户管理
This commit is contained in:
@@ -136,6 +136,9 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
||||
// 查询角色
|
||||
List<SysRole> roleList = sysRoleService.getByUserId(user.getId());
|
||||
List<String> roleNames = roleList.stream().map(SysRole::getName).collect(Collectors.toList());
|
||||
if (user.getIsAdmin()) {
|
||||
roleNames.add("admin");
|
||||
}
|
||||
StpKit.USER.addRoleList(roleNames);
|
||||
// 权限赋予
|
||||
List<String> promissionList = sysMenuMapper.selectByUserId(user.getId(), null).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||
@@ -143,9 +146,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
||||
if (shopStaffPromissionList != null && !shopStaffPromissionList.isEmpty()) {
|
||||
promissionList.addAll(shopStaffPromissionList);
|
||||
}
|
||||
if (user.getIsAdmin()) {
|
||||
promissionList.add("admin");
|
||||
}
|
||||
|
||||
StpKit.USER.addPermissionList(promissionList);
|
||||
String platformType = ServletUtil.getHeaderIgnoreCase(ServletUtil.getRequest(), "platformType");
|
||||
if (PlatformTypeEnum.PC_CLIENT.getValue().equals(platformType)) {
|
||||
|
||||
@@ -116,9 +116,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
|
||||
|
||||
@Override
|
||||
public Boolean edit(SysUserEditDTO sysUserEditDTO) {
|
||||
long count = count(new QueryWrapper().eq(SysUser::getAccount, sysUserEditDTO.getAccount()).ne(SysUser::getId, sysUserEditDTO.getId()));
|
||||
if (count > 0) {
|
||||
throw new ApiNotPrintException("账号已存在");
|
||||
if (StrUtil.isNotBlank(sysUserEditDTO.getAccount())) {
|
||||
long count = count(new QueryWrapper().eq(SysUser::getAccount, sysUserEditDTO.getAccount()).ne(SysUser::getId, sysUserEditDTO.getId()));
|
||||
if (count > 0) {
|
||||
throw new ApiNotPrintException("账号已存在");
|
||||
}
|
||||
}
|
||||
|
||||
SysUser sysUser = getById(sysUserEditDTO.getId());
|
||||
@@ -143,8 +145,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
|
||||
if (sysUser == null) {
|
||||
throw new ApiNotPrintException("用户不存在");
|
||||
}
|
||||
int i = sysUsersRolesMapper.deleteByQuery(new QueryWrapper().eq(SysUsersRoles::getUserId, id));
|
||||
return i > 0;
|
||||
boolean remove = remove(new QueryWrapper().eq(SysUser::getId, id));
|
||||
if (remove) {
|
||||
int i = sysUsersRolesMapper.deleteByQuery(new QueryWrapper().eq(SysUsersRoles::getUserId, id));
|
||||
return i > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user