|
@@ -1,5 +1,6 @@
|
|
|
package com.jzg.service.impl;
|
|
package com.jzg.service.impl;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
@@ -17,6 +18,7 @@ import com.jzg.mapper.SysUserMapper;
|
|
|
import com.jzg.mapper.SysUserRoleMapper;
|
|
import com.jzg.mapper.SysUserRoleMapper;
|
|
|
import com.jzg.service.SysUserService;
|
|
import com.jzg.service.SysUserService;
|
|
|
import com.jzg.commons.util.PasswordUtils;
|
|
import com.jzg.commons.util.PasswordUtils;
|
|
|
|
|
+import jakarta.validation.constraints.NotEmpty;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -107,6 +109,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void userEdit(SysUserVo sysUserVo) {
|
|
public void userEdit(SysUserVo sysUserVo) {
|
|
|
SysUser user = new SysUser();
|
|
SysUser user = new SysUser();
|
|
|
BeanUtils.copyProperties(sysUserVo, user);
|
|
BeanUtils.copyProperties(sysUserVo, user);
|
|
@@ -133,7 +136,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public boolean deleteWithValidByIds(List<String> ids) {
|
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public boolean deleteByIds(List<String> ids) {
|
|
|
// 删除当前用户与角色的关联信息
|
|
// 删除当前用户与角色的关联信息
|
|
|
LambdaUpdateWrapper<SysUserRole> updateWrapper = new LambdaUpdateWrapper<>();
|
|
LambdaUpdateWrapper<SysUserRole> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.in(SysUserRole::getUserId, ids);
|
|
updateWrapper.in(SysUserRole::getUserId, ids);
|
|
@@ -158,6 +162,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void upAndDown(UpAndDownVo upAndDownVo) {
|
|
public void upAndDown(UpAndDownVo upAndDownVo) {
|
|
|
if(YesNoEnum.YES.equals(upAndDownVo.getOpType())) {
|
|
if(YesNoEnum.YES.equals(upAndDownVo.getOpType())) {
|
|
|
upAndDownVo.getIds().forEach(id->{
|
|
upAndDownVo.getIds().forEach(id->{
|
|
@@ -169,6 +174,22 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Boolean userDeleteValid(List<String> ids) {
|
|
|
|
|
+ if (CollUtil.isNotEmpty(ids)){
|
|
|
|
|
+ List<SysUserRole> userRoles = sysUserRoleMapper.selectList(new LambdaQueryWrapper<SysUserRole>()
|
|
|
|
|
+ .in(SysUserRole::getUserId, ids));
|
|
|
|
|
+ if(CollUtil.isNotEmpty(userRoles)){
|
|
|
|
|
+ for (SysUserRole userRole : userRoles) {
|
|
|
|
|
+ if ("".equals(userRole.getRoleId())){ // 平台管理员id
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|