From 2c270281a0d44d02a7a2f1a9a52bd72a054e8317 Mon Sep 17 00:00:00 2001 From: xufenglei <xufenglei> Date: Thu, 02 Nov 2017 14:50:37 +0800 Subject: [PATCH] 处理 小数 --- src/main/resources/mapper/HistoryEntityMapper.xml | 48 ++++++++++++------------------------------------ 1 files changed, 12 insertions(+), 36 deletions(-) diff --git a/src/main/resources/mapper/HistoryEntityMapper.xml b/src/main/resources/mapper/HistoryEntityMapper.xml index 21e40f4..ea7322f 100644 --- a/src/main/resources/mapper/HistoryEntityMapper.xml +++ b/src/main/resources/mapper/HistoryEntityMapper.xml @@ -238,7 +238,6 @@ </select> <select id="getAverageByAll" resultType="map"> -<!-- SELECT h.mac_key, AVG(h.mac_value) avg @@ -246,47 +245,21 @@ history h, monitorpoint m, equipment e - <if test="orgIds != null and orgIds.size > 0"> - JOIN org_equ oe ON e.id = oe.equid - AND oe.orgid IN - <foreach collection="orgIds" item="listItem" open="(" separator="," close=")" > - #{listItem} - </foreach> - </if> WHERE m.areacode = #{areaCode} AND m.id = e.monitorpoint AND e.mac = h.mac AND h.time > #{start} AND h.time < #{end} + <if test="orgIds != null and orgIds.size > 0"> + <!-- JOIN org_equ oe ON e.id = oe.equid --> + AND e.owner_id IN + <foreach collection="orgIds" item="listItem" open="(" separator="," close=")" > + #{listItem} + </foreach> + </if> GROUP BY h.mac_key - --> - - SELECT - mac_key, - AVG(mac_value) avg - FROM - history h - <if test="orgIds!=null and orgIds.size > 0"> - JOIN ( - SELECT - e.mac - FROM - equipment e, - org_equ oe - WHERE - e.id = oe.equid - AND oe.orgid IN - <foreach collection="orgIds" item="listItem" open="(" separator="," close=")" > - #{listItem} - </foreach> - ) e ON h.mac = e.mac - </if> - WHERE h.time > #{start} - AND h.time < #{end} - GROUP BY - mac_key </select> <select id="getEquipmentStates" resultType="map"> @@ -296,8 +269,8 @@ FROM equipment <if test="orgIds != null and orgIds.size > 0"> - JOIN org_equ oe ON e.id = oe.equid - AND oe.orgid IN + <!-- JOIN org_equ oe ON e.id = oe.equid --> + where owner_id IN <foreach collection="orgIds" item="listItem" open="(" separator="," close=")" > #{listItem} </foreach> @@ -306,4 +279,7 @@ state </select> + <select id="getMacLogByLast" resultType="string"> + SELECT mac_log FROM logger ORDER BY time DESC LIMIT 1 + </select> </mapper> \ No newline at end of file -- Gitblit v1.8.0