Commit ba3158b5 by zhangkb

基础项目录添加获取第一个有效目录节点接口

parent 69661ba7
...@@ -53,6 +53,13 @@ public class IndCatalogCtrl { ...@@ -53,6 +53,13 @@ public class IndCatalogCtrl {
return indCatalogService.getCatalogByKeyword(keyword,codes); return indCatalogService.getCatalogByKeyword(keyword,codes);
} }
@ApiOperation(value = "获取第一个有效的目录节点", notes = "获取第一个有效的目录节点")
@PostMapping(value = "/getFirstVaildBaseIndCatalog")
public IndCatalog getFirstVaildBaseIndCatalog(@RequestParam Integer pid,
@RequestParam List<String> codes){
return indCatalogService.getFirstVaildCatalog(pid, codes);
}
//考核指标目录 //考核指标目录
@ApiOperation(value = "新建考核指标目录", notes = "新建考核指标目录") @ApiOperation(value = "新建考核指标目录", notes = "新建考核指标目录")
@PostMapping(value = "/createDriveIndCatalog") @PostMapping(value = "/createDriveIndCatalog")
......
...@@ -19,4 +19,6 @@ public interface IndCatalogMapper extends BaseMapper<IndCatalog>{ ...@@ -19,4 +19,6 @@ public interface IndCatalogMapper extends BaseMapper<IndCatalog>{
public List<IndCatalog> findByParentId(@Param("pid") Integer pid); public List<IndCatalog> findByParentId(@Param("pid") Integer pid);
public List<IndCatalog> findByKeyword(Map<String,Object> params); public List<IndCatalog> findByKeyword(Map<String,Object> params);
public List<IndCatalog> findFirstVaildCatalog(Map<String,Object> params);
} }
...@@ -92,4 +92,16 @@ public class IndCatalogService { ...@@ -92,4 +92,16 @@ public class IndCatalogService {
params.put("codes", codes); params.put("codes", codes);
return indCatalogMapper.findByKeyword(params); return indCatalogMapper.findByKeyword(params);
} }
//获取第一个有效目录节点
public IndCatalog getFirstVaildCatalog(Integer pid,List<String> codes) {
Map<String,Object> params = new HashMap<>();
params.put("pidPath", pid+";"+"%");
params.put("codes", codes);
List<IndCatalog> resultList = indCatalogMapper.findFirstVaildCatalog(params);
if(!resultList.isEmpty()) {
return resultList.get(0);
}
return null;
}
} }
...@@ -36,4 +36,16 @@ ...@@ -36,4 +36,16 @@
#{id} #{id}
</foreach> </foreach>
</select> </select>
<select id="findFirstVaildCatalog" resultType="com.keymobile.indicators.model.entity.indicators.IndCatalog" >
select *
from base_ind_catalog
where id_path like #{pidPath} and
catalog_type = '1' and
code in
<foreach item="id" collection="codes" open="(" close=")" separator=",">
#{id}
</foreach>
order by last_update_time desc
</select>
</mapper> </mapper>
\ No newline at end of file
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