d6f438fb 张雷

资产接口增加项目ID

1 个父辈 d65d0afa
......@@ -71,8 +71,8 @@ public class AssetsController {
@GetMapping("/queryTreeList")
@ApiOperation(value="设备树结构数据", notes="设备树结构数据")
public Result<List<EquipmentTreeVO>> queryTreeList(String name){
List<TreeVO> treeVOList = assetsService.queryTreeListOfAssetScreen(name);
public Result<List<EquipmentTreeVO>> queryTreeList(String projectId,String name){
List<TreeVO> treeVOList = assetsService.queryTreeListOfAssetScreen(projectId,name);
//将业务数据转换为构造树所需的数据结构
List<TransTreeModel> transTreeModels = treeVOList.stream().map(bo -> convertToTreeModel(bo)).collect(Collectors.toList());
List<TreeData> treeList = TreeUtils.buildTreeByRootId(transTreeModels, "0");
......
......@@ -46,8 +46,9 @@ public interface AssetsMapper {
/**
* 设备树
* @param name
* @param projectId
* @param equipName
* @return
*/
List<TreeVO> queryTreeListOfAssetScreen(String name);
List<TreeVO> queryTreeListOfAssetScreen(@Param("projectId") String projectId,@Param("equipName") String equipName);
}
......
......@@ -28,14 +28,68 @@
)t order by `count` desc
</select>
<!-- <select id="queryTreeListOfAssetScreen" resultType="com.skua.modules.business.vo.TreeVO">-->
<!-- select id,'0' as parent_id,struct_name as title,'0' as nodeType,struct_code as code,sort_num as sno from sys_struct_dict-->
<!-- union all-->
<!-- select t.equip_id as id,e.struct_id as parent_id,e.equip_name as title,'1' as nodeType,e.equip_unit as code,'1' as sno from fm_twin_equip t-->
<!-- left join (-->
<!-- select ee.id,ee.equip_name,ee.equip_unit,sd.id as struct_id from sys_equip_info ee-->
<!-- left join sys_struct_dict sd on ee.equip_unit = sd.struct_code-->
<!-- ) e on t.equip_id = e.id where t.equip_id != ''-->
<!-- </select>-->
<select id="queryTreeListOfAssetScreen" resultType="com.skua.modules.business.vo.TreeVO">
select id,'0' as parent_id,struct_name as title,'0' as nodeType,struct_code as code,sort_num as sno from sys_struct_dict
union all
select t.equip_id as id,e.struct_id as parent_id,e.equip_name as title,'1' as nodeType,e.equip_unit as code,'1' as sno from fm_twin_equip t
left join (
select ee.id,ee.equip_name,ee.equip_unit,sd.id as struct_id from sys_equip_info ee
left join sys_struct_dict sd on ee.equip_unit = sd.struct_code
) e on t.equip_id = e.id where t.equip_id != ''
( SELECT
DISTINCT ss.struct_id AS id,
'0' AS parent_id,
ss.struct_name AS title,
'0' AS nodeType,
ss.struct_code AS code,
ss.sort_num AS sno
FROM
fm_twin_equip fe
LEFT JOIN (
SELECT
DISTINCT sd.id AS struct_id,
sd.struct_code,
sd.struct_name,
sd.sort_num,
si.id AS equip_info_id
FROM
sys_equip_info si
LEFT JOIN sys_struct_dict sd ON si.equip_unit = sd.struct_code
WHERE
si.project_id = #{projectId}
) ss ON fe.equip_id = ss.equip_info_id
WHERE fe.project_id = #{projectId}
<if test="equipName!=null and equipName!=''">
AND fe.equip_name LIKE CONCAT(CONCAT('%', #{equipName}),'%')
</if>)
UNION ALL
( SELECT
t.equip_id AS id,
e.struct_id AS parent_id,
e.equip_name AS title,
'1' AS nodeType,
e.equip_unit AS code,
'1' AS sno
FROM
fm_twin_equip t
LEFT JOIN (
SELECT
ee.id,
ee.equip_name,
ee.equip_unit,
sd.id AS struct_id
FROM
sys_equip_info ee
LEFT JOIN sys_struct_dict sd ON ee.equip_unit = sd.struct_code
) e ON t.equip_id = e.id
WHERE t.equip_id != ''
AND t.project_id = #{projectId}
<if test="equipName!=null and equipName!=''">
AND t.equip_name LIKE CONCAT(CONCAT('%', #{equipName}),'%')
</if>
)
</select>
</mapper>
\ No newline at end of file
......
......@@ -29,8 +29,9 @@ public interface IAssetsService {
/**
* 设备树
* @param name
* @param projectId
* @param equipName
* @return
*/
List<TreeVO> queryTreeListOfAssetScreen(String name);
List<TreeVO> queryTreeListOfAssetScreen(String projectId,String equipName);
}
......
......@@ -78,13 +78,14 @@ public class AssetsServiceImpl implements IAssetsService {
/**
* 设备树
* @param name
* @param projectId
* @param equipName
* @return
*/
@Override
public List<TreeVO> queryTreeListOfAssetScreen(String name) {
public List<TreeVO> queryTreeListOfAssetScreen(String projectId,String equipName) {
List<TreeVO> list = new ArrayList<>();
list = assetsMapper.queryTreeListOfAssetScreen(name);
list = assetsMapper.queryTreeListOfAssetScreen(projectId,equipName);
return list;
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!