燕山石化溯源三维电子沙盘-【后端】-服务
1
13693261870
2023-08-09 68fb467762697d9f71e12bb71e14d177880537d4
1
已添加2个文件
已修改1个文件
181 ■■■■■ 文件已修改
src/main/java/com/yssh/entity/xls/XlsReport.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/XlsReportMapper.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/XlsReportMapper.xml 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/xls/XlsReport.java
@@ -1,9 +1,70 @@
package com.yssh.entity.xls;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Excel报告实体类
 * @author WWW
 * @date 2023-08-09
 */
public class XlsReport {
    @ApiModelProperty(value = "主键")
    private Long id;
    @ApiModelProperty(value = "名称")
    private String name;
    @ApiModelProperty(value = "类别")
    private String type;
    @ApiModelProperty(value = "文件路径")
    private String path;
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    public XlsReport() {
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getPath() {
        return path;
    }
    public void setPath(String path) {
        this.path = path;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
src/main/java/com/yssh/mapper/XlsReportMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
package com.yssh.mapper;
import com.yssh.entity.xls.XlsReport;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * XlsReportMapper
 * @author WWW
 * @date 2023-08-09
 */
@Mapper
public interface XlsReportMapper {
    int insert(XlsReport xls);
    List<XlsReport> selectByPage(@Param("type") String type, @Param("start") Integer start, @Param("end") Integer end, @Param("pageIndex") Integer pageIndex, @Param("pageSize") Integer pageSize);
}
src/main/resources/mapper/XlsReportMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,101 @@
<?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>
    <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 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);
    </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>
</mapper>