燕山石化溯源三维电子沙盘-【后端】-服务
13693261870
2023-06-06 553523418b10f2db5a4f50e0614de4122338ab86
修改根据时间查询Voc接口
已添加1个文件
已修改4个文件
46 ■■■■ 文件已修改
src/main/java/com/yssh/dao/VocValsMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/VocVals.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/VocValsService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapping/VocValsMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ys.sql 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/dao/VocValsMapper.java
@@ -16,11 +16,10 @@
    /**
     * æ ¹æ®æ—¶é—´æŸ¥è¯¢
     *
     * @param time     æ—¶é—´ï¼ˆç¤ºä¾‹ï¼š2023060514)
     * @param startVal èµ·å§‹å€¼ï¼ˆå¯ä¸ºç©º)
     * @param time æ—¶é—´ï¼ˆç¤ºä¾‹ï¼š2023060514)
     * @return
     */
    public List<VocVals> selectByTime(@Param("time") String time, @Param("startVal") Double startVal);
    public List<VocVals> selectByTime(@Param("time") String time);
    /**
     * æ ¹æ®æ—¶é—´ç»Ÿè®¡
src/main/java/com/yssh/entity/VocVals.java
@@ -1,5 +1,6 @@
package com.yssh.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.github.biyanwen.annotation.CsvProperty;
import io.swagger.annotations.ApiModelProperty;
@@ -10,6 +11,7 @@
public class VocVals implements Serializable {
    private static final long serialVersionUID = -20230605145412000L;
    @JsonIgnore
    @ApiModelProperty(value = "主键")
    private BigInteger id;
@@ -25,6 +27,7 @@
    @ApiModelProperty(value = "值")
    private Double val;
    @JsonIgnore
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
src/main/java/com/yssh/service/VocValsService.java
@@ -20,8 +20,8 @@
    protected final Log logger = LogFactory.getLog(this.getClass());
    @Override
    public List<VocVals> selectByTime(String time, Double startVal) {
        return vocValsMapper.selectByTime(time, startVal);
    public List<VocVals> selectByTime(String time) {
        return vocValsMapper.selectByTime(time);
    }
    @Override
src/main/resources/mapping/VocValsMapper.xml
@@ -10,14 +10,10 @@
    </resultMap>
    <select id="selectByTime" resultMap="selectMap">
        select *
        select x, y, cast(val as decimal(12, 3)) "val"
        from voc_vals
        <where>
            date_format(create_time, '%Y%m%d%H') = ${time}
            <if test="startVal != null">
                and val > ${startVal}
            </if>
        </where>
        where date_format(create_time, '%Y%m%d%H') = ${time}
            and val > (select jcyj from alert_config);
    </select>
    <select id="countByTime" resultType="java.lang.Integer">
ys.sql
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
----------------------------------------------------------------------
use yssh;
show tables;
SHOW BINARY LOGS;
RESET MASTER;
----------------------------------------------------------------------
create table voc_vals (
    id bigint not null primary key comment '主键',
    x int comment 'X',
    y int comment 'Y',
    val double(25, 10) comment '值',
    create_time datetime comment '值'
);
-- drop table voc_vals;
create index voc_vals_val on voc_vals (val);
create index voc_vals_time on voc_vals (create_time);
----------------------------------------------------------------------
/* select a.*, date_format(create_time, '%Y%m%d%H') "time" from voc_vals a where date_format(create_time, '%Y%m%d%H') = '2023060514';
select * from voc_vals where create_time < date_sub(now(), interval 1 year);
select date_sub(now(), interval 1 year) "time" from dual;
select count(*) from voc_vals; */
select * from voc_vals;