kaiyu
2021-03-18 64994bcb51726e8e26016b99e2de55278539b484
screen-manage/src/main/java/com/moral/api/service/impl/ManageAccountServiceImpl.java
@@ -17,6 +17,7 @@
import com.moral.api.pojo.form.*;
import com.moral.api.service.ManageAccountService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.moral.constant.Constants;
import com.moral.constant.ResponseCodeEnum;
import com.moral.util.AESUtils;
import com.moral.util.MD5Utils;
@@ -81,7 +82,7 @@
        //查询是否逻辑删除
        ManageAccount manageAccount = null;
        for (ManageAccount value : manageAccounts) {
            if ("0".equals(value.getIsDelete()))
            if (Constants.NOT_DELETE.equals(value.getIsDelete()))
                manageAccount = value;
        }
@@ -163,7 +164,7 @@
        /*判断账号是否存在*/
        ManageAccount exitAccount = new ManageAccount();
        exitAccount.setAccount(account);
        exitAccount.setIsDelete("0");
        exitAccount.setIsDelete(Constants.NOT_DELETE);
        QueryWrapper<ManageAccount> wrapper = new QueryWrapper<>();
        wrapper.setEntity(exitAccount);
        List<ManageAccount> exitAccounts = manageAccountMapper.selectList(wrapper);
@@ -260,7 +261,7 @@
        if (!ObjectUtils.isEmpty(isDelete))
            wrapper.eq("is_delete", isDelete);
        else
            wrapper.eq("is_delete", "0");
            wrapper.eq("is_delete", Constants.NOT_DELETE);
        Page resultPage = manageAccountMapper.selectPage(page, wrapper);
        //查询用户对应的角色
@@ -310,7 +311,7 @@
        QueryWrapper<ManageAccount> exitWrapper = new QueryWrapper<>();
        ManageAccount exitManageAccount = new ManageAccount();
        exitManageAccount.setId(accountId);
        exitManageAccount.setIsDelete("0");
        exitManageAccount.setIsDelete(Constants.NOT_DELETE);
        exitWrapper.setEntity(exitManageAccount);
        List<ManageAccount> manageAccounts = manageAccountMapper.selectList(exitWrapper);
        if (ObjectUtils.isEmpty(manageAccounts)) {
@@ -365,7 +366,7 @@
        Integer accountId = accountDeleteForm.getAccountId();
        //查询是否存在
        ManageAccount manageAccount = new ManageAccount();
        manageAccount.setIsDelete("0");
        manageAccount.setIsDelete(Constants.NOT_DELETE);
        manageAccount.setId(accountId);
        QueryWrapper<ManageAccount> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(manageAccount);
@@ -376,13 +377,13 @@
            return accountDeleteDTO;
        }
        //逻辑删除账号
        existManageAccount.setIsDelete("1");
        existManageAccount.setIsDelete(Constants.DELETE);
        UpdateWrapper<ManageAccount> deleteAccountWrapper = new UpdateWrapper<>();
        deleteAccountWrapper.set("is_delete", "1").eq("id", manageAccount.getId());
        deleteAccountWrapper.set("is_delete", Constants.DELETE).eq("id", manageAccount.getId());
        manageAccountMapper.update(null, deleteAccountWrapper);
        //逻辑删除账号相关角色
        UpdateWrapper<ManageAccountRole> deleteManageAccountRoleWrapper = new UpdateWrapper<>();
        deleteManageAccountRoleWrapper.set("is_delete", "1").eq("account_id", manageAccount.getId());
        deleteManageAccountRoleWrapper.set("is_delete", Constants.DELETE).eq("account_id", manageAccount.getId());
        manageAccountRoleMapper.update(null, deleteManageAccountRoleWrapper);
        //封装返回结果
        accountDeleteDTO.setCode(ResponseCodeEnum.SUCCESS.getCode());