From 6f873100decc93c30ca65504888382d2f2a466b2 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Wed, 04 Jul 2018 13:31:49 +0800
Subject: [PATCH] 优化
---
src/main/resources/mapper/DeviceVersionMapper.xml | 40 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/src/main/resources/mapper/DeviceVersionMapper.xml b/src/main/resources/mapper/DeviceVersionMapper.xml
index ef1aac2..b8d7606 100644
--- a/src/main/resources/mapper/DeviceVersionMapper.xml
+++ b/src/main/resources/mapper/DeviceVersionMapper.xml
@@ -8,4 +8,44 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="description" jdbcType="VARCHAR" property="description" />
</resultMap>
+ <select id="selectListByOrgId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+ SELECT
+ *
+ FROM
+ device_version dvn
+ WHERE
+ dvn.id IN (
+ SELECT DISTINCT
+ dev.device_version_id
+ FROM
+ device dev
+ WHERE
+ dev.monitor_point_id IN
+ (
+ SELECT id FROM monitor_point mpt
+ WHERE mpt.organization_id = #{orgId,jdbcType=INTEGER}
+ or EXISTS (
+ SELECT * from dictionary_data where dict_data_key = 'auth_config_super_org' and dict_data_value = #{orgId,jdbcType=INTEGER}
+ )
+
+ )
+ )
+ order by dvn.create_time desc
+ </select>
+ <select id="selectListByMpointId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+ SELECT
+ *
+ FROM
+ device_version dvn
+ WHERE
+ dvn.id IN (
+ SELECT DISTINCT
+ dev.device_version_id
+ FROM
+ device dev
+ WHERE
+ dev.monitor_point_id = #{mpointId,jdbcType=VARCHAR}
+ )
+ order by dvn.create_time desc
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0