Commit 3060066f by guojuxing

子管理员查询资源组配置

parent 37b55b39
package com.gic.auth.service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.ResourceGroupDTO;
import com.gic.auth.dto.UserResourceDTO;
/**
* 用户资源组关联
......@@ -30,4 +31,11 @@ public interface UserResourceApiService {
* @return
*/
ServiceResponse<UserResourceDTO> getResourceByUserId(Integer userId);
/**
* 子管理员查询资源组数据
* @param userId
* @return
*/
ServiceResponse<ResourceGroupDTO> getResourceGroupByUserId(Integer userId);
}
......@@ -2,8 +2,10 @@ package com.gic.auth.service.outer.impl;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.constant.DeleteFlagConstants;
import com.gic.auth.dto.ResourceGroupDTO;
import com.gic.auth.dto.UserResourceDTO;
import com.gic.auth.entity.TabSysUser;
import com.gic.auth.service.ResourceGroupApiService;
import com.gic.auth.service.UserResourceApiService;
import com.gic.auth.service.UserResourceService;
import com.gic.auth.service.UserService;
......@@ -28,6 +30,8 @@ public class UserResourceApiServiceImpl implements UserResourceApiService{
private UserResourceService userResourceService;
@Autowired
private UserService userService;
@Autowired
private ResourceGroupApiService resourceGroupApiService;
@Override
public ServiceResponse<Void> save(UserResourceDTO dto) {
ServiceResponse paramValid = ValidParamsUtils.allCheckValidate(dto, UserResourceDTO.SaveUserResourceValid.class);
......@@ -55,4 +59,26 @@ public class UserResourceApiServiceImpl implements UserResourceApiService{
}
return ServiceResponse.success(new UserResourceDTO());
}
@Override
public ServiceResponse<ResourceGroupDTO> getResourceGroupByUserId(Integer userId) {
ServiceResponse<UserResourceDTO> response = getResourceByUserId(userId);
if (response.isSuccess()) {
UserResourceDTO userResourceDTO = response.getResult();
if (userResourceDTO != null) {
Integer resourceId = userResourceDTO.getResourceId();
ServiceResponse<ResourceGroupDTO> resourceRes = resourceGroupApiService.getResourceGroup(resourceId);
if (resourceRes.isSuccess()) {
ResourceGroupDTO result = resourceRes.getResult();
if (result != null) {
return ServiceResponse.success(result);
}
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "没有资源组数据");
}
return ServiceResponse.failure(resourceRes.getCode(), resourceRes.getMessage());
}
}
return ServiceResponse.failure(response.getCode(), response.getMessage());
}
}
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