| | |
| | | |
| | | return Result.OK(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®Xï¼Y弿¥è¯¢å°å", notes = "æ ¹æ®Xï¼Y弿¥è¯¢å°å") |
| | | @ApiOperationSupport(order = 12) |
| | | @GetMapping("/selectCoords") |
| | | public Result selectVocByTime(@RequestParam(value = "x", required = false) Integer x, @RequestParam(value = "y", required = false) Integer y) { |
| | | return Result.OK(vocValsService.selectCoords(x, y)); |
| | | } |
| | | } |
| | |
| | | package com.yssh.dao; |
| | | |
| | | import com.yssh.entity.VocCoords; |
| | | import com.yssh.entity.VocVals; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | public int countByTime(@Param("time") String time); |
| | | |
| | | /** |
| | | * æ ¹æ®Xï¼Y弿¥è¯¢å°å |
| | | * |
| | | * @param x Xå¼ |
| | | * @param y Yå¼ |
| | | * @return å°å |
| | | */ |
| | | public List<VocCoords> selectCoords(@Param("x") Integer x, @Param("y") Integer y); |
| | | |
| | | /** |
| | | * æå
¥ä¸æ¡æ°æ® |
| | | * |
| | | * @param vv Vocå®ä½ç±» |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yssh.entity; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.github.biyanwen.annotation.CsvProperty; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | public class VocCoords implements Serializable { |
| | | private static final long serialVersionUID = -20230606150000000L; |
| | | |
| | | @JsonIgnore |
| | | @ApiModelProperty(value = "主é®") |
| | | private Integer id; |
| | | |
| | | @CsvProperty(index = 0) |
| | | @ApiModelProperty(value = "X") |
| | | private Integer x; |
| | | |
| | | @CsvProperty(index = 1) |
| | | @ApiModelProperty(value = "Y") |
| | | private Integer y; |
| | | |
| | | @CsvProperty(index = 2) |
| | | @ApiModelProperty(value = "å°å") |
| | | private String addr; |
| | | |
| | | public VocCoords() { |
| | | } |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getX() { |
| | | return x; |
| | | } |
| | | |
| | | public void setX(Integer x) { |
| | | this.x = x; |
| | | } |
| | | |
| | | public Integer getY() { |
| | | return y; |
| | | } |
| | | |
| | | public void setY(Integer y) { |
| | | this.y = y; |
| | | } |
| | | |
| | | public String getAddr() { |
| | | return addr; |
| | | } |
| | | |
| | | public void setAddr(String addr) { |
| | | this.addr = addr; |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "å°å") |
| | | private String addr; |
| | | |
| | | public VocVals() { |
| | | } |
| | | |
| | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getAddr() { |
| | | return addr; |
| | | } |
| | | |
| | | public void setAddr(String addr) { |
| | | this.addr = addr; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.google.common.collect.Lists; |
| | | import com.yssh.dao.VocValsMapper; |
| | | import com.yssh.entity.VocCoords; |
| | | import com.yssh.entity.VocVals; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<VocCoords> selectCoords(Integer x, Integer y) { |
| | | return vocValsMapper.selectCoords(x, y); |
| | | } |
| | | |
| | | @Override |
| | | public int insert(VocVals vv) { |
| | | return vocValsMapper.insert(vv); |
| | | } |
| | |
| | | <result property="y" column="y" /> |
| | | <result property="val" column="val" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="addr" column="addr" /> |
| | | </resultMap> |
| | | |
| | | <select id="selectByTime" resultMap="selectMap"> |
| | | select x, y, format(val, 2) "val" |
| | | from voc_vals |
| | | where date_format(create_time, '%Y%m%d%H') = ${time} |
| | | and val > (select jcyj from alert_config); |
| | | select a.x, a.y, format(a.val, 2) "val", b.addr |
| | | from voc_vals a inner join voc_addr b |
| | | on a.x = b.x and a.y = b.y |
| | | where date_format(a.create_time, '%Y%m%d%H') = ${time} |
| | | and a.val > (select jcyj from alert_config); |
| | | </select> |
| | | |
| | | <select id="countByTime" resultType="java.lang.Integer"> |
| | |
| | | where date_format(create_time, '%Y%m%d%H') = ${time}; |
| | | </select> |
| | | |
| | | <select id="selectCoords" resultType="com.yssh.entity.VocCoords"> |
| | | select x, y, addr |
| | | from voc_addr |
| | | <where> |
| | | 1 = 1 |
| | | <if test="x != null"> |
| | | and x = ${x} |
| | | </if> |
| | | <if test="y != null"> |
| | | and y = ${y} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.yssh.entity.VocVals" useGeneratedKeys="false" keyProperty="id"> |
| | | insert into voc_vals (id, x, y, val, create_time) values |
| | | (${id}, ${x}, ${y}, ${val}, ${createTime}); |
| | |
| | | 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'; |
| | | create table voc_addr ( |
| | | id int not null auto_increment primary key comment '主é®', |
| | | x int comment 'X', |
| | | y int comment 'Y', |
| | | addr varchar(50) comment 'å°å' |
| | | ); |
| | | ---------------------------------------------------------------------- |
| | | 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; |
| | | select * from voc_addr; |