|
|
|
@ -1,13 +1,11 @@
|
|
|
|
|
package com.shxy.xymanager_service.impl;
|
|
|
|
|
|
|
|
|
|
import com.shxy.xymanager_common.bean.PermissionDetail;
|
|
|
|
|
import com.shxy.xymanager_common.entity.TbPermission;
|
|
|
|
|
import com.shxy.xymanager_common.entity.TbPermissionExample;
|
|
|
|
|
import com.shxy.xymanager_common.entity.TbRoleResource;
|
|
|
|
|
import com.shxy.xymanager_common.entity.TbRoleResourceExample;
|
|
|
|
|
import com.shxy.xymanager_common.entity.*;
|
|
|
|
|
import com.shxy.xymanager_common.enums.PermissionDetailEnum;
|
|
|
|
|
import com.shxy.xymanager_dao.dao.TbPermissionMapper;
|
|
|
|
|
import com.shxy.xymanager_dao.dao.TbRoleResourceMapper;
|
|
|
|
|
import com.shxy.xymanager_service.service.ResourceService;
|
|
|
|
|
import com.shxy.xymanager_service.service.RolePermissionService;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
|
|
@ -15,6 +13,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@ -24,6 +23,8 @@ public class RolePermissionServiceImpl implements RolePermissionService {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
TbRoleResourceMapper mapper;
|
|
|
|
|
@Resource
|
|
|
|
|
ResourceService resourceService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -50,4 +51,20 @@ public class RolePermissionServiceImpl implements RolePermissionService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<TbResource> getPermitResource(Integer roleId) {
|
|
|
|
|
List<TbResource> result = new ArrayList<>();
|
|
|
|
|
List<TbResource> resourceList = resourceService.listAll();
|
|
|
|
|
List<TbRoleResource> list = this.getPermission(roleId);
|
|
|
|
|
for (TbRoleResource item : list) {
|
|
|
|
|
for (TbResource resource : resourceList) {
|
|
|
|
|
if (resource.getId().equals(item.getResourceId())) {
|
|
|
|
|
result.add(resource);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|