Commit e91d8816 by huangjinxin

fix:构建资源树去掉组织

1 parent f51b511e
...@@ -10,26 +10,26 @@ import java.util.List; ...@@ -10,26 +10,26 @@ import java.util.List;
/** /**
* 资源表 用户对某种具体权限或者功能的描述(Resource)表数据库访问层 * 资源表 用户对某种具体权限或者功能的描述(Resource)表数据库访问层
*
*/ */
public interface ResourceDao extends JpaRepository<ResourceEntity, String>, public interface ResourceDao extends JpaRepository<ResourceEntity, String>,
JpaSpecificationExecutor<ResourceEntity>, CrudRepository<ResourceEntity, String> { JpaSpecificationExecutor<ResourceEntity>, CrudRepository<ResourceEntity, String> {
/** /**
* 根据IDs查询多个资源 * 根据IDs查询多个资源
*
* @param ids 资源ID集合 * @param ids 资源ID集合
* @return * @return
*/ */
List<ResourceEntity> findByIdIn(List<String> ids); List<ResourceEntity> findByIdIn(List<String> ids);
/** /**
* 查询子资源 * 查询子资源
* *
* @param parentIds * @param parentIds
* @return * @return
*/ */
List<ResourceEntity> findByParentId(String parentId); List<ResourceEntity> findByParentId(String parentId);
List<ResourceEntity> findByTypeNot(Integer type);
} }
...@@ -279,7 +279,7 @@ public class RoleService { ...@@ -279,7 +279,7 @@ public class RoleService {
if (StringUtils.isNotBlank(redisValue)) { if (StringUtils.isNotBlank(redisValue)) {
return JSONObject.parseObject(redisValue, List.class); return JSONObject.parseObject(redisValue, List.class);
} }
List<ResourceEntity> all = resourceDao.findAll(); List<ResourceEntity> all = resourceDao.findByTypeNot(3);
List<ResourceInfo> collect = all.stream().filter(resourceEntity -> StringUtils.isBlank(resourceEntity.getParentId())).map(entity -> BeanUtil.copyProperties(entity, ResourceInfo.class)).collect(Collectors.toList()); List<ResourceInfo> collect = all.stream().filter(resourceEntity -> StringUtils.isBlank(resourceEntity.getParentId())).map(entity -> BeanUtil.copyProperties(entity, ResourceInfo.class)).collect(Collectors.toList());
for (ResourceInfo entity : collect) { for (ResourceInfo entity : collect) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!