测站采集项新增,修改,删除和查询接口开发
parent
9b3f08be66
commit
4c0d44d179
|
|
@ -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<Boolean> insertStch(@RequestBody @Validated StStchB stStchB) {
|
||||
return R.ok(stStchBService.insert(stStchB));
|
||||
}
|
||||
|
||||
@Get(path ="/stcd/stch/del/{id}", summary = "测站采集项删除")
|
||||
public R<Boolean> delStch(@Schema(description="测站采集项id") @PathVariable("id") Integer id) {
|
||||
return R.ok(stStchBService.removeById(id));
|
||||
}
|
||||
|
||||
@Post(path ="/stcd/stch/update", summary = "测站采集项修改")
|
||||
public R<Boolean> updateStch(@RequestBody @Validated StStchB bean) {
|
||||
return R.ok(stStchBService.update(bean));
|
||||
}
|
||||
|
||||
@Post(path = "/stcd/stch/page", summary = "测站采集项分页查询")
|
||||
public R<IPage<StStchB>> PageStch(@RequestBody StStchBSo findDto) {
|
||||
return R.ok(stStchBService.page(findDto));
|
||||
}
|
||||
|
||||
|
||||
@Post(path = "/monct/manage/insert", summary = "新增监测断面接口")
|
||||
public R<Boolean> insertMonCr(@Validated @RequestBody StMoncrB obj) {
|
||||
stMoncrService.insert(obj);
|
||||
|
|
|
|||
|
|
@ -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<String> chcds;
|
||||
}
|
||||
|
|
@ -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<StStchB>, IMapper<StStchB> {
|
||||
/**
|
||||
* 返回所有
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<StStchB> queryBySearch(@Param("obj") StStchBDto findDto);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page
|
||||
* @param findDto
|
||||
* @return
|
||||
*/
|
||||
IPage<StStchB> queryBySearch(@Param("page") IPage<StStchB> page, @Param("obj") StStchBSo findDto);
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -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<StStchBMapper, StStchB> {
|
||||
|
||||
|
||||
@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<StStchB> page(StStchBSo so) {
|
||||
|
||||
LambdaQueryWrapper<StStchB> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?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.gunshi.project.xyt.mapper.StStchBMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -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';
|
||||
Loading…
Reference in New Issue