From 60163c2fb5098fc522f8e80b131128d2c9a33e42 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Fri, 26 Jan 2018 14:44:05 +0800 Subject: [PATCH] 组织配置 --- src/main/resources/mapper/MonitorPointMapper.xml | 36 +++++++++++++++++++++++++++++++++++- 1 files changed, 35 insertions(+), 1 deletions(-) diff --git a/src/main/resources/mapper/MonitorPointMapper.xml b/src/main/resources/mapper/MonitorPointMapper.xml index bf0a5ee..652012a 100644 --- a/src/main/resources/mapper/MonitorPointMapper.xml +++ b/src/main/resources/mapper/MonitorPointMapper.xml @@ -20,7 +20,7 @@ <result column="area_name" property="areaName" jdbcType="VARCHAR" /> </association> <association property="organization" javaType="com.moral.entity.Organization"> - <result column="organization_id" property="id" jdbcType="VARCHAR" /> + <result column="organization_id" property="id" jdbcType="INTEGER" /> <result column="organization_name" property="name" jdbcType="VARCHAR" /> </association> </resultMap> @@ -100,4 +100,38 @@ AND mp.city_code = c.city_code </if> </select> + <select id="selectWithStateByMap" parameterType="java.util.Map" resultMap="BaseResultMap"> + + SELECT mpt.*,MAX(dev.state) as state from monitor_point mpt + LEFT JOIN device dev on dev.monitor_point_id = mpt.id + <where> + <if test="@com.moral.common.bean.Constants@isNotSpecialOrgId(orgId)"> + mpt.organization_id = #{orgId,jdbcType=VARCHAR} + </if> + <![CDATA[ + AND mpt.longitude < #{mapBounds.Ge,jdbcType=NUMERIC} + AND mpt.longitude > #{mapBounds.Le,jdbcType=NUMERIC} + AND mpt.latitude < #{mapBounds.Fe,jdbcType=NUMERIC} + AND mpt.latitude > #{mapBounds.Ke,jdbcType=NUMERIC} + and state<4 + GROUP BY mpt.`id` + ]]> + </where> + UNION + SELECT mpt.*,MAX(dev.state) as state from monitor_point mpt + LEFT JOIN device dev on dev.monitor_point_id = mpt.id + <where> + <if test="@com.moral.common.bean.Constants@isNotSpecialOrgId(orgId)"> + mpt.organization_id = #{orgId,jdbcType=VARCHAR} + </if> + <![CDATA[ + AND mpt.longitude < #{mapBounds.Ge,jdbcType=NUMERIC} + AND mpt.longitude > #{mapBounds.Le,jdbcType=NUMERIC} + AND mpt.latitude < #{mapBounds.Fe,jdbcType=NUMERIC} + AND mpt.latitude > #{mapBounds.Ke,jdbcType=NUMERIC} + and state>3 + GROUP BY mpt.`id` + ]]> + </where> + </select> </mapper> \ No newline at end of file -- Gitblit v1.8.0