Browse Source

添加批量删除账号的方法

xingguoqiang 3 years ago
parent
commit
5e40aac300

+ 11 - 5
saas-account/src/main/java/com/persagy/account/controller/SaasAccountController.java

@@ -2,6 +2,7 @@ package com.persagy.account.controller;
 
 import java.util.List;
 
+import com.persagy.account.pojo.vo.account.*;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -19,11 +20,6 @@ import com.persagy.account.config.ApplicationProperties;
 import com.persagy.account.manage.SaasAccountHandler;
 import com.persagy.account.pojo.dto.SaasAccount;
 import com.persagy.account.pojo.dto.SaasRole;
-import com.persagy.account.pojo.vo.account.SaasAccountCreateVO;
-import com.persagy.account.pojo.vo.account.SaasAccountGroupVO;
-import com.persagy.account.pojo.vo.account.SaasAccountPageVO;
-import com.persagy.account.pojo.vo.account.SaasAccountQueryByNameVO;
-import com.persagy.account.pojo.vo.account.SaasAccountQueryVO;
 import com.persagy.account.service.ISaasAccountService;
 import com.persagy.account.service.ISaasRoleService;
 import com.persagy.common.constant.SaasCommonConstant;
@@ -324,4 +320,14 @@ public class SaasAccountController {
         return result ? ResponseResultUtil.successResult("密码重置成功") : ResponseResultUtil.errorResult("密码重置失败");
     }
 
+
+    /**
+     * 根据id集合批量删除 ---物理删除
+     */
+    @ApiOperation(value = "根据id集合批量删除")
+    @RequestMapping(value = "deleteSaasAccountListByIds")
+    public ResponseResult deleteSaasAccountListByIds(@RequestBody @Validated SaasAccountDeleteVO deleteModel) {
+        boolean result = this.saasAccountHandler.deleteSaasAccountListByIds(deleteModel);
+        return result ? ResponseResultUtil.successResult("删除成功") : ResponseResultUtil.errorResult("删除失败");
+    }
 }

+ 23 - 1
saas-account/src/main/java/com/persagy/account/manage/SaasAccountHandler.java

@@ -2,6 +2,8 @@ package com.persagy.account.manage;
 
 import java.util.List;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.persagy.account.pojo.vo.account.SaasAccountDeleteVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
@@ -165,5 +167,25 @@ public class SaasAccountHandler {
 		}
 		this.commonTopicProducer.sendAccountInfo(saasAccount, SaasCommonConstant.CREATE_TYPE);
 	}
-	
+
+
+	/**
+	 * @Description: TODO
+	 * @Author: xgq
+	 * @Date: 2021/4/29 21:46
+	 * @param deleteModel:
+	 * @return: boolean
+	 **/
+	@Transactional
+    public boolean deleteSaasAccountListByIds(SaasAccountDeleteVO deleteModel) {
+        LambdaQueryWrapper<SaasAccount> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(SaasAccount::getAccountBelong, deleteModel.getAccountBelong());
+        queryWrapper.eq(SaasAccount::getAccountType, deleteModel.getAccountType());
+        queryWrapper.eq(SaasAccount::getAccountSource, deleteModel.getAccountSource());
+        queryWrapper.eq(SaasAccount::getGroupCode,deleteModel.getGroupCode());
+        queryWrapper.eq(SaasAccount::getAppId, deleteModel.getAppId());
+        queryWrapper.in(SaasAccount::getId,deleteModel.getIds());
+        boolean remove = saasAccountService.remove(queryWrapper);
+        return remove;
+    }
 }

+ 41 - 0
saas-account/src/main/java/com/persagy/account/pojo/vo/account/SaasAccountDeleteVO.java

@@ -0,0 +1,41 @@
+package com.persagy.account.pojo.vo.account;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @ClassName : AccountDTO
+ * @Author :xgq
+ * @Date :Created in 2021/4/16 0:42
+ * @Description: TODO
+ * @Version : 1.0
+ */
+@Data
+@ApiModel(value = "删除账号入参")
+public class SaasAccountDeleteVO {
+
+    private  String appId;
+
+     /**账号所属, 0-运维系统账号,1-业务账号 **/
+    private String accountBelong;
+
+    /**账号类型, 0-超级管理员(所有集团),1-单集团管理员(单集团),2-普通账号 */
+    private String accountType;
+
+    /**账号来源,万达集团:201 **/
+    private String accountSource;
+
+    /**集团编码**/
+    private String groupCode;
+
+    private String username;
+
+    private String roleId;
+
+    /** id集合 **/
+    private List<String> ids;
+
+    
+}