资产接口增加项目ID
正在显示
5 个修改的文件
包含
73 行增加
和
16 行删除
... | @@ -71,8 +71,8 @@ public class AssetsController { | ... | @@ -71,8 +71,8 @@ public class AssetsController { |
71 | 71 | ||
72 | @GetMapping("/queryTreeList") | 72 | @GetMapping("/queryTreeList") |
73 | @ApiOperation(value="设备树结构数据", notes="设备树结构数据") | 73 | @ApiOperation(value="设备树结构数据", notes="设备树结构数据") |
74 | public Result<List<EquipmentTreeVO>> queryTreeList(String name){ | 74 | public Result<List<EquipmentTreeVO>> queryTreeList(String projectId,String name){ |
75 | List<TreeVO> treeVOList = assetsService.queryTreeListOfAssetScreen(name); | 75 | List<TreeVO> treeVOList = assetsService.queryTreeListOfAssetScreen(projectId,name); |
76 | //将业务数据转换为构造树所需的数据结构 | 76 | //将业务数据转换为构造树所需的数据结构 |
77 | List<TransTreeModel> transTreeModels = treeVOList.stream().map(bo -> convertToTreeModel(bo)).collect(Collectors.toList()); | 77 | List<TransTreeModel> transTreeModels = treeVOList.stream().map(bo -> convertToTreeModel(bo)).collect(Collectors.toList()); |
78 | List<TreeData> treeList = TreeUtils.buildTreeByRootId(transTreeModels, "0"); | 78 | List<TreeData> treeList = TreeUtils.buildTreeByRootId(transTreeModels, "0"); | ... | ... |
... | @@ -46,8 +46,9 @@ public interface AssetsMapper { | ... | @@ -46,8 +46,9 @@ public interface AssetsMapper { |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * 设备树 | 48 | * 设备树 |
49 | * @param name | 49 | * @param projectId |
50 | * @param equipName | ||
50 | * @return | 51 | * @return |
51 | */ | 52 | */ |
52 | List<TreeVO> queryTreeListOfAssetScreen(String name); | 53 | List<TreeVO> queryTreeListOfAssetScreen(@Param("projectId") String projectId,@Param("equipName") String equipName); |
53 | } | 54 | } | ... | ... |
... | @@ -28,14 +28,68 @@ | ... | @@ -28,14 +28,68 @@ |
28 | )t order by `count` desc | 28 | )t order by `count` desc |
29 | </select> | 29 | </select> |
30 | 30 | ||
31 | <!-- <select id="queryTreeListOfAssetScreen" resultType="com.skua.modules.business.vo.TreeVO">--> | ||
32 | <!-- 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--> | ||
33 | <!-- union all--> | ||
34 | <!-- 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--> | ||
35 | <!-- left join (--> | ||
36 | <!-- select ee.id,ee.equip_name,ee.equip_unit,sd.id as struct_id from sys_equip_info ee--> | ||
37 | <!-- left join sys_struct_dict sd on ee.equip_unit = sd.struct_code--> | ||
38 | <!-- ) e on t.equip_id = e.id where t.equip_id != ''--> | ||
39 | <!-- </select>--> | ||
31 | <select id="queryTreeListOfAssetScreen" resultType="com.skua.modules.business.vo.TreeVO"> | 40 | <select id="queryTreeListOfAssetScreen" resultType="com.skua.modules.business.vo.TreeVO"> |
32 | 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 | 41 | ( SELECT |
33 | union all | 42 | DISTINCT ss.struct_id AS id, |
34 | 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 | 43 | '0' AS parent_id, |
35 | left join ( | 44 | ss.struct_name AS title, |
36 | select ee.id,ee.equip_name,ee.equip_unit,sd.id as struct_id from sys_equip_info ee | 45 | '0' AS nodeType, |
37 | left join sys_struct_dict sd on ee.equip_unit = sd.struct_code | 46 | ss.struct_code AS code, |
38 | ) e on t.equip_id = e.id where t.equip_id != '' | 47 | ss.sort_num AS sno |
48 | FROM | ||
49 | fm_twin_equip fe | ||
50 | LEFT JOIN ( | ||
51 | SELECT | ||
52 | DISTINCT sd.id AS struct_id, | ||
53 | sd.struct_code, | ||
54 | sd.struct_name, | ||
55 | sd.sort_num, | ||
56 | si.id AS equip_info_id | ||
57 | FROM | ||
58 | sys_equip_info si | ||
59 | LEFT JOIN sys_struct_dict sd ON si.equip_unit = sd.struct_code | ||
60 | WHERE | ||
61 | si.project_id = #{projectId} | ||
62 | ) ss ON fe.equip_id = ss.equip_info_id | ||
63 | WHERE fe.project_id = #{projectId} | ||
64 | <if test="equipName!=null and equipName!=''"> | ||
65 | AND fe.equip_name LIKE CONCAT(CONCAT('%', #{equipName}),'%') | ||
66 | </if>) | ||
67 | UNION ALL | ||
68 | ( SELECT | ||
69 | t.equip_id AS id, | ||
70 | e.struct_id AS parent_id, | ||
71 | e.equip_name AS title, | ||
72 | '1' AS nodeType, | ||
73 | e.equip_unit AS code, | ||
74 | '1' AS sno | ||
75 | FROM | ||
76 | fm_twin_equip t | ||
77 | LEFT JOIN ( | ||
78 | SELECT | ||
79 | ee.id, | ||
80 | ee.equip_name, | ||
81 | ee.equip_unit, | ||
82 | sd.id AS struct_id | ||
83 | FROM | ||
84 | sys_equip_info ee | ||
85 | LEFT JOIN sys_struct_dict sd ON ee.equip_unit = sd.struct_code | ||
86 | ) e ON t.equip_id = e.id | ||
87 | WHERE t.equip_id != '' | ||
88 | AND t.project_id = #{projectId} | ||
89 | <if test="equipName!=null and equipName!=''"> | ||
90 | AND t.equip_name LIKE CONCAT(CONCAT('%', #{equipName}),'%') | ||
91 | </if> | ||
92 | ) | ||
39 | </select> | 93 | </select> |
40 | 94 | ||
41 | </mapper> | 95 | </mapper> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -29,8 +29,9 @@ public interface IAssetsService { | ... | @@ -29,8 +29,9 @@ public interface IAssetsService { |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * 设备树 | 31 | * 设备树 |
32 | * @param name | 32 | * @param projectId |
33 | * @param equipName | ||
33 | * @return | 34 | * @return |
34 | */ | 35 | */ |
35 | List<TreeVO> queryTreeListOfAssetScreen(String name); | 36 | List<TreeVO> queryTreeListOfAssetScreen(String projectId,String equipName); |
36 | } | 37 | } | ... | ... |
... | @@ -78,13 +78,14 @@ public class AssetsServiceImpl implements IAssetsService { | ... | @@ -78,13 +78,14 @@ public class AssetsServiceImpl implements IAssetsService { |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * 设备树 | 80 | * 设备树 |
81 | * @param name | 81 | * @param projectId |
82 | * @param equipName | ||
82 | * @return | 83 | * @return |
83 | */ | 84 | */ |
84 | @Override | 85 | @Override |
85 | public List<TreeVO> queryTreeListOfAssetScreen(String name) { | 86 | public List<TreeVO> queryTreeListOfAssetScreen(String projectId,String equipName) { |
86 | List<TreeVO> list = new ArrayList<>(); | 87 | List<TreeVO> list = new ArrayList<>(); |
87 | list = assetsMapper.queryTreeListOfAssetScreen(name); | 88 | list = assetsMapper.queryTreeListOfAssetScreen(projectId,equipName); |
88 | return list; | 89 | return list; |
89 | } | 90 | } |
90 | } | 91 | } | ... | ... |
-
请 注册 或 登录 后发表评论