| | |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.yssh.dao.CommonMapper"> |
| | | |
| | | <select id="checkTableExistsWithSchema" resultType="java.lang.Integer"> |
| | | SELECT COUNT(1) FROM information_schema.tables WHERE |
| | | table_schema=#{tableSchema} AND table_name = #{tableName} |
| | |
| | | <select id="checkTableExistsWithShow" parameterType="String" resultType="java.util.Map"> |
| | | show tables like #{tableName} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | <result column="property" property="property" /> |
| | | </resultMap> |
| | | <select id="query" resultMap="EmissionResult"> |
| | | select |
| | | * |
| | | from emission |
| | | select id, name, lon, lat, format(value, 2) "value", time, property |
| | | from emission |
| | | <where> |
| | | <if test="name != null and name != ''"> |
| | | and name = #{name} |
| | |
| | | </select> |
| | | |
| | | <select id="getAll" resultMap="EmissionResult"> |
| | | select * from emission |
| | | select id, name, lon, lat, format(value, 2) "value", time, property |
| | | from emission |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.yssh.entity.Emission"> |
| | |
| | | |
| | | <select id="selectList" resultMap="ExpPointResult"> |
| | | SELECT * FROM exp_point |
| | | |
| | | </select> |
| | | |
| | | <select id="selectByExpSiteNumbers" parameterType="java.util.List" resultMap="ExpPointResult"> |
| | | SELECT * FROM exp_point |
| | | SELECT * |
| | | FROM exp_point |
| | | WHERE exp_site_number IN |
| | | <foreach collection="expSiteNumbers" item="expSiteNumber" open="(" separator="," close=")"> |
| | | #{expSiteNumber} |
| | |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.yssh.dao.FeedbackMapper"> |
| | | |
| | | <resultMap id="FeedbackDetailResult" type="com.yssh.entity.FeedbackDetail"> |
| | | <id property="id" column="id" /> |
| | | <result property="tableName" column="table_name" /> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="feedbackDetailSql"> |
| | | SELECT id, table_name, location_name, detection_id, detection_vocs_name, |
| | | detection_value, practical_id, practical_vocs_name, practical_value, create_time |
| | | FROM feedback |
| | | SELECT id, table_name, location_name, detection_id, detection_vocs_name, format(detection_value, 2) detection_value, |
| | | practical_id, practical_vocs_name, format(practical_value, 2) practical_value, create_time |
| | | FROM feedback |
| | | </sql> |
| | | |
| | | <select id="selectById" parameterType="java.lang.Long" resultMap="FeedbackDetailResult"> |
| | |
| | | #{detectionVocsName}, #{detectionValue}, #{practicalId}, |
| | | #{practicalVocsName}, #{practicalValue}, #{createTime}) |
| | | </insert> |
| | | |
| | | |
| | | <update id="update" parameterType="com.yssh.entity.FeedbackDetail"> |
| | | UPDATE feedback SET |
| | | practical_id = #{practicalId}, practical_vocs_name = #{practicalVocsName}, practical_value = #{practicalValue} |
| | | WHERE id = #{id} |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="locationSql"> |
| | | SELECT id, name, type, lon, lat FROM location |
| | | SELECT id, name, type, format(lon, 6) lon, format(lat, 6) lat FROM location |
| | | </sql> |
| | | |
| | | <select id="query" resultMap="locationResult"> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.yssh.dao.QxshMapper"> |
| | | <select id="selectByTime" resultType="com.yssh.entity.Qxsh"> |
| | | select id, name, lon, lat, value, time |
| | | select id, name, lon, lat, format(value, 2) "value", time |
| | | from yssh_qxsh |
| | | where time = #{time} |
| | | order by name; |
| | |
| | | |
| | | <select id="selectMonthTop10" resultType="com.yssh.entity.Qxsh"> |
| | | with rs as ( |
| | | select id, name, cast(value as decimal(12, 3)) "value", time |
| | | select id, name, format(value, 2) "value", time |
| | | from yssh_qxsh |
| | | where time like #{time} and name like 'AI-%' |
| | | ) |
| | |
| | | </select> |
| | | |
| | | <select id="select3Hours" resultType="com.yssh.entity.Qxsh"> |
| | | select id, name, format(value, 3) "value", time |
| | | select id, name, format(value, 2) "value", time |
| | | from yssh_qxsh |
| | | where name like 'AI-%' and time in |
| | | <foreach collection="times" item="time" open="(" separator="," close=")"> |
| | |
| | | </resultMap> |
| | | |
| | | <select id="get2d" resultMap="SuYuan2dResult"> |
| | | SELECT id, x, y, c |
| | | SELECT id, x, y, format(c, 2) "c" |
| | | FROM ${tableName} |
| | | WHERE id IN |
| | | <foreach collection="ids" item="item" open="(" separator="," close=")"> |
| | |
| | | |
| | | <select id="get3d" resultMap="SuYuan3dResult"> |
| | | SELECT sy.id, sy.x, sy.y, sy.id, sy.x, sy.y, ( |
| | | SELECT c FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 0) |
| | | SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 0) |
| | | ) AS height0, ( |
| | | SELECT c FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 1) |
| | | SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 1) |
| | | ) AS height10, ( |
| | | SELECT c FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 2) |
| | | SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 2) |
| | | ) AS height20, ( |
| | | SELECT c FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 3) |
| | | SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 3) |
| | | ) AS height30, ( |
| | | SELECT c FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 4) |
| | | SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 4) |
| | | ) AS height40, ( |
| | | SELECT c FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 5) |
| | | SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 5) |
| | | ) AS height50, ( |
| | | SELECT c FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 6) |
| | | SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 6) |
| | | ) AS height60, ( |
| | | SELECT c FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 7) |
| | | SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 7) |
| | | ) AS height70, ( |
| | | SELECT c FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 8) |
| | | SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 8) |
| | | ) AS height80, ( |
| | | SELECT c FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 9) |
| | | SELECT format(c, 2) "c" FROM ${tableName} WHERE id = concat_ws('_', SUBSTRING_INDEX(sy.id,'_',2), 9) |
| | | ) AS height90 |
| | | FROM ${tableName} AS sy |
| | | WHERE id IN |
| | |
| | | </select> |
| | | |
| | | <select id="getDistanceSuYuan" resultMap="DistanceSuYuanResult"> |
| | | SELECT id, x, y, c, u, v |
| | | SELECT id, x, y, format(c, 2) "c", u, v |
| | | FROM ${tableName} |
| | | WHERE id IN |
| | | <foreach collection="ids" item="item" open="(" separator="," close=")"> |
| | |
| | | </select> |
| | | |
| | | <select id="getAlarmsAnalyse" resultMap="SuYuan2dResult"> |
| | | SELECT id, x, y, c |
| | | SELECT id, x, y, format(c, 2) "c" |
| | | FROM ${tableName} |
| | | WHERE id IN |
| | | <foreach collection="ids" item="item" open="(" separator="," close=")"> |
| | |
| | | </select> |
| | | |
| | | <select id="getWarningAnalyse" resultMap="SuYuan2dResult"> |
| | | SELECT id, x, y, c |
| | | SELECT id, x, y, format(c, 2) "c" |
| | | FROM ${tableName} |
| | | WHERE id IN |
| | | <foreach collection="ids" item="item" open="(" separator="," close=")"> |
| | |
| | | |
| | | <select id="getMonitorData" resultMap="SuYuanMonitorDataResult"> |
| | | <foreach collection="tableNames" item="tableName" separator=" UNION "> |
| | | SELECT id, c, SUBSTRING_INDEX(#{tableName},'_',-1) AS time |
| | | SELECT id, format(c, 2) "c", SUBSTRING_INDEX(#{tableName}, '_', -1) AS time |
| | | FROM ${tableName} |
| | | WHERE id = #{id} |
| | | </foreach> |
| | | </select> |
| | | |
| | | <select id="getNewMonitorData" resultType="com.yssh.entity.SuYuanMonitorData"> |
| | | select id, value, time |
| | | select id, format(value, 2) "value", time |
| | | from yssh_qxsh |
| | | where name = #{name} and Cast(time as signed) between ${start} and ${end} |
| | | order by time desc; |
| | |
| | | |
| | | <select id="getMonthValueDataMax" resultType="java.util.Map"> |
| | | <foreach collection="tableNames" item="tableName" separator=" UNION "> |
| | | SELECT TRUNCATE(c, 2) AS value, SUBSTRING_INDEX(#{tableName}, '_', -1) AS time |
| | | SELECT format(c, 2) AS value, SUBSTRING_INDEX(#{tableName}, '_', -1) AS time |
| | | FROM ${tableName} |
| | | WHERE id = #{id} |
| | | </foreach> |
| | |
| | | </select> |
| | | |
| | | <select id="getTemporary" resultMap="TemporaryResult"> |
| | | SELECT x, y, z, c, u, v, w, c |
| | | SELECT x, y, z, u, v, w, format(c, 2) "c" |
| | | FROM ${tableName} |
| | | WHERE id IN |
| | | <foreach collection="ids" item="item" open="(" separator="," close=")"> |
| | |
| | | select a.x, a.y, format(a.val, 2) "val", b.addr |
| | | from voc_vals a inner join voc_addr b |
| | | on a.x = b.x and a.y = b.y |
| | | where date_format(a.create_time, '%Y%m%d%H') = ${time} and a.val > 0.5; |
| | | where date_format(a.create_time, '%Y%m%d%H') = ${time} |
| | | and a.val > (select jcyj from alert_config); |
| | | </select> |
| | | |
| | | <select id="countByTime" resultType="java.lang.Integer"> |
| | |
| | | </resultMap> |
| | | |
| | | <select id="selectWarningDetailByType" resultMap="WarningVoResult"> |
| | | SELECT location_name, su_yuan_id, value |
| | | SELECT location_name, su_yuan_id, format(value, 2) "value" |
| | | FROM warning_detail |
| | | WHERE date_format(create_time, '%Y%m%d%H%I') >= date_format(NOW(), '%Y%m%d%H%I') |
| | | AND type = #{type} |
| | | </select> |
| | | |
| | | <select id="selectWarningDetailByMap_old" parameterType="java.util.Map" resultMap="WarningVoResult"> |
| | | SELECT location_name, su_yuan_id, value |
| | | SELECT location_name, su_yuan_id, format(value, 2) "value" |
| | | FROM warning_detail |
| | | WHERE date_format(create_time, '%Y%m%d%H%I%S') >= date_format(#{startTime}, '%Y%m%d%H%I%S') |
| | | AND date_format(create_time, '%Y%m%d%H%I%S') <= date_format(#{endTime}, '%Y%m%d%H%I%S') |
| | |
| | | </select> |
| | | |
| | | <select id="selectWarningDetailByMap" parameterType="java.util.Map" resultMap="WarningVoResult"> |
| | | select location_name, su_yuan_id, value |
| | | select location_name, su_yuan_id, format(value, 2) "value" |
| | | from warning_detail |
| | | where create_time between #{startTime} and #{endTime} and type = #{type}; |
| | | </select> |
| | |
| | | </select> |
| | | |
| | | <select id="selectByTime" resultMap="WarningDetailResult"> |
| | | select * from warning_detail |
| | | select id, table_name, su_yuan_id, location_name, type, create_time, format(value, 2) "value" |
| | | from warning_detail |
| | | where create_time between #{startTime} and #{endTime} |
| | | order by create_time; |
| | | </select> |
| | |
| | | </resultMap> |
| | | |
| | | <select id="query" resultMap="WeatherResult"> |
| | | select * from yssh_weather |
| | | select id, time, format(wind_speed, 2) "wind_speed", wind_direction, weather_condition, format(temperature, 2) "temperature" |
| | | from yssh_weather |
| | | <where> |
| | | 1 = 1 |
| | | <if test="begin != null"> |
| | |
| | | </select> |
| | | |
| | | <select id="getAll" resultMap="WeatherResult"> |
| | | select * from yssh_weather |
| | | select id, time, format(wind_speed, 2) "wind_speed", wind_direction, weather_condition, format(temperature, 2) "temperature" |
| | | from yssh_weather |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.yssh.entity.Weather"> |