Merge remote-tracking branch 'origin/master'

master
Coolkid 2024-01-25 17:54:29 +08:00
commit 9bc266eda6
23 changed files with 1705 additions and 37 deletions

31
pom.xml
View File

@ -26,6 +26,16 @@
<artifactId>gunshi-modules-all</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!--
excel导出
-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
@ -49,6 +59,27 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-lib</id>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeTransitive>false</excludeTransitive>
<stripVersion>false</stripVersion>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>15</source>
<target>15</target>
</configuration>
</plugin>
</plugins>
</build>

View File

@ -50,7 +50,7 @@ public class BzProtocolInfoController {
@Operation(summary = "删除协议信息")
@GetMapping("/delete/{id}")
public R<Boolean> delete(@PathVariable String id) {
public R<Boolean> delete(@PathVariable("id") String id) {
return R.ok(dao.removeById(id));
}

View File

@ -0,0 +1,191 @@
package com.gunshi.project.xyt.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.core.result.R;
import com.gunshi.project.xyt.entity.dto.StDamDto;
import com.gunshi.project.xyt.entity.dto.StResDto;
import com.gunshi.project.xyt.entity.dto.StRvDto;
import com.gunshi.project.xyt.entity.vo.StResVo;
import com.gunshi.project.xyt.model.StDamB;
import com.gunshi.project.xyt.model.StResB;
import com.gunshi.project.xyt.model.StRvB;
import com.gunshi.project.xyt.service.EngineeringDrainageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* TODO
*
* @ClassName EngineeringDrainageController
* @Author Huang Qianxiang
* @Date 2024/1/25 11:50
*/
@Slf4j
@Tag(name = "工程及水系接口", description = "水库、河流、大坝、闸阀、量水堰基础信息")
@RestController
@RequestMapping("/EngineeringDrainage")
public class EngineeringDrainageController {
@Resource
private EngineeringDrainageService engineeringDrainageService;
@Operation(summary = "新增水库基础信息")
@PostMapping("/insertStRes")
public R<String> insertRes(@RequestBody @Validated StResDto stResDto){
engineeringDrainageService.insertStRes(stResDto);
return R.ok();
}
@Operation(summary = "更新水库的基础信息")
@PostMapping("/updateStRes")
public R<String> updateStRes(@RequestBody StResDto stResDto){
engineeringDrainageService.updateStRes(stResDto);
return R.ok();
}
@Operation(summary = "根据水库ID删除水库基本信息")
@GetMapping("/deleteStRes")
public R<String> deleteStRes(@Parameter(description = "水库ID") @RequestParam("resId") String resId){
engineeringDrainageService.deleteStRes(resId);
return R.ok();
}
@Operation(summary = "查询水库的基础信息")
@GetMapping("/queryStRes")
public R<List<StResVo>> queryStRes(){
return R.ok(engineeringDrainageService.queryStRes());
}
@Operation(summary = "根据水库代码查询水库的基础信息")
@GetMapping("/queryByResCode")
public R<StResB> queryByResCode(@Parameter(description = "水库代码") @RequestParam("resCode") String resCode){
return R.ok(engineeringDrainageService.queryByResCode(resCode));
}
@Operation(summary = "根据水库ID查询水库的基础信息")
@GetMapping("/queryByResId")
public R<StResVo> queryByResId(@Parameter(description = "水库ID") @RequestParam("resId") String resId){
return R.ok(engineeringDrainageService.queryByResId(resId));
}
@Operation(summary = "根据水库名称模糊查询水库的基础信息")
@GetMapping("/queryLikeResName")
public R<List<StResVo>> queryLikeResName(@Parameter(description = "水库名称") @RequestParam("resName") String resName){
return R.ok(engineeringDrainageService.queryLikeResName(resName));
}
@Operation(summary = "根据水库规模查询水库的基础信息")
@GetMapping("/queryByEngScal")
public R<List<StResVo>> queryByEngScal(@Parameter(description = "水库规模") @RequestParam("engScal") String engScal){
return R.ok(engineeringDrainageService.queryByEngScal(engScal));
}
@Operation(summary = "新增河流基础信息")
@PostMapping("/insertStRv")
public R<String> insertStRv(@RequestBody @Validated StRvDto stRvDto){
engineeringDrainageService.insertStRv(stRvDto);
return R.ok();
}
@Operation(summary = "更新河流的基础信息")
@PostMapping("/updateStRv")
public R<String> updateStRv(@RequestBody StRvB stRvB){
engineeringDrainageService.updateStRv(stRvB);
return R.ok();
}
@Operation(summary = "根据河流ID删除河流信息")
@GetMapping("/deleteStRv")
public R<String> deleteStRv(@Parameter(description = "河流ID") @RequestParam("rvId") String rvId){
engineeringDrainageService.deleteStRv(rvId);
return R.ok();
}
@Operation(summary = "根据河流代码查询河流的基础信息")
@GetMapping("/queryByRvCode")
public R<StRvB> queryByRvCode(@Parameter(description = "河流代码") @RequestParam("rvCode") String rvCode){
return R.ok(engineeringDrainageService.queryByRvCode(rvCode));
}
@Operation(summary = "根据河流ID查询河流的基础信息")
@GetMapping("/queryByRvId")
public R<StRvB> queryByRvId(@Parameter(description = "河流ID") @RequestParam("rvId") String rvId){
return R.ok(engineeringDrainageService.queryByRvId(rvId));
}
@Operation(summary = "分页查询河流的基础信息")
@GetMapping("/pageStRv")
public R<Page<StRvB>> pageStRv(
@Parameter(description = "当前页") @RequestParam("pageNum") Integer pageNum,
@Parameter(description = "每页显示的条数") @RequestParam("pageSize")Integer pageSize){
return R.ok(engineeringDrainageService.pageStRv(pageNum,pageSize));
}
@Operation(summary = "根据河流名称模糊查询河流信息")
@GetMapping("/queryLikeRvName")
public R<Page<StRvB>> queryLikeRvName(
@Parameter(description = "河流名称") @RequestParam("rvName")String rvName,
@Parameter(description = "当前页") @RequestParam("pageNum") Integer pageNum,
@Parameter(description = "每页显示的条数") @RequestParam("pageSize")Integer pageSize){
return R.ok(engineeringDrainageService.queryLikeRvName(rvName, pageNum, pageSize));
}
@Operation(summary = "新增大坝基础信息")
@PostMapping("/insertStDam")
public R<String> insertStDam(@RequestBody @Validated StDamDto stDamDto){
engineeringDrainageService.insertStDam(stDamDto);
return R.ok();
}
@Operation(summary = "更新大坝基础信息")
@PostMapping("/updateStDam")
public R<String> updateStDam(@RequestBody StDamB stDamB){
engineeringDrainageService.updateStDam(stDamB);
return R.ok();
}
@Operation(summary = "删除大坝基础信息")
@GetMapping("/deleteStDam")
public R<String> deleteStDam(@Parameter(description = "大坝ID") @RequestParam("damId") String damId){
engineeringDrainageService.deleteStDam(damId);
return R.ok();
}
@Operation(summary = "根据大坝ID查询大坝信息")
@GetMapping("/queryByDamId")
public R<StDamB> queryByDamId(@Parameter(description = "大坝ID") @RequestParam("damId") String damId){
return R.ok(engineeringDrainageService.queryByDamId(damId));
}
@Operation(summary = "根据大坝代码查询大坝信息")
@GetMapping("/queryByDamCode")
public R<StDamB> queryByDamCode(@Parameter(description = "大坝代码") @RequestParam("damCode") String damCode){
return R.ok(engineeringDrainageService.queryByDamCode(damCode));
}
@Operation(summary = "分页查询大坝基础信息")
@GetMapping("/pageStDam")
public R<Page<StDamB>> pageStDam(
@Parameter(description = "当前页") @RequestParam("pageNum") Integer pageNum,
@Parameter(description = "每页显示的条数") @RequestParam("pageSize")Integer pageSize){
return R.ok(engineeringDrainageService.pageStDam(pageNum,pageSize));
}
@Operation(summary = "根据大坝名称模糊查询大坝基础信息")
@GetMapping("/queryLikeDamName")
public R<Page<StDamB>> queryLikeDamName(
@Parameter(description = "大坝名称") @RequestParam("damName")String damName,
@Parameter(description = "当前页") @RequestParam("pageNum") Integer pageNum,
@Parameter(description = "每页显示的条数") @RequestParam("pageSize")Integer pageSize){
return R.ok(engineeringDrainageService.queryLikeDamName(damName,pageNum,pageSize));
}
}

View File

@ -0,0 +1,95 @@
package com.gunshi.project.xyt.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.core.result.R;
import com.gunshi.project.xyt.model.StWaterQualityR;
import com.gunshi.project.xyt.service.WaterQualityService;
import com.gunshi.project.xyt.so.WaterQualityPageSo;
import com.gunshi.project.xyt.validate.markers.QueryPage;
import com.gunshi.project.xyt.validate.markers.QueryTimeRange;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
/**
* Description:
* Created by xusan on 2024/1/23
*
* @author xusan
* @version 1.0
*/
@RestController
@Slf4j
@Tag(name = "水质整编接口-controller", description = "水质整编接口")
@Data
@RequestMapping("/waterQuality")
public class WaterQualityController {
private final WaterQualityService waterqualityService;
// @Operation(summary = "新增水质监测数据")
// @ApiResponses(value = {
// @ApiResponse(responseCode = "200",description = "成功")
// })
// @PostMapping("/add")
// public R<String> add(@RequestBody @Validated StWaterQualityR organization){
// return R.ok(waterqualityService.add(organization));
// }
//
// @Operation(summary = "更新水质监测数据")
// @ApiResponses(value = {
// @ApiResponse(responseCode = "200",description = "成功")
// })
// @PostMapping("/update")
// public R<String> update(@RequestBody @Validated StWaterQualityR organization){
// return R.ok(waterqualityService.update(organization));
// }
//
// @Operation(summary = "根据id删除水质监测数据")
// @Parameter(name = "id", description = "水质监测数据id")
// @DeleteMapping("/delete")
// public R<String> delete(@RequestParam("id") String orgCode){
// return R.ok(waterqualityService.delete(orgCode));
// }
@Operation(summary = "水质监测数据分页查询")
@PostMapping("/page")
public R<Page<StWaterQualityR>> page(
@Validated({QueryPage.class, QueryTimeRange.class}) @RequestBody
WaterQualityPageSo waterQualityPageSo
) {
return R.ok(waterqualityService.page(waterQualityPageSo));
}
@Operation(summary = "水质监测数据导出")
@GetMapping("/export")
public void export(WaterQualityPageSo waterQualityPageSo, HttpServletResponse response) {
waterqualityService.export(waterQualityPageSo, response);
}
@Operation(summary = "水质监测数据导入")
@GetMapping("/import")
public R<String> importExcel(@RequestParam("file") MultipartFile file) {
if (file.isEmpty()) {
return R.error(400, "请选择上传文件");
}
try {
return R.ok( waterqualityService.importExcel(file));
} catch (IOException e) {
return R.error(500, "文件上传失败: " + e.getMessage());
}
}
}

View File

@ -0,0 +1,34 @@
package com.gunshi.project.xyt.entity.dto;
import com.gunshi.project.xyt.model.StDamB;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* TODO
*
* @ClassName StDamDto
* @Author Huang Qianxiang
* @Date 2024/1/25 11:08
*/
@EqualsAndHashCode(callSuper = true)
@Schema(description="大坝基础信息DTO")
@Data
public class StDamDto extends StDamB {
/**
*
*/
@Schema(description="大坝代码")
@NotNull(message = "大坝代码不能为空")
private String damCode;
/**
*
*/
@Schema(description="大坝名称")
@NotNull(message = "大坝名称不能为空")
private String damName;
}

View File

@ -0,0 +1,121 @@
package com.gunshi.project.xyt.entity.dto;
import com.gunshi.project.xyt.model.StResB;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* TODO
*
* @ClassName ResDto
* @Author Huang Qianxiang
* @Date 2024/1/24 14:43
*/
@EqualsAndHashCode(callSuper = true)
@Schema(description="水库的基础信息DTO")
@Data
public class StResDto extends StResB {
/**
*
*/
@Schema(description="水库名称")
@NotNull(message = "水库名称不能为空")
private String resName;
/**
*
*/
@Schema(description="水库代码")
@NotNull(message = "水库代码不能为空")
private String resCode;
/**
*
*/
@Schema(description="行政区划编码")
@NotNull(message = "行政区化编码不能为空")
private String addvcd;
/**
*
*/
@Schema(description="经度")
@NotNull(message = "经度不能为空")
private BigDecimal lgtd;
/**
*
*/
@Schema(description="纬度")
@NotNull(message = "维度不能为空")
private BigDecimal lttd;
/**
*
*/
@Schema(description="设计洪水位")
@NotNull(message = "设计洪水位不能为空")
private BigDecimal dsfllv;
/**
*
*/
@Schema(description="校核洪水位")
@NotNull(message = "校核洪水位不能为空")
private BigDecimal chfllv;
/**
*
*/
@Schema(description="正常蓄水位")
@NotNull(message = "正常蓄水位不能为空")
private BigDecimal normWatLev;
/**
*
*/
@Schema(description="死水位")
@NotNull(message = "死水位不能为空")
private BigDecimal deadLev;
/**
*
*/
@Schema(description="总库容")
@NotNull(message = "总库容不能为空")
private BigDecimal totCap;
/**
*
*/
@Schema(description="汛限水位")
@NotNull(message = "汛限水位不能为空")
private BigDecimal flLowLimLev;
/**
*
*/
@Schema(description="集雨面积")
@NotNull(message = "集雨面积不能为空")
private BigDecimal watShedArea;
/**
* dict_id
*/
@Schema(description="水库规模 dict_id")
@NotNull(message = "水库规模不能为空")
private Long engScal;
/**
*
*/
@Schema(description = "测站编码")
@NotNull(message = "测站编码不能为空")
private String STCD;
}

View File

@ -0,0 +1,34 @@
package com.gunshi.project.xyt.entity.dto;
import com.gunshi.project.xyt.model.StRvB;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* TODO
*
* @ClassName StRvDto
* @Author Huang Qianxiang
* @Date 2024/1/25 9:28
*/
@EqualsAndHashCode(callSuper = true)
@Schema(description="河流的基础信息DTO")
@Data
public class StRvDto extends StRvB {
/**
*
*/
@Schema(description="河流代码")
@NotNull(message = "河流代码不能为空")
private String rvCode;
/**
*
*/
@Schema(description="河流名称")
@NotNull(message = "河流名称不能为空")
private String rvName;
}

View File

@ -0,0 +1,26 @@
package com.gunshi.project.xyt.entity.vo;
import com.gunshi.db.dto.PageSo;
import com.gunshi.project.xyt.model.StResB;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* TODO
*
* @ClassName StResPageSo
* @Author Huang Qianxiang
* @Date 2024/1/24 16:25
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class StResVo extends StResB {
/**
*
*/
@Schema(description = "测站编码")
private String STCD;
}

View File

@ -0,0 +1,37 @@
package com.gunshi.project.xyt.enums;
/**
*
*
* @author lyf
* @version 1.0.0
* @since 2024-01-25
*/
public enum RcvDataType {
/**
*
*/
PPTN("PPTN"),
/**
*
*/
RSVR("RSVR"),
/**
*
*/
FLOW("FLOW"),
/**
*
*/
IMG("IMG");
private final String value;
RcvDataType(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}

View File

@ -0,0 +1,16 @@
package com.gunshi.project.xyt.mapper;
import com.gunshi.db.dao.IMapper;
import com.gunshi.project.xyt.model.StWaterQualityR;
import org.apache.ibatis.annotations.Mapper;
/**
* Description:
* Created by XuSan on 2024/1/23.
*
* @author XuSan
* @version 1.0
*/
@Mapper
public interface WaterQualityMapper extends IMapper<StWaterQualityR> {
}

View File

@ -0,0 +1,24 @@
package com.gunshi.project.xyt.model;
import lombok.Data;
import java.util.Date;
/**
*
*
* @author lyf
* @version 1.0.0
* @since 2024-01-25
*/
@Data
public class RcvLogDownR {
private Long id;
private Long protocolId;
private String msg;
private Date sendTm;
private String encoded;
private String rtuid;
private String funcode;
private Long arkId;
}

View File

@ -0,0 +1,28 @@
package com.gunshi.project.xyt.model;
import lombok.Data;
import java.util.Date;
/**
*
*
* @author lyf
* @version 1.0.0
* @since 2024-01-25
*/
@Data
public class RcvLogUpR {
private Long id;
private Long protocolId;
private String originalMsg;
private Date receiveTm;
private String decoded;
private Date decodedTm;
private String rtuid;
private String funcode;
private Date observeTm;
private Integer partialSize;
private Integer partialIndex;
private Long arkId;
}

View File

@ -0,0 +1,11 @@
package com.gunshi.project.xyt.model;
/**
*
*
* @author lyf
* @version 1.0.0
* @since 2024-01-25
*/
public class StFlowR {
}

View File

@ -0,0 +1,11 @@
package com.gunshi.project.xyt.model;
/**
*
*
* @author lyf
* @version 1.0.0
* @since 2024-01-25
*/
public class StImgR {
}

View File

@ -0,0 +1,11 @@
package com.gunshi.project.xyt.model;
/**
*
*
* @author lyf
* @version 1.0.0
* @since 2024-01-25
*/
public class StPptnR {
}

View File

@ -0,0 +1,11 @@
package com.gunshi.project.xyt.model;
/**
*
*
* @author lyf
* @version 1.0.0
* @since 2024-01-25
*/
public class StRsvrR {
}

View File

@ -0,0 +1,280 @@
package com.gunshi.project.xyt.model;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* Description:
* Created by XuSan on 2024/1/23.
*
* @author XuSan
* @version 1.0
*/
/**
*
*/
@Data
@TableName(value = "ST_WATER_QUALITY_R")
@Schema(description = "水质自动监测数据表")
public class StWaterQualityR {
/**
* id
*/
@TableId(value = "ID", type = IdType.AUTO)
@Schema(description = "主键id")
@ExcelProperty("编号")
private Integer id;
/**
*
*/
@TableField(value = "STCD")
@Schema(description = "站码")
@ExcelProperty("站码")
private String stcd;
/**
*
*/
@TableField(value = "SPT")
@Schema(description = "采样时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
@ExcelProperty("采样时间")
private LocalDateTime spt;
/**
*
*/
@TableField(value = "WIMP")
@Schema(description = "水温")
@ExcelProperty("水温")
private BigDecimal wimp;
/**
* PH
*/
@TableField(value = "PH")
@Schema(description = "PH值")
@ExcelProperty("PH值")
private BigDecimal ph;
/**
*
*/
@TableField(value = "COND")
@Schema(description = "电导率")
@ExcelProperty("电导率")
private BigDecimal cond;
/**
*
*/
@TableField(value = "TURB")
@Schema(description = "浑浊度")
@ExcelProperty("浑浊度")
private BigDecimal turb;
/**
*
*/
@TableField(value = "DOX")
@Schema(description = "溶解氧")
@ExcelProperty("溶解氧")
private BigDecimal dox;
/**
*
*/
@TableField(value = "CODMN")
@Schema(description = "高锰酸钾指数")
@ExcelProperty("高锰酸钾指数")
private BigDecimal codmn;
/**
*
*/
@TableField(value = "CODCR")
@Schema(description = "化学需氧量")
@ExcelProperty("化学需氧量")
private BigDecimal codcr;
/**
*
*/
@TableField(value = "TN")
@Schema(description = "总氮")
@ExcelProperty("总氮")
private BigDecimal tn;
/**
*
*/
@TableField(value = "NH3N")
@Schema(description = "氨氮")
@ExcelProperty("氨氮")
private BigDecimal nh3N;
/**
*
*/
@TableField(value = "NO2")
@Schema(description = "亚硝酸盐氮")
@ExcelProperty("亚硝酸盐氮")
private BigDecimal no2;
/**
*
*/
@TableField(value = "NO3")
@Schema(description = "硝酸盐氮")
@ExcelProperty("硝酸盐氮")
private BigDecimal no3;
/**
*
*/
@TableField(value = "TP")
@Schema(description = "总磷")
@ExcelProperty("总磷")
private BigDecimal tp;
/**
*
*/
@TableField(value = "TOC")
@Schema(description = "总有机碳")
@ExcelProperty("总有机碳")
private BigDecimal toc;
/**
*
*/
@TableField(value = "VLPH")
@Schema(description = "挥发酚")
@ExcelProperty("挥发酚")
private BigDecimal vlph;
/**
* 绿a
*/
@TableField(value = "CHLA")
@Schema(description = "叶绿素a")
@ExcelProperty("叶绿素a")
private BigDecimal chla;
/**
*
*/
@TableField(value = "F")
@Schema(description = "氟化物")
@ExcelProperty("氟化物")
private BigDecimal f;
/**
*
*/
@TableField(value = "ARS")
@Schema(description = "砷")
@ExcelProperty("砷")
private BigDecimal ars;
/**
*
*/
@TableField(value = "HG")
@Schema(description = "汞")
@ExcelProperty("汞")
private BigDecimal hg;
/**
* ()
*/
@TableField(value = "CR6")
@Schema(description = "铬(六价)")
@ExcelProperty("铬(六价)")
private BigDecimal cr6;
/**
*
*/
@TableField(value = "CU")
@Schema(description = "铜")
@ExcelProperty("铜")
private BigDecimal cu;
/**
*
*/
@TableField(value = "PB")
@Schema(description = "铅")
@ExcelProperty("铅")
private BigDecimal pb;
/**
*
*/
@TableField(value = "CD")
@Schema(description = "镉")
@ExcelProperty("镉")
private BigDecimal cd;
/**
*
*/
@TableField(value = "ZN")
@Schema(description = "锌")
@ExcelProperty("锌")
private BigDecimal zn;
/**
*
*/
@TableField(value = "SB")
@Schema(description = "锑")
@ExcelProperty("锑")
private BigDecimal sb;
/**
* 湿
*/
@TableField(value = "HUMIDITY")
@Schema(description = "湿度")
@ExcelProperty("湿度")
private BigDecimal humidity;
/**
*
*/
@TableField(value = "ROOMTMP")
@Schema(description = "室温")
@ExcelProperty("室温")
private BigDecimal roomtmp;
/**
*
*/
@TableField(value = "CATEGORY")
@Schema(description = "水质类别")
@ExcelProperty("水质类别")
private BigDecimal category;
/**
*
*/
@TableField(value = "POLLUTER")
@Schema(description = "污染物")
@ExcelProperty("污染物")
private BigDecimal polluter;
}

View File

@ -0,0 +1,420 @@
package com.gunshi.project.xyt.service;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.project.xyt.entity.dto.StDamDto;
import com.gunshi.project.xyt.entity.dto.StResDto;
import com.gunshi.project.xyt.entity.dto.StRvDto;
import com.gunshi.project.xyt.entity.vo.StResVo;
import com.gunshi.project.xyt.model.*;
import com.gunshi.project.xyt.model.StDamBAutoDao;
import com.gunshi.project.xyt.model.StResBAutoDao;
import com.gunshi.project.xyt.model.StResStcdRefAutoDao;
import com.gunshi.project.xyt.model.StRvBAutoDao;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* TODO
*
* @ClassName EngineeringDrainageServiceImpl
* @Author Huang Qianxiang
* @Date 2024/1/24 14:38
*/
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)
public class EngineeringDrainageService {
@Resource
private StResBAutoDao stResBAutoDao;
@Resource
private StResStcdRefAutoDao stResStcdRefAutoDao;
@Resource
private StRvBAutoDao stRvBAutoDao;
@Resource
private StDamBAutoDao stDamBAutoDao;
/**
*
* @param stResDto
*/
public void insertStRes(StResDto stResDto) {
StResB stResB = new StResB();
BeanUtil.copyProperties(stResDto,stResB);
Long resId = IdWorker.getId();
stResB.setResId(resId);
stResB.setStatus(1);
Date date = new Date();
stResB.setTm(date);
//判断水库代码是否唯一
if (queryByResCode(stResDto.getResCode()) != null){
throw new IllegalArgumentException("水库代码必须唯一");
}
//保存水库基本信息
stResBAutoDao.save(stResB);
StResStcdRef stResStcdRef = new StResStcdRef();
stResStcdRef.setResId(resId);
stResStcdRef.setStcd(stResDto.getSTCD());
stResStcdRef.setTm(date);
//保存测站关系
stResStcdRefAutoDao.save(stResStcdRef);
}
/**
*
* @param stResDto
*/
public void updateStRes(StResDto stResDto) {
Long resId = stResDto.getResId();
StResB byId = stResBAutoDao.getById(resId);
if (byId == null) {
throw new IllegalArgumentException("resId:" + resId + "不存在");
}
//判断水库代码是否唯一
if (queryByResCode(stResDto.getResCode()) != null){
throw new IllegalArgumentException("水库代码必须唯一");
}
StResB stResB = new StResB();
BeanUtil.copyProperties(stResDto,stResB);
Date date = new Date();
stResB.setTm(date);
//更新水库基本信息
stResBAutoDao.updateById(stResB);
if (stResDto.getSTCD() != null){
StResStcdRef stResStcdRef = new StResStcdRef();
stResStcdRef.setResId(resId);
stResStcdRef.setStcd(stResDto.getSTCD());
stResStcdRef.setTm(date);
//更新水库测站关系
StResStcdRef byId1 = stResStcdRefAutoDao.getById(resId);
if (byId1 != null) {
//先删除之前存在的关系
stResStcdRefAutoDao.removeById(resId);
}
//更新当前水库测站关系
stResStcdRefAutoDao.save(stResStcdRef);
}
}
/**
* ID
* @param resId ID
*/
public void deleteStRes(String resId) {
QueryWrapper<StResB> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StResB.COL_RES_ID,resId)
.eq(StResB.COL_STATUS,1);
StResB byId = stResBAutoDao.getOne(queryWrapper);
if (byId == null) {
throw new IllegalArgumentException("resId:" + resId + "不存在");
}
UpdateWrapper<StResB> updateWrapper = new UpdateWrapper<>();
//水库状态更新为禁用
updateWrapper.eq(StResB.COL_RES_ID,resId)
.set(StResB.COL_STATUS,0);
stResBAutoDao.update(updateWrapper);
//删除水库测站关系
stResStcdRefAutoDao.removeById(resId);
}
/**
*
* @param resCode
* @return
*/
public StResB queryByResCode(String resCode) {
QueryWrapper<StResB> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StResB.COL_RES_CODE,resCode);
return stResBAutoDao.getOne(queryWrapper);
}
/**
* ID
* @param resId ID
* @return
*/
public StResVo queryByResId(String resId) {
StResB stResB = stResBAutoDao.getById(resId);
StResStcdRef stResStcdRef = stResStcdRefAutoDao.getById(resId);
if (stResB == null) {
throw new IllegalArgumentException("resId:" + resId + "不存在");
}
StResVo stResVo = new StResVo();
BeanUtil.copyProperties(stResB,stResVo);
stResVo.setSTCD(stResStcdRef.getStcd());
return stResVo;
}
/**
*
* @return
*/
public List<StResVo> queryStRes() {
List<StResB> stResBList = stResBAutoDao
.list(new QueryWrapper<StResB>().eq(StResB.COL_STATUS,1));
List<StResVo> stResVoList = new ArrayList<>();
stResBList.stream().forEach(stResB -> {
StResVo stResVo = new StResVo();
BeanUtil.copyProperties(stResB,stResVo);
StResStcdRef stResStcdRef = stResStcdRefAutoDao.getById(stResB.getResId());
stResVo.setSTCD(stResStcdRef.getStcd());
stResVoList.add(stResVo);
});
return stResVoList;
}
/**
*
* @param resName
* @return
*/
public List<StResVo> queryLikeResName(String resName) {
QueryWrapper<StResB> queryWrapper = new QueryWrapper<>();
queryWrapper.like(StResB.COL_RES_NAME,resName)
.eq(StResB.COL_STATUS,1);
List<StResB> stResBList = stResBAutoDao.list(queryWrapper);
List<StResVo> stResVoList = new ArrayList<>();
stResBList.stream().forEach(stResB -> {
StResVo stResVo = new StResVo();
BeanUtil.copyProperties(stResB,stResVo);
StResStcdRef stResStcdRef = stResStcdRefAutoDao.getById(stResB.getResId());
stResVo.setSTCD(stResStcdRef.getStcd());
stResVoList.add(stResVo);
});
return stResVoList;
}
/**
*
* @param engScal
* @return
*/
public List<StResVo> queryByEngScal(String engScal) {
QueryWrapper<StResB> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StResB.COL_ENG_SCAL,engScal)
.eq(StResB.COL_STATUS,1);
List<StResB> stResBList = stResBAutoDao.list(queryWrapper);
List<StResVo> stResVoList = new ArrayList<>();
stResBList.stream().forEach(stResB -> {
StResVo stResVo = new StResVo();
BeanUtil.copyProperties(stResB,stResVo);
StResStcdRef stResStcdRef = stResStcdRefAutoDao.getById(stResB.getResId());
stResVo.setSTCD(stResStcdRef.getStcd());
stResVoList.add(stResVo);
});
return stResVoList;
}
/**
*
* @param stRvDto DTO
*/
public void insertStRv(StRvDto stRvDto) {
if (queryByResCode(stRvDto.getRvCode()) != null){
throw new IllegalArgumentException("河流代码必须唯一");
}
StRvB stRvB = new StRvB();
BeanUtil.copyProperties(stRvDto,stRvB);
Long rvId = IdWorker.getId();
stRvB.setRvId(rvId);
stRvB.setStatus(1);
stRvB.setTm(new Date());
stRvBAutoDao.save(stRvB);
}
/**
*
* @param stRvB
*/
public void updateStRv(StRvB stRvB) {
Long rvId = stRvB.getRvId();
StRvB byId = stRvBAutoDao.getById(rvId);
if (byId == null){
throw new IllegalArgumentException("河流ID: " + rvId + "不存在");
}
stRvB.setTm(new Date());
stRvBAutoDao.updateById(stRvB);
}
/**
* ID
* @param rvId ID
*/
public void deleteStRv(String rvId) {
QueryWrapper<StRvB> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StRvB.COL_RV_ID,rvId)
.eq(StRvB.COL_STATUS,1);
StRvB byId = stRvBAutoDao.getOne(queryWrapper);
if (byId == null){
throw new IllegalArgumentException("河流ID: " + rvId + "不存在, 或河流ID: " + rvId + "已被禁用");
}
UpdateWrapper<StRvB> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq(StRvB.COL_RV_ID,rvId)
.set(StRvB.COL_STATUS,0);
stRvBAutoDao.update(updateWrapper);
}
/**
*
* @param rvCode
* @return
*/
public StRvB queryByRvCode(String rvCode) {
QueryWrapper<StRvB> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StRvB.COL_RV_CODE,rvCode)
.eq(StRvB.COL_STATUS,1);
return stRvBAutoDao.getOne(queryWrapper);
}
/**
* ID
* @param rvId ID
* @return
*/
public StRvB queryByRvId(String rvId) {
StRvB stRvB = stRvBAutoDao.getById(rvId);
if (stRvB == null){
throw new IllegalArgumentException("河流ID: "+ rvId +"不存在");
}
return stRvB;
}
/**
*
* @param pageNum
* @param pageSize
* @return
*/
public Page<StRvB> pageStRv(int pageNum,int pageSize) {
QueryWrapper<StRvB> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StRvB.COL_STATUS,1);
return stRvBAutoDao.page(new Page<>(pageNum,pageSize),queryWrapper);
}
/**
*
* @param rvName
* @param pageNum
* @param pageSize
* @return
*/
public Page<StRvB> queryLikeRvName(String rvName,int pageNum,int pageSize) {
QueryWrapper<StRvB> queryWrapper = new QueryWrapper<>();
queryWrapper.like(StRvB.COL_RV_NAME,rvName)
.eq(StRvB.COL_STATUS,1);
return stRvBAutoDao.page(new Page<>(pageNum,pageSize),queryWrapper);
}
/**
*
* @param stDamDto DTO
*/
public void insertStDam(StDamDto stDamDto) {
if (queryByDamCode(stDamDto.getDamCode()) != null){
throw new IllegalArgumentException("大坝代码必须唯一");
}
StDamB stDamB = new StDamB();
BeanUtil.copyProperties(stDamDto,stDamB);
Long damId = IdWorker.getId();
stDamB.setDamId(damId);
stDamB.setStatus(1);
stDamB.setTm(new Date());
stDamBAutoDao.save(stDamB);
}
/**
*
* @param stDamB
*/
public void updateStDam(StDamB stDamB) {
Long damId = stDamB.getDamId();
StDamB byId = stDamBAutoDao.getById(damId);
if (byId == null){
throw new IllegalArgumentException("大坝ID: " + damId + "不存在");
}
stDamB.setTm(new Date());
stDamBAutoDao.updateById(stDamB);
}
/**
*
* @param damId ID
*/
public void deleteStDam(String damId) {
StDamB byId = stDamBAutoDao.getById(damId);
if (byId == null){
throw new IllegalArgumentException("大坝ID: " + damId + "不存在");
}
UpdateWrapper<StDamB> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq(StDamB.COL_DAM_ID,damId)
.set(StDamB.COL_STATUS,0);
stDamBAutoDao.update(updateWrapper);
}
/**
* ID
* @param damId ID
* @return
*/
public StDamB queryByDamId(String damId) {
StDamB stDamB = stDamBAutoDao.getById(damId);
if (stDamB == null){
throw new IllegalArgumentException("大坝ID: " + damId+ "不存在");
}
return stDamB;
}
/**
*
* @param damCode
* @return
*/
public StDamB queryByDamCode(String damCode) {
QueryWrapper<StDamB> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StDamB.COL_DAM_CODE,damCode)
.eq(StDamB.COL_STATUS,1);
return stDamBAutoDao.getOne(queryWrapper);
}
/**
*
* @param pageNum
* @param pageSize
* @return
*/
public Page<StDamB> pageStDam(int pageNum, int pageSize) {
QueryWrapper<StDamB> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StDamB.COL_STATUS,1);
return stDamBAutoDao.page(new Page<>(pageNum,pageSize),queryWrapper);
}
/**
*
* @param damName
* @param pageNum
* @param pageSize
* @return
*/
public Page<StDamB> queryLikeDamName(String damName, int pageNum, int pageSize) {
QueryWrapper<StDamB> queryWrapper = new QueryWrapper<>();
queryWrapper.like(StDamB.COL_DAM_NAME,damName)
.eq(StDamB.COL_STATUS,1);
return stDamBAutoDao.page(new Page<>(pageNum,pageSize),queryWrapper);
}
}

View File

@ -0,0 +1,34 @@
package com.gunshi.project.xyt.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.project.xyt.model.StWaterQualityR;
import com.gunshi.project.xyt.so.WaterQualityPageSo;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
/**
* Description:
* Created by xusan on 2024/1/23
*
* @author xusan
* @version 1.0
*/
public interface WaterQualityService {
Page<StWaterQualityR> page(WaterQualityPageSo waterQualityPageSo);
void export(WaterQualityPageSo waterQualityPageSo, HttpServletResponse response);
String importExcel(MultipartFile file) throws IOException;
String add(StWaterQualityR stWaterQualityR);
String addList(List<StWaterQualityR> stWaterQualityRList);
String update(StWaterQualityR StWaterQualityR);
String delete(String id);
}

View File

@ -0,0 +1,173 @@
package com.gunshi.project.xyt.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.read.listener.PageReadListener;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.core.dateformat.DateFormatString;
import com.gunshi.db.dao.BaseOrderDao;
import com.gunshi.project.xyt.mapper.WaterQualityMapper;
import com.gunshi.project.xyt.model.StWaterQualityR;
import com.gunshi.project.xyt.service.WaterQualityService;
import com.gunshi.project.xyt.so.WaterQualityPageSo;
import jakarta.servlet.http.HttpServletResponse;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
/**
* Description:
* Created by xusan on 2023/1/23.
*
* @author xusan
* @version 1.0
*/
@EqualsAndHashCode(callSuper = true)
@Service
@Data
@Transactional(rollbackFor = Exception.class)
@Slf4j
public class WaterQualityServiceImpl extends BaseOrderDao<WaterQualityMapper, StWaterQualityR> implements WaterQualityService {
/**
*
*
* @param so
*/
@Override
public Page<StWaterQualityR> page(WaterQualityPageSo so) {
LambdaQueryWrapper<StWaterQualityR> query = Wrappers.lambdaQuery();
if (so.getStm() != null) {
query.ge(StWaterQualityR::getSpt, so.getStm());
}
if (so.getEtm() != null) {
query.le(StWaterQualityR::getSpt, so.getEtm());
}
return super.page(so.toPage(), query);
}
/**
*
*
* @param so
*/
@Override
public void export(WaterQualityPageSo so , HttpServletResponse response) {
// 获取基础数据
Page<StWaterQualityR> page = page(so);
// 生成文件名
String fileName = "水质统计表 "
+ DateFormatUtils.format(so.getStm(), DateFormatString.YYYY_MM_DD_HH_MM_SS)
+ "至"
+ DateFormatUtils.format(so.getEtm(), DateFormatString.YYYY_MM_DD_HH_MM_SS)
+ ".xlsx";
// String tempPath = System.getProperty("java.io.tmpdir") + IdUtil.fastSimpleUUID() + ".xlsx";
// String tempPath = System.getProperty("java.io.tmpdir") + fileName + ".xlsx";
// File file = new File(tempPath);
//
// // 指定模板文件
// ExcelWriter excelWriter = EasyExcel.write(file, StWaterQualityR.class).build();
//
// WriteSheet writeSheet = EasyExcel.writerSheet(1, "水质").build();
// // 分页去数据库查询数据 这里可以去数据库查询每一页的数据
// List<StWaterQualityR> data = page.getRecords();
// excelWriter.write(data, writeSheet);
//
// // 千万别忘记finish 会帮忙关闭流
// excelWriter.finish();
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
// 这里URLEncoder.encode可以防止中文乱码
response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(fileName, StandardCharsets.UTF_8));
// 数据输出
try {
EasyExcel.write(response.getOutputStream(), StWaterQualityR.class).sheet("水质").doWrite(page.getRecords());
} catch (IOException e) {
log.error("水质文件下载失败, " + e.getMessage(),e);
throw new RuntimeException(e);
}
}
@Override
public String importExcel(MultipartFile file) throws IOException {
// 创建一个用于存储数据的List
List<StWaterQualityR> data = new ArrayList<>();
EasyExcel.read(file.getInputStream(), StWaterQualityR.class, new PageReadListener<StWaterQualityR>(data::addAll)).sheet().doRead();
for (StWaterQualityR o : data) {
o.setId(null);
}
return this.addList(data);
}
/**
*
*
* @param o
*/
@Override
public String add(StWaterQualityR o) {
return this.save(o) ? "成功":"失败";
}
@Override
public String addList(List<StWaterQualityR> stWaterQualityRList) {
try {
for (StWaterQualityR o : stWaterQualityRList) {
this.add(o);
}
}catch (Exception e) {
return "失败";
}
return "成功";
// return this.saveBatch(stWaterQualityRList) ? "成功":"失败";
}
/**
*
*
* @param o
*/
@Override
public String update(StWaterQualityR o) {
return this.updateById(o) ? "成功":"失败";
}
/**
*
*
* @param id id
*/
@Override
public String delete(String id) {
return this.removeById(id) ? "成功":"失败";
}
}

View File

@ -0,0 +1,36 @@
package com.gunshi.project.xyt.so;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gunshi.core.dateformat.DateFormatString;
import com.gunshi.db.dto.PageSo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* Description:
* Created by XuSan on 2024/1/23.
*
* @author XuSan
* @version 1.0
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class WaterQualityPageSo extends PageSo {
@Schema(description = "查询开始时间", pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS,
example = DateFormatString.YYYY_MM_DD_HH_MM_SS_EXAMPLE)
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
@DateTimeFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS)
private Date stm;
@Schema(description = "查询结束时间", pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS,
example = DateFormatString.YYYY_MM_DD_HH_MM_SS_EXAMPLE)
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
@DateTimeFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS)
private Date etm;
}

View File

@ -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.WaterQualityMapper">
</mapper>

View File

@ -1,40 +1,76 @@
CREATE TABLE [xyt].[HYD_RI_WQAMD_W]
(
[STCD] CHAR(14) NOT NULL,
[SPT] DATETIME2(6) NOT NULL,
[WIMP] DECIMAL(4,2),
[PH] DECIMAL(4,2),
[COND] DECIMAL(6,0),
[TURB] DECIMAL(3,0),
[DOX] DECIMAL(4,2),
[CODMN] DECIMAL(6,1),
[CODCR] DECIMAL(7,1),
[TN] DECIMAL(6,3),
[NH3N] DECIMAL(6,3),
[NO2] DECIMAL(5,3),
[NO3] DECIMAL(5,3),
[TP] DECIMAL(8,3),
[TOC] DECIMAL(4,1),
[VLPH] DECIMAL(10,6),
[CHLA] DECIMAL(6,4),
[F] DECIMAL(5,2),
[ARS] DECIMAL(8,6),
[HG] DECIMAL(9,7),
[CR6] DECIMAL(5,3),
[CU] DECIMAL(7,5),
[PB] DECIMAL(7,5),
[CD] DECIMAL(7,5),
[ZN] DECIMAL(6,4),
[SB] DECIMAL(7,5),
[HUMIDITY] DECIMAL(4,2),
[ROOMTMP] DECIMAL(4,2),
[ID] INT IDENTITY(1, 1) NOT NULL,
CONSTRAINT [PK_HYD_RI_WQAMD_W] PRIMARY KEY CLUSTERED ([ID]),
CONSTRAINT [UQ_HYD_RI_WQAMD_W_ID] UNIQUE ([ID]),
CONSTRAINT [UQ_HYD_RI_WQAMD_W_STCD_SPT] UNIQUE ([STCD], [SPT])
) ON [MAIN] WITH (DATA_COMPRESSION = CLUSTERED COLUMNSTORE);
# CREATE TABLE [xyt].[HYD_RI_WQAMD_W]
# (
# [STCD] CHAR(14) NOT NULL,
# [SPT] DATETIME2(6) NOT NULL,
# [WIMP] DECIMAL(4,2),
# [PH] DECIMAL(4,2),
# [COND] DECIMAL(6,0),
# [TURB] DECIMAL(3,0),
# [DOX] DECIMAL(4,2),
# [CODMN] DECIMAL(6,1),
# [CODCR] DECIMAL(7,1),
# [TN] DECIMAL(6,3),
# [NH3N] DECIMAL(6,3),
# [NO2] DECIMAL(5,3),
# [NO3] DECIMAL(5,3),
# [TP] DECIMAL(8,3),
# [TOC] DECIMAL(4,1),
# [VLPH] DECIMAL(10,6),
# [CHLA] DECIMAL(6,4),
# [F] DECIMAL(5,2),
# [ARS] DECIMAL(8,6),
# [HG] DECIMAL(9,7),
# [CR6] DECIMAL(5,3),
# [CU] DECIMAL(7,5),
# [PB] DECIMAL(7,5),
# [CD] DECIMAL(7,5),
# [ZN] DECIMAL(6,4),
# [SB] DECIMAL(7,5),
# [HUMIDITY] DECIMAL(4,2),
# [ROOMTMP] DECIMAL(4,2),
# [ID] INT IDENTITY(1, 1) NOT NULL,
# CONSTRAINT [PK_HYD_RI_WQAMD_W] PRIMARY KEY CLUSTERED ([ID]),
# CONSTRAINT [UQ_HYD_RI_WQAMD_W_ID] UNIQUE ([ID]),
# CONSTRAINT [UQ_HYD_RI_WQAMD_W_STCD_SPT] UNIQUE ([STCD], [SPT])
# ) ON [MAIN] WITH (DATA_COMPRESSION = CLUSTERED COLUMNSTORE);
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'水质自动监测数据' , @level0type=N'SCHEMA',@level0name=N'xyt', @level1type=N'TABLE',@level1name=N'HYD_RI_WQAMD_W';
CREATE TABLE [HYD_RI_WQAMD_W]
(
[STCD] VARCHAR(14) NOT NULL,
[SPT] DATETIME2(6) NOT NULL,
[WIMP] DECIMAL(4,2),
[PH] DECIMAL(4,2),
[COND] DECIMAL(6,0),
[TURB] DECIMAL(3,0),
[DOX] DECIMAL(4,2),
[CODMN] DECIMAL(6,1),
[CODCR] DECIMAL(7,1),
[TN] DECIMAL(6,3),
[NH3N] DECIMAL(6,3),
[NO2] DECIMAL(5,3),
[NO3] DECIMAL(5,3),
[TP] DECIMAL(8,3),
[TOC] DECIMAL(4,1),
[VLPH] DECIMAL(10,6),
[CHLA] DECIMAL(6,4),
[F] DECIMAL(5,2),
[ARS] DECIMAL(8,6),
[HG] DECIMAL(9,7),
[CR6] DECIMAL(5,3),
[CU] DECIMAL(7,5),
[PB] DECIMAL(7,5),
[CD] DECIMAL(7,5),
[ZN] DECIMAL(6,4),
[SB] DECIMAL(7,5),
[HUMIDITY] DECIMAL(4,2),
[ROOMTMP] DECIMAL(4,2),
[ID] INT IDENTITY(1, 1) NOT NULL,
CONSTRAINT [PK_HYD_RI_WQAMD_W] PRIMARY KEY CLUSTERED ([ID]),
CONSTRAINT [UQ_HYD_RI_WQAMD_W_ID] UNIQUE ([ID]),
CONSTRAINT [UQ_HYD_RI_WQAMD_W_STCD_SPT] UNIQUE ([STCD], [SPT])
)
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'水质自动监测数据' , @level0type=N'SCHEMA',@level0name=N'xyt', @level1type=N'TABLE',@level1name=N'HYD_RI_WQAMD_W';
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'xyt', @level1type=N'TABLE',@level1name=N'HYD_RI_WQAMD_W', @level2type=N'COLUMN',@level2name=N'ARS';
@ -93,3 +129,6 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'水温' , @lev
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'xyt', @level1type=N'TABLE',@level1name=N'HYD_RI_WQAMD_W', @level2type=N'COLUMN',@level2name=N'ZN';
CREATE INDEX [IX_HYD_RI_WQAMD_W_STCD_SPT] ON [xyt].[HYD_RI_WQAMD_W] ([STCD] ASC, [SPT] ASC) ON [MAIN] WITH (DATA_COMPRESSION = CLUSTERED COLUMNSTORE);
SET IDENTITY_INSERT ST_WATER_QUALITY_R ON;