From 5fa78e073c5c6269997e7d03b56176b157c7a327 Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Wed, 16 May 2018 16:21:30 +0800
Subject: [PATCH] 设备删除,更新redis
---
src/main/resources/mapper/DeviceMapper.xml | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/src/main/resources/mapper/DeviceMapper.xml b/src/main/resources/mapper/DeviceMapper.xml
index 795e325..2808a19 100644
--- a/src/main/resources/mapper/DeviceMapper.xml
+++ b/src/main/resources/mapper/DeviceMapper.xml
@@ -177,6 +177,7 @@
<if test="devName!=null and ''!=devName">
and dev.name like CONCAT('%',#{devName},'%')
</if>
+ and dev.is_delete = 0
</where>
</select>
<select id="selectByOrgIdAndMpId" resultMap="BaseResultMap">
@@ -188,6 +189,7 @@
mpt.organization_id = #{orgId}
</if>
and dev.monitor_point_id = #{mpId}
+ and dev.is_delete = 0
</where>
</select>
<select id="selectByMap" parameterType="java.util.Map" resultMap="BaseResultMap">
@@ -204,6 +206,7 @@
AND dev.latitude < #{mapBounds.Fe,jdbcType=NUMERIC}
AND dev.latitude > #{mapBounds.Ke,jdbcType=NUMERIC}
]]>
+ AND dev.is_delete =0
</where>
</select>
<resultMap id="BaseResultWithOrgIdsMap" type="com.moral.entity.Device" extends="BaseResultMap">
@@ -222,6 +225,7 @@
left join monitor_point mpt on dev.monitor_point_id = mpt.id
left join profession pro on pro.id = dev.profession_id
where dev.mac = #{mac,jdbcType=VARCHAR}
+ limit 0,1
</select>
<select id="getDeviceCountByRegion" resultType="java.lang.Integer">
@@ -248,5 +252,37 @@
AND mp.area_code = #{areaCode}
</if>
)
+ <if test="professionId != null">
+ AND d.profession_id = #{professionId}
+ </if>
+ </select>
+
+ <select id="getDevicesByProfession" resultType="com.moral.entity.Device">
+ SELECT
+ *
+ FROM
+ device d
+ WHERE
+ d.is_delete = 0
+ AND d.monitor_point_id IN (
+ SELECT
+ mp.id
+ FROM
+ monitor_point mp
+ WHERE
+ mp.is_delete = 0
+ <if test="provinceCode != null">
+ AND mp.province_code = #{provinceCode}
+ </if>
+ <if test="cityCode != null">
+ AND mp.city_code = #{cityCode}
+ </if>
+ <if test="areaCode != null">
+ AND mp.area_code = #{areaCode}
+ </if>
+ )
+ <if test="professionId != null">
+ AND d.profession_id = #{professionId}
+ </if>
</select>
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0