From 971d4858fcba2b551bc26f281c71f16e8671ab62 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期日, 05 十一月 2023 11:11:09 +0800 Subject: [PATCH] 添加快速溯源接口 --- src/main/java/com/yssh/mapper/SuYuanMapper.java | 2 + src/main/resources/mapper/SuYuanMapper.xml | 8 +++ src/main/java/com/yssh/entity/SuYuanFast.java | 87 +++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/yssh/service/SuYuanService.java | 9 ++++ src/main/java/com/yssh/controller/SuYuanController.java | 13 ++++++ 5 files changed, 117 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/yssh/controller/SuYuanController.java b/src/main/java/com/yssh/controller/SuYuanController.java index 196bfa4..1fa3d4a 100644 --- a/src/main/java/com/yssh/controller/SuYuanController.java +++ b/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)); + } } diff --git a/src/main/java/com/yssh/entity/SuYuanFast.java b/src/main/java/com/yssh/entity/SuYuanFast.java new file mode 100644 index 0000000..95a04f9 --- /dev/null +++ b/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; + } +} diff --git a/src/main/java/com/yssh/mapper/SuYuanMapper.java b/src/main/java/com/yssh/mapper/SuYuanMapper.java index 24471c2..c290a69 100644 --- a/src/main/java/com/yssh/mapper/SuYuanMapper.java +++ b/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); } diff --git a/src/main/java/com/yssh/service/SuYuanService.java b/src/main/java/com/yssh/service/SuYuanService.java index 418c959..842f249 100644 --- a/src/main/java/com/yssh/service/SuYuanService.java +++ b/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); + } } diff --git a/src/main/resources/mapper/SuYuanMapper.xml b/src/main/resources/mapper/SuYuanMapper.xml index a5de542..d9cda4a 100644 --- a/src/main/resources/mapper/SuYuanMapper.xml +++ b/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 '涓婚敭', -- Gitblit v1.9.3