| | |
| | | <?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"> |
| | | <select id="selectByPage" resultType="com.yssh.entity.xls.XlsReport"> |
| | | <mapper namespace="com.yssh.mapper.XlsReportMapper"> |
| | | <select id="selectReportCount" resultType="java.lang.Integer"> |
| | | select count(*) |
| | | from xls_report |
| | | <where> |
| | | 1 = 1 |
| | | <if test="type != null"> |
| | | and type = #{type} |
| | | </if> |
| | | <if test="start != null"> |
| | | and create_time >= #{start} |
| | | </if> |
| | | <if test="end != null"> |
| | | and create_time <= #{end} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!-- 分页查询报告 --> |
| | | <select id="selectReportByPage" resultType="com.yssh.entity.xls.XlsReport"> |
| | | select * |
| | | from xls_report |
| | | <where> |
| | |
| | | and create_time >= #{start} |
| | | </if> |
| | | <if test="end != null"> |
| | | and end <= #{end} |
| | | and create_time <= #{end} |
| | | </if> |
| | | </where> |
| | | order by id desc |
| | | order by create_time desc |
| | | limit #{limit} offset #{offset} |
| | | </select> |
| | | |
| | | <select id="xlsExists" resultType="java.lang.Integer"> |
| | | <!-- 根据ID查询报告 --> |
| | | <select id="selectById" resultType="com.yssh.entity.xls.XlsReport"> |
| | | select * |
| | | from xls_report |
| | | where id = #{id}; |
| | | </select> |
| | | |
| | | <!-- 报告是否存在 --> |
| | | <select id="reportExists" resultType="java.lang.Integer"> |
| | | select count(*) |
| | | from xls_report |
| | | where type = #{type} and name = #{name} |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.yssh.entity.xls.XlsReport"> |
| | | <!-- 插入报告 --> |
| | | <insert id="insertReport" parameterType="com.yssh.entity.xls.XlsReport"> |
| | | insert into xls_report |
| | | (name, type, path, create_time) |
| | | values |
| | | (#{name}, #{type}, #{path}, #{createTime}) |
| | | </insert> |
| | | |
| | | <!-- 查询日均值 --> |
| | | <select id="selectDayAvg" resultType="java.lang.Double"> |
| | | select ifnull(round(avg(value), 2), 0) |
| | | from yssh_qxsh |
| | | where time like #{time} and name = #{name}; |
| | | </select> |
| | | |
| | | <!-- 查询累计值 --> |
| | | <select id="selectAccumulate" resultType="java.lang.Double"> |
| | | select ifnull(round(avg(value), 2), 0) |
| | | from yssh_qxsh |
| | | where time between #{start} and #{end} and name = #{name}; |
| | | </select> |
| | | |
| | | <!-- 查询年累计值 --> |
| | | <select id="selectYearAccumulate" resultType="java.lang.Double"> |
| | | select ifnull(round(avg(value), 2), 0) |
| | | from yssh_qxsh |
| | | where time like #{time} and name = #{name}; |
| | | </select> |
| | | |
| | | <!-- 根据时间查询溯源 --> |
| | | <select id="selectSuYuanByTime" resultType="com.yssh.entity.SuYuan700"> |
| | | select * |
| | | from suyuan_46 |
| | | where su_yuan_id = #{id} and create_time between #{start} and #{end} |
| | | order by create_time; |
| | | </select> |
| | | |
| | | <!-- 根据时间段查询溯源 --> |
| | | <select id="selectSuYuanByStartAndEnd" resultType="com.yssh.entity.SuYuan700"> |
| | | select * |
| | | from suyuan_46 |
| | | where su_yuan_id = #{id} and date_format(create_time, '%Y%m%d%H') in ( |
| | | select time |
| | | from yssh_qxsh |
| | | where value > #{yjz} and name = #{name} and time between #{start} and #{end} |
| | | ); |
| | | </select> |
| | | </mapper> |