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