From b1fa059e522e1fc608f6c7596b445ba3b58ae012 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Mon, 07 May 2018 13:50:41 +0800 Subject: [PATCH] 地图相关资源 --- src/main/resources/mapper/AlarmMapper.xml | 28 ++++++++++++++++++++++++---- 1 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/main/resources/mapper/AlarmMapper.xml b/src/main/resources/mapper/AlarmMapper.xml index 29576fc..b3baecf 100644 --- a/src/main/resources/mapper/AlarmMapper.xml +++ b/src/main/resources/mapper/AlarmMapper.xml @@ -32,11 +32,11 @@ </foreach> </when> <otherwise> - DATE_FORMAT( h.time, '%Y-%m-%d' ) AS 'time' + h.time </otherwise> </choose> FROM - alarm h, + alarm_daily h, device d, monitor_point mp WHERE d.monitor_point_id = mp.id @@ -68,12 +68,32 @@ <if test="dimension=='monitorPoint'"> mp.id, </if> - DATE_FORMAT( h.time, '%Y-%m-%d' ) + h.time ) a <if test="dimension=='monitorPoint'"> GROUP BY name </if> </select> - + <select id="countByTimes" resultType="java.util.Map"> + select + <if test="format !=null"> + DATE_FORMAT(time,#{format}) as time, + </if> + COUNT(*) as count from alarm + <where> + <if test="start != null"> + time >= #{start} + </if> + <if test="end != null"> + and time + <![CDATA[ + <= + ]]> #{end} + </if> + </where> + <if test="format !=null"> + GROUP BY DATE_FORMAT(time,#{format}) ; + </if> + </select> </mapper> \ No newline at end of file -- Gitblit v1.8.0