燕山石化溯源三维电子沙盘-【后端】-服务
1
13693261870
2023-08-10 e11b25743f224fe44d7747cdd54992f2961c98ab
1
已修改2个文件
124 ■■■■ 文件已修改
src/main/java/com/yssh/mapper/XlsReportMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/XlsReportMapper.xml 118 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/XlsReportMapper.java
@@ -13,7 +13,9 @@
 */
@Mapper
public interface XlsReportMapper {
    int insert(XlsReport xls);
    List<XlsReport> selectByPage(@Param("type") String type, @Param("start") String start, @Param("end") String end, @Param("limit") Integer limit, @Param("offset") Integer offset);
    List<XlsReport> selectByPage(@Param("type") String type, @Param("start") Integer start, @Param("end") Integer end, @Param("pageIndex") Integer pageIndex, @Param("pageSize") Integer pageSize);
    int xlsExists(@Param("type") String type, @Param("start") String start);
    int insert(XlsReport xls);
}
src/main/resources/mapper/XlsReportMapper.xml
@@ -1,101 +1,35 @@
<?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="selectByTime" resultType="com.yssh.entity.Qxsh">
        select id, name, lon, lat, format(value, 2) "value", time
        from yssh_qxsh
        where time = #{time}
        order by name;
    <select id="selectByPage" resultType="com.yssh.entity.xls.XlsReport">
        select *
        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 end &lt;= #{end}
            </if>
        </where>
        order by id desc
        limit #{limit} offset #{offset}
    </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
            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_qxsh
        where time between #{start} and #{end} and name like 'AI-%'
            and value > (select jcyj from alert_config limit 1) and value &lt;= (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_qxsh
        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">
    <select id="xlsExists" resultType="java.lang.Integer">
        select count(*)
        from yssh_qxsh
        where time between #{start} and #{end} and name like 'AI-%'
            and value > (select jcyj from alert_config limit 1) and value &lt;= (select jcbj from alert_config limit 1);
        from xls_report
        where type = #{type} and name = #{name}
    </select>
    <select id="countMonthForAlarm" resultType="java.lang.Integer">
        select count(*)
        from yssh_qxsh
        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-%'
                and value > (select jcyj from alert_config limit 1) and value &lt;= (select jcbj from alert_config limit 1)
        )
        select createTime, count(*) "num" from rs group by createTime order by createTime;
    </select>
    <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)
        )
        select createTime, count(*) "num" from rs group by createTime order by 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}
            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}
            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}
         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}
        limit 1;
    </select>
    <insert id="insert" parameterType="com.yssh.entity.xls.XlsReport">
       insert into xls_report
       (name, type, path, create_time)
       values
       (#{name}, #{type}, #{path}, #{createTime})
    </insert>
</mapper>