| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.yssh.mapper.QxshMapper"> |
| | | <!-- where name = #{name} and Cast(time as signed) between ${start} and ${end} --> |
| | | <select id="getNewMonitorData" resultType="com.yssh.entity.SuYuanMonitorData"> |
| | | select id, format(value, 2) "value", time |
| | | from yssh_qxsh |
| | | where name = #{name} and time between '${start}' and '${end}' |
| | | order by time desc; |
| | | </select> |
| | | |
| | | <select id="selectByTime" resultType="com.yssh.entity.Qxsh"> |
| | | select id, name, lon, lat, format(value, 2) "value", time |
| | | from yssh_qxsh |
| | | from yssh_gcsj |
| | | where time = #{time} |
| | | order by name; |
| | | </select> |
| | |
| | | <select id="selectMonthTop10" resultType="com.yssh.entity.Qxsh"> |
| | | with rs as ( |
| | | select id, name, lon, lat, format(value, 2) "value", time |
| | | from yssh_qxsh |
| | | from yssh_gcsj |
| | | where time like #{time} and name like 'AI-%' |
| | | ) |
| | | select id, name, lon, lat, value, time from rs |
| | |
| | | limit 10; |
| | | </select> |
| | | |
| | | <select id="selectWeekTop10" resultType="com.yssh.entity.Qxsh"> |
| | | with rs as ( |
| | | select id, name, lon, lat, format(value, 2) "value", time |
| | | from yssh_gcsj |
| | | where time between '${start}' and '${end}' and name like 'AI-%' |
| | | ) |
| | | select id, name, lon, lat, value, time from rs |
| | | order by value desc |
| | | limit 10; |
| | | </select> |
| | | |
| | | <select id="selectDayTop10" resultType="com.yssh.entity.Qxsh"> |
| | | with rs as ( |
| | | select id, name, lon, lat, format(value, 2) "value", time |
| | | from yssh_gcsj |
| | | where time like #{time} and name like 'AI-%' |
| | | ) |
| | | select id, name, lon, lat, value, time from rs |
| | | order by value desc |
| | | limit 10; |
| | | </select> |
| | | |
| | | <select id="selectWarnByBeginAndEnd" resultType="com.yssh.entity.Qxsh"> |
| | | select id, name, lon, lat, format(value, 2) "value", time |
| | | from yssh_gcsj |
| | | where time between '${start}' and '${end}' and name like 'AI-%' |
| | | and value > (select jcyj from alert_config limit 1) and value <= (select jcbj from alert_config limit 1) |
| | | order by time desc, name; |
| | | </select> |
| | | |
| | | <select id="selectAlarmByBeginAndEnd" resultType="com.yssh.entity.Qxsh"> |
| | | select id, name, lon, lat, format(value, 2) "value", time |
| | | from yssh_gcsj |
| | | where time between '${start}' and '${end}' and name like 'AI-%' |
| | | and value > (select jcbj from alert_config limit 1) |
| | | order by time desc, name; |
| | | </select> |
| | | |
| | | <select id="countMonthForWarn" resultType="java.lang.Integer"> |
| | | with rs as (select jcyj, jcbj from alert_config limit 1) |
| | | select count(id) |
| | | from yssh_gcsj |
| | | where time between '${start}' and '${end}' and name like 'AI-%' |
| | | and value > (select jcyj from rs) and value <= (select jcbj from rs); |
| | | </select> |
| | | |
| | | <select id="countMonthForAlarm" resultType="java.lang.Integer"> |
| | | select count(id) |
| | | from yssh_gcsj |
| | | where time between '${start}' and '${end}' and name like 'AI-%' |
| | | and value > (select jcbj from alert_config limit 1); |
| | | </select> |
| | | |
| | | <select id="count7DayForWarn" resultType="java.util.Map"> |
| | | with rs as ( |
| | | select left(time, 8) "createTime" |
| | | from yssh_qxsh |
| | | where time between #{start} and #{end} and name like 'AI-%' |
| | | from yssh_gcsj |
| | | where time between '${start}' and '${end}' and name like 'AI-%' |
| | | and value > (select jcyj from alert_config limit 1) and value <= (select jcbj from alert_config limit 1) |
| | | ) |
| | | select createTime, count(*) "num" from rs group by createTime order by createTime; |
| | |
| | | <select id="count7DayForAlarm" resultType="java.util.Map"> |
| | | with rs as ( |
| | | select left(time, 8) "createTime" |
| | | from yssh_qxsh |
| | | where time between #{start} and #{end} and name like 'AI-%' and value > (select jcbj from alert_config limit 1) |
| | | from yssh_gcsj |
| | | where time between '${start}' and '${end}' and name like 'AI-%' |
| | | and value > (select jcbj from alert_config limit 1) |
| | | ) |
| | | select createTime, count(*) "num" from rs group by createTime order by createTime; |
| | | </select> |
| | | |
| | | <select id="selectByBeginAndEnd" resultType="com.yssh.entity.Qxsh"> |
| | | <select id="countFastSuYuan" resultType="java.lang.Integer"> |
| | | select count(id) from suyuan_fast |
| | | where su_yuan_id = #{id} and create_time = #{time}; |
| | | </select> |
| | | |
| | | <select id="hasSuYuan" resultType="java.lang.Integer"> |
| | | select count(id) from suyuan_46 where su_yuan_id=#{suYuanId} and create_time=#{createTime}; |
| | | </select> |
| | | |
| | | <select id="select3Hours" resultType="com.yssh.entity.Qxsh"> |
| | | select id, name, lon, lat, format(value, 2) "value", time |
| | | from yssh_qxsh |
| | | where time between #{start} and #{end} |
| | | from yssh_gcsj |
| | | where time between '${start}' and '${end}' |
| | | and value > (select jcyj from alert_config limit 1) and name like 'AI-%' |
| | | order by time, name; |
| | | </select> |
| | | |
| | | <select id="selectForReport" resultType="com.yssh.entity.Qxsh"> |
| | | select id, name, format(value, 2) "value", time |
| | | from yssh_qxsh |
| | | where time between #{start} and #{end} |
| | | from yssh_gcsj |
| | | where time between '${start}' and '${end}' |
| | | and value > (select jcbj from alert_config limit 1) and name like 'AI-%' |
| | | order by time, name; |
| | | </select> |
| | | |
| | | <select id="selectLastYearVal" resultType="java.lang.Double"> |
| | | select format(value, 2) "value" |
| | | from yssh_qxsh |
| | | where time = #{time} and name = #{name} |
| | | from yssh_gcsj |
| | | where time = '${time}' and name = #{name} |
| | | limit 1; |
| | | </select> |
| | | |
| | | <select id="selectByTimeAndName" resultType="com.yssh.entity.Qxsh"> |
| | | select id, name, lon, lat, format(value, 2) "value", time |
| | | from yssh_qxsh |
| | | where time = #{time} and name = #{name} |
| | | from yssh_gcsj |
| | | where time = '${time}' and name = #{name} |
| | | limit 1; |
| | | </select> |
| | | |
| | | <select id="countGcsjByTime" resultType="java.lang.Integer"> |
| | | select count(id) from yssh_gcsj where time between '${start}' and '${end}'; |
| | | </select> |
| | | |
| | | <select id="countQxshByTime" resultType="java.lang.Integer"> |
| | | select count(id) from yssh_qxsh where time between #{start} and #{end}; |
| | | </select> |
| | | |
| | | <select id="countSuYuan46ByTime" resultType="java.lang.Integer"> |
| | | select count(id) from suyuan_46 where create_time between #{start} and #{end}; |
| | | </select> |
| | | |
| | | <select id="countSuYuan70ByTime" resultType="java.lang.Integer"> |
| | | select count(id) from suyuan_70_70 where create_time between #{start} and #{end}; |
| | | </select> |
| | | |
| | | <select id="countSuYuanFastByTime" resultType="java.lang.Integer"> |
| | | select count(id) from suyuan_fast where create_time between #{start} and #{end}; |
| | | </select> |
| | | </mapper> |