Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张雷
/
fmboot
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
d6f438fb
由
张雷
编写于
2023-02-07 15:42:00 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
资产接口增加项目ID
1 个父辈
d65d0afa
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
73 行增加
和
16 行删除
fm-product/src/main/java/com/skua/modules/business/controller/AssetsController.java
fm-product/src/main/java/com/skua/modules/business/mapper/AssetsMapper.java
fm-product/src/main/java/com/skua/modules/business/mapper/xml/AssetsMapper.xml
fm-product/src/main/java/com/skua/modules/business/service/IAssetsService.java
fm-product/src/main/java/com/skua/modules/business/service/impl/AssetsServiceImpl.java
fm-product/src/main/java/com/skua/modules/business/controller/AssetsController.java
查看文件 @
d6f438f
...
...
@@ -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"
);
...
...
fm-product/src/main/java/com/skua/modules/business/mapper/AssetsMapper.java
查看文件 @
d6f438f
...
...
@@ -46,8 +46,9 @@ public interface AssetsMapper {
/**
* 设备树
* @param name
* @param projectId
* @param equipName
* @return
*/
List
<
TreeVO
>
queryTreeListOfAssetScreen
(
String
n
ame
);
List
<
TreeVO
>
queryTreeListOfAssetScreen
(
@Param
(
"projectId"
)
String
projectId
,
@Param
(
"equipName"
)
String
equipN
ame
);
}
...
...
fm-product/src/main/java/com/skua/modules/business/mapper/xml/AssetsMapper.xml
查看文件 @
d6f438f
...
...
@@ -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
...
...
fm-product/src/main/java/com/skua/modules/business/service/IAssetsService.java
查看文件 @
d6f438f
...
...
@@ -29,8 +29,9 @@ public interface IAssetsService {
/**
* 设备树
* @param name
* @param projectId
* @param equipName
* @return
*/
List
<
TreeVO
>
queryTreeListOfAssetScreen
(
String
n
ame
);
List
<
TreeVO
>
queryTreeListOfAssetScreen
(
String
projectId
,
String
equipN
ame
);
}
...
...
fm-product/src/main/java/com/skua/modules/business/service/impl/AssetsServiceImpl.java
查看文件 @
d6f438f
...
...
@@ -78,13 +78,14 @@ public class AssetsServiceImpl implements IAssetsService {
/**
* 设备树
* @param name
* @param projectId
* @param equipName
* @return
*/
@Override
public
List
<
TreeVO
>
queryTreeListOfAssetScreen
(
String
n
ame
)
{
public
List
<
TreeVO
>
queryTreeListOfAssetScreen
(
String
projectId
,
String
equipN
ame
)
{
List
<
TreeVO
>
list
=
new
ArrayList
<>();
list
=
assetsMapper
.
queryTreeListOfAssetScreen
(
n
ame
);
list
=
assetsMapper
.
queryTreeListOfAssetScreen
(
projectId
,
equipN
ame
);
return
list
;
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论