|
@@ -171,7 +171,7 @@
|
|
|
GROUP BY it.id, it.item_text, it.sort
|
|
|
order by it.sort asc
|
|
|
</select>
|
|
|
- <select id="getNxDeviceScreen" resultType="org.thingsboard.server.domain.NxDeviceScreenDto">
|
|
|
+ <select id="getNxDeviceScreen" resultMap="DeviceScreenMap">
|
|
|
SELECT w.id,
|
|
|
w.device_name,
|
|
|
w.longitude,
|
|
@@ -182,16 +182,61 @@
|
|
|
when status = '0' then '离线'
|
|
|
when status = '1' then '在线'
|
|
|
when status = '2' then '报警' end as statusName,
|
|
|
- ms.industry,ms.address
|
|
|
+ ms.industry,ms.address,
|
|
|
+ mi.code,mi.name,mi.unit,mi.index_group
|
|
|
from nx_device_w w left JOIN nx_device_type dt on w.type_id=dt.id and dt.is_deleted='0'
|
|
|
left join nx_monitor_site_device sd on w.id = sd.device_id and sd.is_deleted = '0'
|
|
|
- LEFT JOIN
|
|
|
- nx_monitor_site ms on sd.site_id = ms.id where 1=1
|
|
|
+ LEFT JOIN nx_monitor_site ms on sd.site_id = ms.id
|
|
|
+ left join nx_monitor_index mi on w.id = mi.device_id
|
|
|
+ where 1=1 and w.is_deleted = '0'
|
|
|
<if test="query.industry!=null and query.industry!=''">
|
|
|
and ms.industry=#{query.industry}
|
|
|
</if>
|
|
|
+ <choose>
|
|
|
+ <when test="query.status == '0'">
|
|
|
+ and w.status=#{query.status}
|
|
|
+ </when>
|
|
|
+ <when test="query.status == '1'">
|
|
|
+ and w.status in ('1', '2')
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
</select>
|
|
|
|
|
|
+ <resultMap id="DeviceScreenMap" type="org.thingsboard.server.domain.NxDeviceScreenDto">
|
|
|
+ <result column="id" property="id"/>
|
|
|
+ <result column="device_name" property="deviceName"/>
|
|
|
+ <result column="longitude" property="longitude"/>
|
|
|
+ <result column="latitude" property="latitude"/>
|
|
|
+ <result column="type_id" property="typeId"/>
|
|
|
+ <result column="type_name" property="typeName"/>
|
|
|
+ <result column="statusName" property="statusName"/>
|
|
|
+ <result column="industry" property="industry"/>
|
|
|
+ <result column="address" property="address"/>
|
|
|
+ <collection property="indexDto" ofType="org.thingsboard.server.domain.IndexDto">
|
|
|
+ <result column="code" property="code"/>
|
|
|
+ <result column="name" property="name"/>
|
|
|
+ <result column="unit" property="unit"/>
|
|
|
+ <result column="index_group" property="indexGroup"/>
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="listByExport" resultType="org.thingsboard.server.domain.export.NxDeviceWExport">
|
|
|
+ select dw.device_name,dw.no,dt.type_name,di.item_text category_name,dw.model,
|
|
|
+ case
|
|
|
+ when dw.status = '0' then '离线'
|
|
|
+ when dw.status = '1' then '在线'
|
|
|
+ when dw.status = '2' then '报警' end as status_name,
|
|
|
+ di2.item_text monitor_type_name,di3.item_text belong_pumpid_name
|
|
|
+ from nx_device_w dw
|
|
|
+ left join sys_dict_item di on dw.category = di.id
|
|
|
+ left join sys_dict_item di2 on dw.monitor_type = di2.id
|
|
|
+ left join sys_dict_item di3 on dw.belong_pumpid = di3.id
|
|
|
+ left join nx_device_type dt on dw.type_id = dt.id
|
|
|
+ WHERE dw.is_deleted = '0'
|
|
|
+ <if test="status != null and status != ''">
|
|
|
+ and dw.status = #{status}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
|
|
|
</mapper>
|
|
|
|