|
@@ -78,9 +78,15 @@ public class AdminUserManagerImpl implements AdminUserManager {
|
|
|
*/
|
|
|
@Override
|
|
|
public WebPage list(long page, long pageSize, String keyword, Integer userState) {
|
|
|
-
|
|
|
IPage<AdminUserDTO> iPage = adminUserMapper.selectPageDto(new Page<>(page, pageSize), keyword, userState);
|
|
|
- return PageConvert.convert(iPage);
|
|
|
+ for (AdminUserDTO record : iPage.getRecords()) {
|
|
|
+ if (record.getUsername().equals("superadmin")) {
|
|
|
+ iPage.getRecords().remove(record);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ WebPage convert = PageConvert.convert(iPage);
|
|
|
+
|
|
|
+ return convert;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -157,16 +163,15 @@ public class AdminUserManagerImpl implements AdminUserManager {
|
|
|
throw new ResourceNotFoundException("当前管理员不存在");
|
|
|
}
|
|
|
//如果修改的是从超级管理员到普通管理员 需要校验此管理员是否是最后一个超级管理员
|
|
|
-// if (adminUser.getFounder().equals(1) && !adminUserVO.getFounder().equals(1)) {
|
|
|
-//
|
|
|
+ if (adminUser.getFounder().equals(1) && !adminUserVO.getFounder().equals(1)) {
|
|
|
+
|
|
|
// QueryWrapper<AdminUser> wrapper = new QueryWrapper<>();
|
|
|
// wrapper.eq("founder", 1).eq("user_state", 0);
|
|
|
-// List<AdminUser> adminUsers = adminUserMapper.selectList(wrapper);
|
|
|
-//
|
|
|
-// if (adminUsers.size() <= 1) {
|
|
|
-// throw new ServiceException(SystemErrorCode.E916.code(), "必须保留一个超级管理员");
|
|
|
-// }
|
|
|
-// }
|
|
|
+ List<AdminUser> adminUsers = adminUserMapper.selectList(new LambdaQueryWrapper<AdminUser>().eq(AdminUser::getFounder,1).eq(AdminUser::getUserState,0));
|
|
|
+ if (adminUsers.size() <= 1) {
|
|
|
+ throw new ServiceException(SystemErrorCode.E916.code(), "必须保留一个超级管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
if (!adminUserVO.getFounder().equals(1)) {
|
|
|
RoleDO roleDO = roleManager.getModel(adminUserVO.getRoleId());
|
|
|
if (roleDO == null) {
|