From 4c0d44d179656ff3b7bd4547e38283d130139609 Mon Sep 17 00:00:00 2001 From: xjm Date: Tue, 30 Jan 2024 14:28:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E7=AB=99=E9=87=87=E9=9B=86=E9=A1=B9?= =?UTF-8?q?=E6=96=B0=E5=A2=9E,=E4=BF=AE=E6=94=B9,=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=92=8C=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xyt/controller/BasicDataController.java | 59 ++++---- .../project/xyt/entity/dto/StStchBDto.java | 22 +++ .../project/xyt/mapper/StStchBMapper.java | 37 +++++ .../com/gunshi/project/xyt/model/StStchB.java | 143 ++++++++++++++++++ .../project/xyt/service/StStchBService.java | 89 +++++++++++ .../com/gunshi/project/xyt/so/StStchBSo.java | 28 ++++ src/main/resources/mapper/StStchBMapper.xml | 5 + src/main/resources/sql/ST_STCH_B.sql | 31 ++++ ..._RI_WQAMD_W.sql => ST_WATER_QUALITY_R.sql} | 0 9 files changed, 386 insertions(+), 28 deletions(-) create mode 100644 src/main/java/com/gunshi/project/xyt/entity/dto/StStchBDto.java create mode 100644 src/main/java/com/gunshi/project/xyt/mapper/StStchBMapper.java create mode 100644 src/main/java/com/gunshi/project/xyt/model/StStchB.java create mode 100644 src/main/java/com/gunshi/project/xyt/service/StStchBService.java create mode 100644 src/main/java/com/gunshi/project/xyt/so/StStchBSo.java create mode 100644 src/main/resources/mapper/StStchBMapper.xml create mode 100644 src/main/resources/sql/ST_STCH_B.sql rename src/main/resources/sql/{HYD_RI_WQAMD_W.sql => ST_WATER_QUALITY_R.sql} (100%) diff --git a/src/main/java/com/gunshi/project/xyt/controller/BasicDataController.java b/src/main/java/com/gunshi/project/xyt/controller/BasicDataController.java index 83bc023..e50f0c9 100644 --- a/src/main/java/com/gunshi/project/xyt/controller/BasicDataController.java +++ b/src/main/java/com/gunshi/project/xyt/controller/BasicDataController.java @@ -1,37 +1,14 @@ package com.gunshi.project.xyt.controller; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gunshi.core.annotation.Get; import com.gunshi.core.annotation.Post; import com.gunshi.core.result.R; -import com.gunshi.project.xyt.entity.basedata.CheckStringSearch; -import com.gunshi.project.xyt.entity.basedata.GeneralSearch; -import com.gunshi.project.xyt.entity.basedata.StAddvcdTreeVo; -import com.gunshi.project.xyt.entity.basedata.StCameraAreaTreeVo; -import com.gunshi.project.xyt.entity.basedata.StCameraAreaVo; -import com.gunshi.project.xyt.entity.basedata.StCameraSearch; -import com.gunshi.project.xyt.entity.basedata.StCameraVo; -import com.gunshi.project.xyt.entity.basedata.StSpgPztbVo; -import com.gunshi.project.xyt.entity.basedata.StSpgSpprmpVo; -import com.gunshi.project.xyt.entity.basedata.StStbprpVo; -import com.gunshi.project.xyt.entity.basedata.StcdSearch; -import com.gunshi.project.xyt.entity.basedata.SysDictVo; -import com.gunshi.project.xyt.model.StAddvcdD; -import com.gunshi.project.xyt.model.StCameraAreaB; -import com.gunshi.project.xyt.model.StCameraB; -import com.gunshi.project.xyt.model.StMoncrB; -import com.gunshi.project.xyt.model.StSpgPztb; -import com.gunshi.project.xyt.model.StSpgSpprmp; -import com.gunshi.project.xyt.model.StStbprpB; -import com.gunshi.project.xyt.model.SysDictB; -import com.gunshi.project.xyt.service.StAdcdService; -import com.gunshi.project.xyt.service.StCameraAreaService; -import com.gunshi.project.xyt.service.StCameraService; -import com.gunshi.project.xyt.service.StMoncrService; -import com.gunshi.project.xyt.service.StSpgPztbService; -import com.gunshi.project.xyt.service.StSpgSpprmpService; -import com.gunshi.project.xyt.service.StStbprpService; -import com.gunshi.project.xyt.service.SysDictService; +import com.gunshi.project.xyt.entity.basedata.*; +import com.gunshi.project.xyt.model.*; +import com.gunshi.project.xyt.service.*; +import com.gunshi.project.xyt.so.StStchBSo; import com.gunshi.project.xyt.validate.markers.Update; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.enums.ParameterIn; @@ -62,6 +39,10 @@ public class BasicDataController { private final StCameraAreaService stCameraAreaService; private final StCameraService stCameraService; private final StStbprpService stStbprpService; + + // 测站采集项 + private final StStchBService stStchBService; + private final StMoncrService stMoncrService; //渗压设备 private final StSpgPztbService stSpgPztbService; @@ -243,6 +224,28 @@ public class BasicDataController { return stStbprpService.delete(stcd); } + + @Post(path ="/stcd/stch/insert", summary = "测站采集项新增") + public R insertStch(@RequestBody @Validated StStchB stStchB) { + return R.ok(stStchBService.insert(stStchB)); + } + + @Get(path ="/stcd/stch/del/{id}", summary = "测站采集项删除") + public R delStch(@Schema(description="测站采集项id") @PathVariable("id") Integer id) { + return R.ok(stStchBService.removeById(id)); + } + + @Post(path ="/stcd/stch/update", summary = "测站采集项修改") + public R updateStch(@RequestBody @Validated StStchB bean) { + return R.ok(stStchBService.update(bean)); + } + + @Post(path = "/stcd/stch/page", summary = "测站采集项分页查询") + public R> PageStch(@RequestBody StStchBSo findDto) { + return R.ok(stStchBService.page(findDto)); + } + + @Post(path = "/monct/manage/insert", summary = "新增监测断面接口") public R insertMonCr(@Validated @RequestBody StMoncrB obj) { stMoncrService.insert(obj); diff --git a/src/main/java/com/gunshi/project/xyt/entity/dto/StStchBDto.java b/src/main/java/com/gunshi/project/xyt/entity/dto/StStchBDto.java new file mode 100644 index 0000000..d9a1c85 --- /dev/null +++ b/src/main/java/com/gunshi/project/xyt/entity/dto/StStchBDto.java @@ -0,0 +1,22 @@ +package com.gunshi.project.xyt.entity.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.util.List; + +/** + * @author 李赛 + * @date 2022-06-26 15:27 + */ +@Data +public class StStchBDto { + + @Schema(description="站点编码") + @NotNull(message = "站点编码不能为空") + private String stcd; + + @Schema(description="采集项编码数组") + private List chcds; +} diff --git a/src/main/java/com/gunshi/project/xyt/mapper/StStchBMapper.java b/src/main/java/com/gunshi/project/xyt/mapper/StStchBMapper.java new file mode 100644 index 0000000..9e90ce1 --- /dev/null +++ b/src/main/java/com/gunshi/project/xyt/mapper/StStchBMapper.java @@ -0,0 +1,37 @@ +package com.gunshi.project.xyt.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gunshi.db.dao.IMapper; +import com.gunshi.project.xyt.entity.dto.StStchBDto; +import com.gunshi.project.xyt.model.StStchB; +import com.gunshi.project.xyt.so.StStchBSo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * Description: + * Created by XuSan on 2024/1/30. + * + * @author XuSan + * @version 1.0 + */ +public interface StStchBMapper extends BaseMapper, IMapper { + /** + * 返回所有 + * + * @return + */ + List queryBySearch(@Param("obj") StStchBDto findDto); + + /** + * 分页查询 + * + * @param page + * @param findDto + * @return + */ + IPage queryBySearch(@Param("page") IPage page, @Param("obj") StStchBSo findDto); + +} diff --git a/src/main/java/com/gunshi/project/xyt/model/StStchB.java b/src/main/java/com/gunshi/project/xyt/model/StStchB.java new file mode 100644 index 0000000..755da5c --- /dev/null +++ b/src/main/java/com/gunshi/project/xyt/model/StStchB.java @@ -0,0 +1,143 @@ +package com.gunshi.project.xyt.model; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * Description: + * Created by XuSan on 2024/1/30. + * + * @author XuSan + * @version 1.0 + */ +/** + * 水质自动监测数据表 + */ +@Data +@TableName("ST_STCH_B") +@Accessors(chain = true) // chain = true 实现链式调用 +@JsonInclude(JsonInclude.Include.NON_NULL) // 表示序列化非null属性 +@Schema(description = "站点采集项基础信息") +public class StStchB implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * id编号 + */ + @TableId(value = "ID", type = IdType.AUTO) + @Schema(description = "主键id") + @ExcelProperty("编号") + private Integer id; + + /** + * 选择公式计算时,x 的取值采集项 id + */ + @ExcelProperty("选择公式计算时,x 的取值采集项 id") + @Schema(description = "选择公式计算时,x 的取值采集项 id") + @TableField(value = "XID", updateStrategy = FieldStrategy.IGNORED) + private Integer xid; + + /** + * 公式参数c + */ + @ExcelProperty("公式参数c") + @Schema(description = "公式参数c") + @TableField(value = "C", updateStrategy = FieldStrategy.IGNORED) + private Double c; + + /** + * 公式参数b + */ + @ExcelProperty("公式参数b") + @Schema(description = "公式参数b") + @TableField(value = "B", updateStrategy = FieldStrategy.IGNORED) + private Double b; + + /** + * 公式参数a + */ + @ExcelProperty("公式参数a") + @Schema(description = "公式参数a") + @TableField(value = "A", updateStrategy = FieldStrategy.IGNORED) + private Double a; + + /** + * 计算公式 1, 5分钟时段值,2, 1小时时段,3, 一元一次方程 y = a * x + b , 4, 一元二次方程 y = a * x² + b * x + c + */ + @ExcelProperty("计算公式 1, 5分钟时段值,2, 1小时时段,3, 一元一次方程 y = a * x + b , 4, 一元二次方程 y = a * x² + b * x + c") + @Schema(description = "计算公式 1, 5分钟时段值,2, 1小时时段,3, 一元一次方程 y = a * x + b , 4, 一元二次方程 y = a * x² + b * x + c") + @TableField(value = "FORMULA", updateStrategy = FieldStrategy.IGNORED) + private Integer formula; + + /** + * 是否计算量,0 否,1 是(例如一元二次方程计算流量),2 修正(例如水位加高程。例如 y = a * x + b) + */ + @ExcelProperty("是否计算量,0 否,1 是(例如一元二次方程计算流量),2 修正(例如水位加高程。例如 y = a * x + b)") + @Schema(description = "是否计算量,0 否,1 是(例如一元二次方程计算流量),2 修正(例如水位加高程。例如 y = a * x + b)") + @TableField("CALC") + private Integer calc; + + /** + * 是否默认采集项 + */ + @ExcelProperty("是否默认采集项") + @Schema(description = "是否默认采集项") + @TableField("DEF") + private Integer def; + + /** + * 采集项编号,0/1/2/3/4/5/6等 + */ + @ExcelProperty("采集项编号,0/1/2/3/4/5/6等") + @Schema(description = "采集项编号,0/1/2/3/4/5/6等") + @TableField("CHID") + @NotNull(message = "采集项编号不能为空") + @Size(max = 50,message = "采集项编号长度不能超过50") + private String chid; + + /** + * 采集项编码,DRP/Z/Q/VT/W等 + */ + @ExcelProperty("采集项编码,DRP/Z/Q/VT/W等") + @Schema(description = "采集项编码,DRP/Z/Q/VT/W等") + @TableField("CHCD") + @NotNull(message = "采集项编码不能为空") + @Size(max = 50,message = "采集项编码长度不能超过50") + private String chcd; + + /** + * 采集项名称 + */ + @ExcelProperty("采集项名称") + @Schema(description = "采集项名称") + @TableField("CHNM") + @Size(max = 50,message = "采集项名称长度不能超过50") + private String chnm; + + /** + * 测站编码 + */ + @ExcelProperty("测站编码") + @Schema(description = "测站编码") + @TableField("STCD") + @NotNull(message = "测站编码不能为空") + @Size(max = 50,message = "采集项编码长度不能超过50") + private String stcd; + + /** + * 删除标记 0:未删除, 1: 删除 + */ + @TableField(value = "DEL") + @Schema(description = "删除标记 0:未删除, 1: 删除") + private Integer del; + + +} diff --git a/src/main/java/com/gunshi/project/xyt/service/StStchBService.java b/src/main/java/com/gunshi/project/xyt/service/StStchBService.java new file mode 100644 index 0000000..b886cc5 --- /dev/null +++ b/src/main/java/com/gunshi/project/xyt/service/StStchBService.java @@ -0,0 +1,89 @@ +package com.gunshi.project.xyt.service; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.gunshi.db.dao.BaseOrderDao; +import com.gunshi.project.xyt.mapper.StStchBMapper; +import com.gunshi.project.xyt.model.StStchB; +import com.gunshi.project.xyt.so.StStchBSo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.Objects; + + +/** + * Description: + * Created by XuSan on 2024/1/30. + * + * @author XuSan + * @version 1.0 + */ +@Service +public class StStchBService extends BaseOrderDao { + + + @Transactional + public boolean insert(StStchB bean) { + + bean.setId(null); + + return super.save(bean); + } + + /** + * 根据id更新采集项 + * @param bean 更新对象 + * @return 执行状态 + */ + @Transactional + public boolean update(StStchB bean) { + if (Objects.isNull(baseMapper.selectById(bean.getId()))) { + throw new IllegalArgumentException("未找到相关记录"); + } + + return super.updateById(bean); + + } + + /** + * 根据id删除采集项 + * @param id 主键id + * @return 执行状态 + */ + @Transactional + public boolean removeById(Serializable id) { + + StStchB obj = baseMapper.selectById(id); + if (Objects.isNull(obj)) { + throw new IllegalArgumentException("未找到相关记录"); + } + + obj.setDel(1); + return update(obj); + } + + + /** + * 根据站点编码查询采集项信息 + * @param so 查询对象 + * @return 采集项列表 + */ + public IPage page(StStchBSo so) { + + LambdaQueryWrapper query = Wrappers.lambdaQuery(); + + String stcd = so.getStcd(); + if (stcd != null) { + query.eq(StStchB::getStcd, stcd); + } + + query.eq(StStchB::getDel, 0); + + return super.page(so.getPageSo().toPage(), query); + } + +} diff --git a/src/main/java/com/gunshi/project/xyt/so/StStchBSo.java b/src/main/java/com/gunshi/project/xyt/so/StStchBSo.java new file mode 100644 index 0000000..c9e46ad --- /dev/null +++ b/src/main/java/com/gunshi/project/xyt/so/StStchBSo.java @@ -0,0 +1,28 @@ +package com.gunshi.project.xyt.so; + +import com.gunshi.db.dto.PageSo; +import com.gunshi.project.xyt.validate.markers.Query; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * Description: 测站采集项查询参数 + * Created by XuSan on 2024/1/30. + * + * @author XuSan + * @version 1.0 + */ +@Data +@Schema(description = "测站采集项查询参数") +public class StStchBSo { + + + @NotNull(message = "分页参数不能为空") + private PageSo pageSo; + + @Schema(description = "站点编码") + @NotEmpty(groups = {Query.class}) + private String stcd; +} diff --git a/src/main/resources/mapper/StStchBMapper.xml b/src/main/resources/mapper/StStchBMapper.xml new file mode 100644 index 0000000..fa4473c --- /dev/null +++ b/src/main/resources/mapper/StStchBMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/resources/sql/ST_STCH_B.sql b/src/main/resources/sql/ST_STCH_B.sql new file mode 100644 index 0000000..a9f3370 --- /dev/null +++ b/src/main/resources/sql/ST_STCH_B.sql @@ -0,0 +1,31 @@ +CREATE TABLE ST_STCH_B +( + ID INT IDENTITY(1, 1) NOT NULL, + STCD VARCHAR(50), + CHNM VARCHAR(50), + CHCD VARCHAR(50) NOT NULL, + CHID VARCHAR(50), + DEF SMALLINT DEFAULT 0, + CALC TINYINT, + FORMULA TINYINT, + A DECIMAL(20,10), + B DECIMAL(20,10), + C DECIMAL(20,10), + XID INT, + PRIMARY KEY(ID), + CONSTRAINT ST_STCH_B_STID_CHID UNIQUE(STID, CHID, CHCD) +); + +EXEC sp_addextendedproperty 'MS_Description', '站点采集项(通道)信息', 'SCHEMA', 'dbo', 'TABLE', 'ST_STCH_B', NULL; + +EXEC sp_addextendedproperty 'MS_Description', '公式参数a', 'SCHEMA', 'dbo', 'TABLE', 'ST_STCH_B', 'COLUMN', 'A'; +EXEC sp_addextendedproperty 'MS_Description', '公式参数b', 'SCHEMA', 'dbo', 'TABLE', 'ST_STCH_B', 'COLUMN', 'B'; +EXEC sp_addextendedproperty 'MS_Description', '公式参数c', 'SCHEMA', 'dbo', 'TABLE', 'ST_STCH_B', 'COLUMN', 'C'; +EXEC sp_addextendedproperty 'MS_Description', '是否计算量,0 否,1 是(例如一元二次方程计算流量),2 修正(例如水位加高程。限定公式为 y = a * x + b)', 'SCHEMA', 'dbo', 'TABLE', 'ST_STCH_B', 'COLUMN', 'CALC'; +EXEC sp_addextendedproperty 'MS_Description', '采集项编码,DRP\Z\Q\VT\W等', 'SCHEMA', 'dbo', 'TABLE', 'ST_STCH_B', 'COLUMN', 'CHCD'; +EXEC sp_addextendedproperty 'MS_Description', '采集项编号,0\1\2\3\4\5\6等', 'SCHEMA', 'dbo', 'TABLE', 'ST_STCH_B', 'COLUMN', 'CHID'; +EXEC sp_addextendedproperty 'MS_Description', '采集项名称', 'SCHEMA', 'dbo', 'TABLE', 'ST_STCH_B', 'COLUMN', 'CHNM'; +EXEC sp_addextendedproperty 'MS_Description', '是否默认采集项', 'SCHEMA', 'dbo', 'TABLE', 'ST_STCH_B', 'COLUMN', 'DEF'; +EXEC sp_addextendedproperty 'MS_Description', '计算公式 1, 5分钟时段值,2 ,1小时时段,3 一元二次方程', 'SCHEMA', 'dbo', 'TABLE', 'ST_STCH_B', 'COLUMN', 'FORMULA'; +EXEC sp_addextendedproperty 'MS_Description', '测站编码', 'SCHEMA', 'dbo', 'TABLE', 'ST_STCH_B', 'COLUMN', 'STCD'; +EXEC sp_addextendedproperty 'MS_Description', '选择公式计算时,x 的取值采集项 id', 'SCHEMA', 'dbo', 'TABLE', 'ST_STCH_B', 'COLUMN', 'XID'; diff --git a/src/main/resources/sql/HYD_RI_WQAMD_W.sql b/src/main/resources/sql/ST_WATER_QUALITY_R.sql similarity index 100% rename from src/main/resources/sql/HYD_RI_WQAMD_W.sql rename to src/main/resources/sql/ST_WATER_QUALITY_R.sql