| | |
| | | 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; |
| | |
| | | //查询是否逻辑删除 |
| | | ManageAccount manageAccount = null; |
| | | for (ManageAccount value : manageAccounts) { |
| | | if ("0".equals(value.getIsDelete())) |
| | | if (Constants.NOT_DELETE.equals(value.getIsDelete())) |
| | | manageAccount = value; |
| | | } |
| | | |
| | |
| | | /*判断账号是否存在*/ |
| | | 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); |
| | |
| | | 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); |
| | | //查询用户对应的角色 |
| | |
| | | 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)) { |
| | |
| | | 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); |
| | |
| | | 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()); |