From e273d890983912fb4220fc8f89745a61db275119 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期一, 05 六月 2023 15:32:21 +0800 Subject: [PATCH] 添加Voc文件的实体类、Mapper文件等 --- src/main/java/com/yssh/entity/VocVals.java | 68 ++++++++++++++++++++++ src/main/resources/mapping/VocValsMapper.xml | 39 +++++++++++++ src/main/java/com/yssh/config/CsvFilePathConfig.java | 10 +++ src/main/java/com/yssh/dao/VocValsMapper.java | 46 +++++++++++++++ src/main/resources/application-file.yml | 10 +-- 5 files changed, 167 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/yssh/config/CsvFilePathConfig.java b/src/main/java/com/yssh/config/CsvFilePathConfig.java index 0c02c86..f309337 100644 --- a/src/main/java/com/yssh/config/CsvFilePathConfig.java +++ b/src/main/java/com/yssh/config/CsvFilePathConfig.java @@ -18,4 +18,14 @@ public void setFilePath(String filePath) { this.filePath = filePath; } + + private String vocPath; + + public String getVocPath() { + return vocPath; + } + + public void setVocPath(String vocPath) { + this.vocPath = vocPath; + } } diff --git a/src/main/java/com/yssh/dao/VocValsMapper.java b/src/main/java/com/yssh/dao/VocValsMapper.java new file mode 100644 index 0000000..0f0aeee --- /dev/null +++ b/src/main/java/com/yssh/dao/VocValsMapper.java @@ -0,0 +1,46 @@ +package com.yssh.dao; + +import com.yssh.entity.VocVals; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * Voc鍊糓apper鎺ュ彛 + * @author WWW + * @date 2023-06-05 + */ +@Mapper +public interface VocValsMapper { + /** + * 鏍规嵁鏃堕棿鏌ヨ + * + * @param time 鏃堕棿锛堢ず渚嬶細2023060514锛� + * @param startVal 璧峰鍊硷紙鍙负绌�) + * @return + */ + public List<VocVals> selectByTime(String time, Double startVal); + + /** + * 鎻掑叆涓�鏉℃暟鎹� + * + * @param vv Voc瀹炰綋绫� + * @return 褰卞搷琛屾暟 + */ + public int insert(VocVals vv); + + /** + * 鎻掑叆澶氭潯鏁版嵁 + * + * @param list Voc闆嗗悎 + * @return 褰卞搷琛屾暟 + */ + public int inserts(List<VocVals> list); + + /** + * 鍒犻櫎鍘诲勾鐨勬暟鎹� + * + * @return 褰卞搷琛屾暟 + */ + public int deleteLastYear(); +} diff --git a/src/main/java/com/yssh/entity/VocVals.java b/src/main/java/com/yssh/entity/VocVals.java new file mode 100644 index 0000000..e78ec1a --- /dev/null +++ b/src/main/java/com/yssh/entity/VocVals.java @@ -0,0 +1,68 @@ +package com.yssh.entity; + +import cn.hutool.core.date.DateTime; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; + +public class VocVals implements Serializable { + private static final long serialVersionUID = -20230605145412000L; + + @ApiModelProperty(value = "涓婚敭") + private int id; + + @ApiModelProperty(value = "X") + private int x; + + @ApiModelProperty(value = "Y") + private int y; + + @ApiModelProperty(value = "鍊�") + private double val; + + @ApiModelProperty(value = "鍒涘缓鏃堕棿") + private DateTime createTime; + + public VocVals() { + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getX() { + return x; + } + + public void setX(int x) { + this.x = x; + } + + public int getY() { + return y; + } + + public void setY(int y) { + this.y = y; + } + + public double getVal() { + return val; + } + + public void setVal(double val) { + this.val = val; + } + + public DateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(DateTime createTime) { + this.createTime = createTime; + } +} diff --git a/src/main/resources/application-file.yml b/src/main/resources/application-file.yml index df0f795..47dc22a 100644 --- a/src/main/resources/application-file.yml +++ b/src/main/resources/application-file.yml @@ -1,10 +1,8 @@ #dat閰嶇疆璺緞 -dat: - #filePath2d: 'E:\2022\dat\extract_mesh.dat' - #filePath3d: 'E:\2022\dat\correct_jk_47.dat' +dat: filePath2d: 'D:\2022\dat\extract_mesh.dat' filePath3d: 'D:\2022\dat\correct_jk_47.dat' #csv閰嶇疆璺緞 -csv: - #filePath: 'E:\2022\yssh' - filePath: 'D:\2022\yssh' \ No newline at end of file +csv: + filePath: 'D:\2022\yssh' + vocPath: 'D:\2022\voc' diff --git a/src/main/resources/mapping/VocValsMapper.xml b/src/main/resources/mapping/VocValsMapper.xml new file mode 100644 index 0000000..2d77cfe --- /dev/null +++ b/src/main/resources/mapping/VocValsMapper.xml @@ -0,0 +1,39 @@ +<?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.dao.VocValsMapper"> + <resultMap id="selectMap" type="com.yssh.entity.VocVals"> + <id property="id" column="id" /> + <result property="x" column="x" /> + <result property="y" column="y" /> + <result property="val" column="val" /> + <result property="createTime" column="create_time" /> + </resultMap> + + <select id="selectByTime" resultMap="selectMap"> + select * + from voc_vals + <where> + date_format(create_time, '%Y%m%d%H') = ${time} + <if test="startVal != null"> + and val > ${startVal} + </if> + </where> + </select> + + <insert id="insert" parameterType="com.yssh.entity.VocVals" useGeneratedKeys="true" keyProperty="id"> + insert into voc_vals (x, y, val, create_time) values + (${x}, ${y}, ${val}, ${createTime}); + </insert> + + <insert id="inserts" parameterType="com.yssh.entity.VocVals" useGeneratedKeys="true" keyProperty="id"> + insert into voc_vals (x, y, val, create_time) values + <foreach collection="list" item="item" index="index" separator=","> + (#{item.x},#{item.y},#{item.val},#{item.createTime}) + </foreach> + </insert> + + <delete id="deleteLastYear"> + delete from voc_vals + where create_time < date_sub(now(), interval 1 year); + </delete> +</mapper> \ No newline at end of file -- Gitblit v1.9.3