From 73f40e24c8900d8d7616b44515c965ce0ef20763 Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Sat, 09 Oct 2021 16:01:26 +0800
Subject: [PATCH] 设备修改bug修复

---
 screen-manage/src/main/resources/mapper/SpecialDeviceMapper.xml |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/screen-manage/src/main/resources/mapper/SpecialDeviceMapper.xml b/screen-manage/src/main/resources/mapper/SpecialDeviceMapper.xml
index db8b4e6..f4d754f 100644
--- a/screen-manage/src/main/resources/mapper/SpecialDeviceMapper.xml
+++ b/screen-manage/src/main/resources/mapper/SpecialDeviceMapper.xml
@@ -7,6 +7,7 @@
                     <id column="id" property="id" />
                     <result column="name" property="name" />
                     <result column="mac" property="mac" />
+                    <result column="guid" property="guid" />
                     <result column="operate_ids" property="operateIds" />
                     <result column="organization_id" property="organizationId" />
                     <result column="device_version_id" property="deviceVersionId" />
@@ -16,4 +17,58 @@
                     <result column="is_delete" property="isDelete" />
         </resultMap>
 
+    <resultMap id="querySpecialDeviceUnitAlarmInfoMap" type="com.moral.api.entity.SpecialDevice">
+        <id column="d.id" property="id"/>
+        <result column="d.name" property="name"/>
+        <result column="d.mac" property="mac"/>
+        <result column="d.operate_ids" property="operateIds"/>
+        <result column="d.monitor_point_id" property="monitorPointId"/>
+        <result column="d.organization_id" property="organizationId"/>
+        <result column="oua.version_id" property="deviceVersionId"/>
+        <association property="version" column="d.device_version_id" javaType="com.moral.api.entity.Version">
+            <id column="v.id" property="id"></id>
+            <result column="v.name" property="name"></result>
+            <collection column="d.device_version_id" property="sensors" ofType="com.moral.api.entity.Sensor">
+                <result column="oua.sensor_code" property="code" ></result>
+                <result column="oua.unit_key" property="unitKey"></result>
+                <result column="oua.show_unit_key" property="showUnitKey"></result>
+                <result column="oua.alarm_level" property="alarmLevel" javaType="String" ></result>
+            </collection>
+        </association>
+    </resultMap>
+
+    <select id="querySpecialDeviceUnitAlarmInfo" resultMap="querySpecialDeviceUnitAlarmInfoMap">
+        select
+            d.id as `d.id`,
+            d.mac as `d.mac`,
+            d.name as `d.name`,
+            d.operate_ids as `d.operate_ids`,
+            d.organization_id as `d.organization_id`,
+            oua.version_id as `oua.version_id`,
+            oua.sensor_code as `oua.sensor_code`,
+            oua.unit_key as `oua.unit_key`,
+            oua.show_unit_key as `oua.show_unit_key`,
+            oua.alarm_level as `oua.alarm_level`,
+            v.id as `v.id`,
+            v.name as `v.name`
+        from
+            special_device d
+        join
+            version v
+        on
+            v.`id` = d.`device_version_id` and v.`is_delete` = 0
+        join
+            organization_unit_alarm oua
+        on
+            d.`device_version_id` = oua.`version_id`   and d.`organization_id` = oua.`organization_id` and oua.`is_delete` = 0
+        where
+            d.`is_delete` = 0;
+    </select>
+
+    <select id="selectOrgByMac" resultType="com.moral.api.entity.Organization">
+        SELECT area_code, city_code
+        FROM organization
+        WHERE id = (SELECT organization_id FROM special_device WHERE mac = #{mac})
+    </select>
+
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0