From 7234d03b3c51794c99c6bee8a617f9927898bd3f Mon Sep 17 00:00:00 2001
From: 沈斌 <bluelazysb@hotmail.com>
Date: Fri, 04 May 2018 16:33:43 +0800
Subject: [PATCH] 运维app
---
src/main/resources/mapper/DeviceMapper.xml | 40 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 39 insertions(+), 1 deletions(-)
diff --git a/src/main/resources/mapper/DeviceMapper.xml b/src/main/resources/mapper/DeviceMapper.xml
index 846ad57..c7924aa 100644
--- a/src/main/resources/mapper/DeviceMapper.xml
+++ b/src/main/resources/mapper/DeviceMapper.xml
@@ -62,6 +62,18 @@
id, name, address, longitude, latitude, mac, operate_user_id, state, is_delete, create_time,
install_time, monitor_point_id, device_version_id
</sql>
+ <select id="countByTimes" resultType="java.util.Map">
+ select DATE_FORMAT(create_time,#{format}) as time, COUNT(*) as count from device
+ where create_time >= #{start}
+ and create_time
+ <![CDATA[
+ <=
+ ]]> #{end}
+ and is_delete <![CDATA[
+ <>
+ ]]> 1
+ GROUP BY DATE_FORMAT(create_time,#{format}) ;
+ </select>
<select id="selectWithRelationData" parameterType="tk.mybatis.mapper.entity.Example" resultMap="BaseResultMap">
select
dev.*,
@@ -193,7 +205,7 @@
<collection property="organizationIds" column="id" select="selectOrganizationIds"></collection>
</resultMap>
<!-- resultMap������ -->
- <select id="selectOrganizationIds" resultType="INTEGER">
+ <select id="selectOrganizationIds" resultType="java.lang.Integer">
call proc_organizationIds_GetByDeviceId(#{id,jdbcType=INTEGER});
</select>
<select id="selectWithOrgIdsByMac" parameterType="java.lang.String" resultMap="BaseResultWithOrgIdsMap">
@@ -202,4 +214,30 @@
from device
where mac = #{mac,jdbcType=VARCHAR}
</select>
+
+ <select id="getDeviceCountByRegion" resultType="java.lang.Integer">
+ SELECT
+ COUNT( * )
+ 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>
+ )
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0