From 68fb467762697d9f71e12bb71e14d177880537d4 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 09 八月 2023 20:19:28 +0800 Subject: [PATCH] 1 --- src/main/java/com/yssh/entity/xls/XlsReport.java | 61 +++++++++++++++ src/main/java/com/yssh/mapper/XlsReportMapper.java | 19 ++++ src/main/resources/mapper/XlsReportMapper.xml | 101 +++++++++++++++++++++++++ 3 files changed, 181 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/yssh/entity/xls/XlsReport.java b/src/main/java/com/yssh/entity/xls/XlsReport.java index 5132074..de8b727 100644 --- a/src/main/java/com/yssh/entity/xls/XlsReport.java +++ b/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; + } } diff --git a/src/main/java/com/yssh/mapper/XlsReportMapper.java b/src/main/java/com/yssh/mapper/XlsReportMapper.java new file mode 100644 index 0000000..916be85 --- /dev/null +++ b/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); +} diff --git a/src/main/resources/mapper/XlsReportMapper.xml b/src/main/resources/mapper/XlsReportMapper.xml new file mode 100644 index 0000000..8d73f5b --- /dev/null +++ b/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 <= (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 <= (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 <= (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> \ No newline at end of file -- Gitblit v1.9.3