Commit de9f19d5 by zhiwj

修改bug

parent 3476e935
...@@ -101,4 +101,14 @@ public interface ResourceApiService { ...@@ -101,4 +101,14 @@ public interface ResourceApiService {
* @throws * @throws
*/ */
ServiceResponse<OrderResourceDTO> getOrderResourceByUserId(Integer userId); ServiceResponse<OrderResourceDTO> getOrderResourceByUserId(Integer userId);
/**
* @Title: getUserResourceByUserId
* @Description:
* @author zhiwj
* @param userId
* @return com.gic.api.base.commons.ServiceResponse<com.gic.auth.dto.OrderResourceDTO> 返回null表示没有授权 返回 -1 表示全部
* @throws
*/
ServiceResponse<Long> getUserResourceByUserId(Integer userId);
} }
...@@ -342,4 +342,20 @@ public class ResourceApiServiceImpl implements ResourceApiService { ...@@ -342,4 +342,20 @@ public class ResourceApiServiceImpl implements ResourceApiService {
return EnterpriseServiceResponse.success(defaultResource); return EnterpriseServiceResponse.success(defaultResource);
} }
@Override
public ServiceResponse<Long> getUserResourceByUserId(Integer userId) {
TabSysUser user = userService.getUserById(userId);
if (user.getSuperAdmin() == 1) {
// 是超管就返回所有
return EnterpriseServiceResponse.success(-1L);
}
List<UserResourceDTO> resourceDTOList = this.userResourceService.listUserResourceByUserId(userId);
if (CollectionUtils.isEmpty(resourceDTOList)) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS);
}
UserResourceDTO userResourceDTO = resourceDTOList.get(0);
TabSysResource resource = this.resourceService.getResource(userResourceDTO.getResourceId());
return EnterpriseServiceResponse.success(resource.getUserResource());
}
} }
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