From 657182c7989dc77b69bb3f9adaf6c75b6466ff95 Mon Sep 17 00:00:00 2001 From: kaiyu <404897439@qq.com> Date: Wed, 09 Jun 2021 10:31:35 +0800 Subject: [PATCH] screen-manage 编辑账号接口删除分配角色功能,分配角色功能变为单独接口 --- screen-manage/src/main/java/com/moral/api/service/impl/ManageAccountRoleServiceImpl.java | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) diff --git a/screen-manage/src/main/java/com/moral/api/service/impl/ManageAccountRoleServiceImpl.java b/screen-manage/src/main/java/com/moral/api/service/impl/ManageAccountRoleServiceImpl.java index f3b2d19..cceb0f7 100644 --- a/screen-manage/src/main/java/com/moral/api/service/impl/ManageAccountRoleServiceImpl.java +++ b/screen-manage/src/main/java/com/moral/api/service/impl/ManageAccountRoleServiceImpl.java @@ -1,10 +1,19 @@ package com.moral.api.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.moral.api.entity.ManageAccountRole; import com.moral.api.mapper.ManageAccountRoleMapper; +import com.moral.api.pojo.dto.accountRole.AccountRoleDTO; +import com.moral.api.pojo.form.accountRole.AccountRoleUpdateForm; import com.moral.api.service.ManageAccountRoleService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.moral.constant.Constants; +import com.moral.constant.ResponseCodeEnum; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.ObjectUtils; /** * <p> @@ -17,4 +26,32 @@ @Service public class ManageAccountRoleServiceImpl extends ServiceImpl<ManageAccountRoleMapper, ManageAccountRole> implements ManageAccountRoleService { + @Autowired + ManageAccountRoleMapper manageAccountRoleMapper; + + @Override + @Transactional + public AccountRoleDTO updateAccountRole(AccountRoleUpdateForm form) { + //������������������ + AccountRoleDTO dto = new AccountRoleDTO(); + //������ + Integer accountId = form.getAccountId(); + Integer roleId = form.getRoleId(); + //������������������������������������ + UpdateWrapper updateWrapper = new UpdateWrapper(); + updateWrapper.set("is_delete", Constants.DELETE); + updateWrapper.eq("account_id", accountId); + manageAccountRoleMapper.update(null, updateWrapper); + if(!ObjectUtils.isEmpty(roleId)){ + ManageAccountRole role = new ManageAccountRole(); + role.setAccountId(accountId); + role.setRoleId(roleId); + manageAccountRoleMapper.insert(role); + } + //������������������ + dto.setCode(ResponseCodeEnum.SUCCESS.getCode()); + dto.setMsg(ResponseCodeEnum.SUCCESS.getMsg()); + return dto; + } + } -- Gitblit v1.8.0