瀏覽代碼

角色删除改为物理删除

zhangqiankun 3 年之前
父節點
當前提交
84f953e1b8

+ 3 - 6
saas-account/src/main/java/com/persagy/person/manage/SaasRoleMenuHandler.java

@@ -10,7 +10,6 @@ import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.google.common.collect.Lists;
 import com.persagy.common.constant.SaasCommonConstant;
 import com.persagy.common.exception.BusinessException;
@@ -139,11 +138,9 @@ public class SaasRoleMenuHandler {
 	 */
 	@Transactional
 	public boolean deleteSaasRole(SaasRoleDeleteVO deleteVO) {
-		LambdaUpdateWrapper<SaasRole> updateWrapper = new SaasRole.Builder().createUpdateWrapper().idEq(deleteVO.getId())
-				.validEq(SaasCommonConstant.STATUS_1).builderUpdateWrapper();
-		updateWrapper.set(SaasRole::getUpdateUser, deleteVO.getAccountId());
-		updateWrapper.set(SaasRole::getValid, SaasCommonConstant.STATUS_0);
-		boolean result = this.saasRoleService.update(updateWrapper);
+		LambdaQueryWrapper<SaasRole> updateWrapper = new SaasRole.Builder().createQueryWrapper().idEq(deleteVO.getId())
+				.validEq(SaasCommonConstant.STATUS_1).builderQueryWrapper();
+		boolean result = this.saasRoleService.remove(updateWrapper);
 		if (result) {
 			// 1.级联删除账号和角色关联关系
 			LambdaQueryWrapper<SaasAccountRole> accountRoleWrapper = new SaasAccountRole.Builder().createQueryWrapper().roleIdEq(deleteVO.getId()).builderQueryWrapper();

+ 2 - 2
saas-account/src/main/java/com/persagy/person/service/impl/SaasRoleServiceImpl.java

@@ -52,8 +52,8 @@ public class SaasRoleServiceImpl extends SuperServiceImpl<SaasRoleMapper, SaasRo
 
 	@Override
 	public boolean validRoleName(String groupCode, String roleName, String roleType, String roleId) {
-		LambdaQueryWrapper<SaasRole> queryWrapper = new SaasRole.Builder().createQueryWrapper().idEq(roleId)
-				.groupCodeEq(groupCode).roleNameEq(roleName).roleTypeEq(roleType).builderQueryWrapper();
+		LambdaQueryWrapper<SaasRole> queryWrapper = new SaasRole.Builder().createQueryWrapper().idEq(roleId).groupCodeEq(groupCode)
+				.roleNameEq(roleName).roleTypeEq(roleType).validEq(SaasCommonConstant.STATUS_1).builderQueryWrapper();
 		List<SaasRole> list = this.baseMapper.selectList(queryWrapper);
 		if (CollectionUtil.isEmpty(list)) {
 			return true;