燕山石化溯源三维电子沙盘-【后端】-服务
13693261870
2023-11-05 971d4858fcba2b551bc26f281c71f16e8671ab62
添加快速溯源接口
已添加1个文件
已修改4个文件
119 ■■■■■ 文件已修改
src/main/java/com/yssh/controller/SuYuanController.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/entity/SuYuanFast.java 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/mapper/SuYuanMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/SuYuanService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/SuYuanMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/controller/SuYuanController.java
@@ -1,5 +1,6 @@
package com.yssh.controller;
import cn.hutool.core.date.DateTime;
import com.yssh.entity.*;
import com.yssh.service.CommonService;
import com.yssh.service.VocValsService;
@@ -196,11 +197,21 @@
    }
    @ApiOperation(value = "根据名称查询溯源ID", notes = "根据名称查询溯源ID")
    @ApiOperationSupport(order = 16)
    @ApiOperationSupport(order = 17)
    @GetMapping("/selectSuYuanIdByName")
    public Result selectSuYuanIdByName(@RequestParam(value = "name") String name) {
        if (null == name || name.length() == 0) return Result.OK(null);
        return Result.OK(suYuanService.selectSuYuanIdByName(name));
    }
    @ApiOperation(value = "根据ID查询快速溯源")
    @ApiOperationSupport(order = 18)
    @GetMapping("/selectFastById")
    public Result selectFastById(@RequestParam(value = "id") String id, @RequestParam(value = "date", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) {
        if (StringUtils.isEmpty(id)) return Result.OK(null);
        if (null == date) date = DateTime.now();
        return Result.OK(suYuanService.selectFastById(id, date));
    }
}
src/main/java/com/yssh/entity/SuYuanFast.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,87 @@
package com.yssh.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
 * å¿«é€Ÿæº¯æºè¡¨
 * @author WWW
 * @date 2023-11-05
 */
@Data
public class SuYuanFast {
    private static final long serialVersionUID = 2023110510570000000L;
    public SuYuanFast() {
    }
    @ApiModelProperty(value = "主键ID")
    private Long id;
    @ApiModelProperty(value = "溯源ID")
    private String suYuanId;
    @ApiModelProperty(value = "方向")
    private Double dir;
    @ApiModelProperty(value = "X")
    private Double x;
    @ApiModelProperty(value = "Y")
    private Double y;
    @ApiModelProperty(value = "时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getSuYuanId() {
        return suYuanId;
    }
    public void setSuYuanId(String suYuanId) {
        this.suYuanId = suYuanId;
    }
    public Double getDir() {
        return dir;
    }
    public void setDir(Double dir) {
        this.dir = dir;
    }
    public Double getX() {
        return x;
    }
    public void setX(Double x) {
        this.x = x;
    }
    public Double getY() {
        return y;
    }
    public void setY(Double y) {
        this.y = y;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
src/main/java/com/yssh/mapper/SuYuanMapper.java
@@ -45,4 +45,6 @@
    SuYuan700 selectSuYuan700ById(@Param("id") String id, @Param("time") String time);
    SuYuan700 selectSuYuan46ById(@Param("id") String id, @Param("time") String time);
    List<SuYuanFast> selectFastById(@Param("id") String id, @Param("time") String time);
}
src/main/java/com/yssh/service/SuYuanService.java
@@ -346,4 +346,13 @@
        return suYuanId;
    }
    /**
     * æ ¹æ®ID查询快速溯源
     */
    public List<SuYuanFast> selectFastById(String id, Date date) {
        String time = DateUtils.getYyyyMmDdHhMmSs(date);
        return suYuanMapper.selectFastById(id, time);
    }
}
src/main/resources/mapper/SuYuanMapper.xml
@@ -215,7 +215,13 @@
    <select id="isTableExists" resultType="java.lang.Integer">
        select count(*) from information_schema.tables where table_name = #{tableName};
    </select>
    <select id="selectFastById" resultType="com.yssh.entity.SuYuanFast">
        select * from yssh.suyuan_fast
        where su_yuan_id = #{id} and create_time = #{time}
        order by id;
    </select>
    <update id="createTable" parameterType="java.lang.String">
        create table ${tableName}  (
                 `id` varchar(10) not null comment '主键',