Commit af5bbb1d by guojuxing

角色菜单权限接口

parent 7b5813bb
......@@ -11,6 +11,7 @@ import com.gic.auth.dto.UserResourceDTO;
import com.gic.auth.entity.TabSysUserResource;
import com.gic.auth.service.UserResourceService;
import com.gic.commons.util.EntityUtil;
import org.springframework.transaction.annotation.Transactional;
/**
*
......@@ -50,6 +51,7 @@ public class UserResourceServiceImpl implements UserResourceService {
tabSysUserResourceMapper.insert(EntityUtil.changeEntityNew(TabSysUserResource.class, dto));
}
@Transactional(rollbackFor = Exception.class)
@Override
public void deleteByUserId(Integer userId) {
tabSysUserResourceMapper.deleteByUserId(userId);
......
......@@ -8,6 +8,7 @@ import com.gic.commons.util.EntityUtil;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
......@@ -21,6 +22,7 @@ public class UserRoleServiceImpl implements UserRoleService{
tabSysUserRoleMapper.insert(EntityUtil.changeEntityNew(TabSysUserRole.class, dto));
}
@Transactional(rollbackFor = Exception.class)
@Override
public void deleteByUserId(Integer userId) {
tabSysUserRoleMapper.deleteByUserId(userId);
......
......@@ -62,6 +62,9 @@ public class UserApiServiceImpl implements UserApiService {
userDTO.setStatus(1);
Integer userId = userService.saveUser(userDTO);
userRoleService.deleteByUserId(userId);
userResourceService.deleteByUserId(userId);
ServiceResponse<Integer> response = saveRole(userId, userDTO.getEnterpriseId(), userDTO.getUserRoleIds(),
userDTO.getUserResourceIds());
if (response.isSuccess()) {
......@@ -94,6 +97,9 @@ public class UserApiServiceImpl implements UserApiService {
userDTO.setUpdateTime(new Date());
userService.editUser(userDTO);
userRoleService.deleteByUserId(userDTO.getUserId());
userResourceService.deleteByUserId(userDTO.getUserId());
ServiceResponse response = saveRole(userDTO.getUserId(), userDTO.getEnterpriseId(), userDTO.getUserRoleIds(),
userDTO.getUserResourceIds());
if (response.isSuccess()) {
......
......@@ -30,7 +30,6 @@ public class UserResourceApiServiceImpl implements UserResourceApiService{
if (user == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "用户数据有误,查无数据");
}
userResourceService.deleteByUserId(user.getUserId());
dto.setCreateTime(new Date());
dto.setUpdateTime(new Date());
......
......@@ -29,7 +29,6 @@ public class UserRoleApiServiceImpl implements UserRoleApiService{
if (user == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "用户数据有误,查无数据");
}
userRoleService.deleteByUserId(user.getUserId());
dto.setCreateTime(new Date());
dto.setUpdateTime(new Date());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment