Commit 64da2f28 by zhangkb

修改获取维度标签根目录接口

parent d859f934
...@@ -306,7 +306,22 @@ public class TagCtrl { ...@@ -306,7 +306,22 @@ public class TagCtrl {
@ApiOperation(value = "(2020-7-21)获取所有根目录维度标签", notes = "(2020-7-21)获取所有根目录维度标签") @ApiOperation(value = "(2020-7-21)获取所有根目录维度标签", notes = "(2020-7-21)获取所有根目录维度标签")
@PostMapping(value = "/getAllDimensionRootTag") @PostMapping(value = "/getAllDimensionRootTag")
public List<Map<String,Object>> getAllDimensionRootTag(){ public List<Map<String,Object>> getAllDimensionRootTag(){
return tagService.getDimensionRootTag(); Long deptId = GrantedAuthHelper.getUserOrg();
if(deptId==null) {
logger.info("获取用户机构为空");
}
String deptIdPath = /**UserInfoUtils.getDataRoleOrg()*/String.valueOf(GrantedAuthHelper.getUserOrg());
//考虑一个用户对应多个机构的情况
List<String> orgIds = new ArrayList<>();
orgIds.add(deptIdPath);
//获取当前用户被授予其他机构
List<Long> deptList = GrantedAuthHelper.getUserGrantedOrgs();
if(deptList!=null) {
for(Long dept : deptList) {
orgIds.add(String.valueOf(dept));
}
}
return tagService.getDimensionRootTag(orgIds);
} }
//---------------以下为导入系统的时候用到------------------ //---------------以下为导入系统的时候用到------------------
......
...@@ -15,5 +15,6 @@ public interface TagRepository extends MongoRepository<Tag, String> { ...@@ -15,5 +15,6 @@ public interface TagRepository extends MongoRepository<Tag, String> {
public List<Tag> findByIdIn(List<String> ids); public List<Tag> findByIdIn(List<String> ids);
public List<Tag> findByLevelAndTagTypeAndDimensionType(Integer level,String tagType,String dimensionType); public List<Tag> findByLevelAndTagTypeAndDimensionTypeAndProDeptIn(Integer level,String tagType,
String dimensionType,List<String> orgIds);
} }
...@@ -944,9 +944,9 @@ public class TagService { ...@@ -944,9 +944,9 @@ public class TagService {
} }
//author:zhangkb time:2020-7-21 desc:获取维度标签根目录 //author:zhangkb time:2020-7-21 desc:获取维度标签根目录
public List<Map<String,Object>> getDimensionRootTag(){ public List<Map<String,Object>> getDimensionRootTag(List<String> orgIds){
List<Map<String,Object>> resultList = new ArrayList<>(); List<Map<String,Object>> resultList = new ArrayList<>();
List<Tag> result = tagRepository.findByLevelAndTagTypeAndDimensionType(1, "1", "1"); List<Tag> result = tagRepository.findByLevelAndTagTypeAndDimensionTypeAndProDeptIn(1, "1", "1",orgIds);
for(Tag tag : result) { for(Tag tag : result) {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("tagId", tag.getId()); map.put("tagId", tag.getId());
......
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