Jelajahi Sumber

任务提交 站点信息和站点配置接口已完成

qinguocai 1 tahun lalu
induk
melakukan
547671b93d

+ 134 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/SiteConfig.java

@@ -0,0 +1,134 @@
+package com.ruoyi.system.domain;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 站点配置信息(SiteConfig)实体类
+ *
+ * @author makejava
+ * @since 2024-04-09 14:14:59
+ */
+@Data
+public class SiteConfig implements Serializable {
+    private static final long serialVersionUID = -73282986174314967L;
+/**
+     * 配置ID
+     */
+    private Long configId;
+/**
+     * 站点ID
+     */
+    private Long siteId;
+/**
+     * 设备类型,0:移动测流;1:固定测流
+     */
+    private Integer type;
+/**
+     * 站码
+     */
+    private String id;
+/**
+     * 左岸右岸标记(0为右岸,1为左岸)
+     */
+    private Integer local;
+/**
+     * 小车位置的偏移量
+     */
+    private Double offset;
+/**
+     * 小车测流停泊时间 s
+     */
+    private Long stoptime;
+/**
+     * 水位采集时间间隔 s
+     */
+    private Long wltime;
+/**
+     * 低、中、高 行驶速度,1,2,3
+     */
+    private Integer speed;
+/**
+     * 测流的最低水位
+     */
+    private Double wlevelmin;
+/**
+     * 测流的最高水位
+     */
+    private Double wlevelmax;
+/**
+     * 测流低电量保护(百分比)
+     */
+    private Long eqmin;
+/**
+     * 水位基值
+     */
+    private Double wbaselevel;
+/**
+     * 水位计485从机地址
+     */
+    private Long wladdr;
+/**
+     * 水位计数据类型,0为int型1为float型
+     */
+    private Integer wltype;
+/**
+     * 水位计存储首地址
+     */
+    private Long wlfirstadd;
+/**
+     * 水位计缩放精度
+     */
+    private Long wlzoom;
+/**
+     * 水位计数据长度
+     */
+    private Long wllength;
+/**
+     * 水位计度量单位 0cm  1m
+     */
+    private Integer wlunit;
+/**
+     * 水位计偏移量
+     */
+    private Long wloffset;
+/**
+     * 水位修正系数,为1时不修正
+     */
+    private Double wlfactor;
+/**
+     * 流速仪485从机地址
+     */
+    private Long wsaddr;
+/**
+     * 流速仪数据类型,0为int型1为float型
+     */
+    private Integer wstype;
+/**
+     * 流速仪存储首地址
+     */
+    private Long wsfirstadd;
+/**
+     * 流速仪缩放精度
+     */
+    private Long wszoom;
+/**
+     * 流速仪数据长度
+     */
+    private Long wslength;
+/**
+     * 流速仪度量单位 0cm  1m
+     */
+    private Integer wsunit;
+/**
+     * 流速仪偏移量
+     */
+    private Long wsoffset;
+/**
+     * 流速修正系数,为1时不修正
+     */
+    private Double wsfactor;
+
+}
+

+ 161 - 0
ruoyi-system/src/main/java/com/ruoyi/system/dto/SiteConfigDTO.java

@@ -0,0 +1,161 @@
+package com.ruoyi.system.dto;
+
+import lombok.Data;
+import lombok.NonNull;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * 站点配置信息(SiteConfig)实体类
+ *
+ * @author makejava
+ * @since 2024-04-09 14:14:59
+ */
+@Data
+public class SiteConfigDTO implements Serializable {
+
+/**
+     * 站点ID
+     */
+    @NotNull(message = "站点ID不能为空")
+    private Long siteId;
+/**
+     * 设备类型,0:移动测流;1:固定测流
+     */
+    @NotNull(message = "设备类型不能为空")
+    private Integer type;
+/**
+     * 站码
+     */
+    @NotBlank(message = "站码不能为空")
+    private String id;
+/**
+     * 左岸右岸标记(0为右岸,1为左岸)
+     */
+    @NotNull(message = "左岸右岸标记不能为空")
+    private Integer local;
+/**
+     * 小车位置的偏移量
+     */
+    @NotNull(message = "小车位置的偏移量不能为空")
+    private Double offset;
+/**
+     * 小车测流停泊时间 s
+     */
+    @NotNull(message = "小车测流停泊时间不能为空")
+    private Long stoptime;
+/**
+     * 水位采集时间间隔 s
+     */
+    @NotNull(message = "水位采集时间间隔不能为空")
+    private Long wltime;
+/**
+     * 低、中、高 行驶速度,1,2,3
+     */
+    @NotNull(message = "小车行驶速度不能为空")
+    private Integer speed;
+/**
+     * 测流的最低水位
+     */
+    @NotNull(message = "测流的最低水位不能为空")
+    private Double wlevelmin;
+/**
+     * 测流的最高水位
+     */
+    @NotNull(message = "测流的最高水位不能为空")
+    private Double wlevelmax;
+/**
+     * 测流低电量保护(百分比)
+     */
+    @NotNull(message = "测流低电量保护不能为空")
+    private Long eqmin;
+/**
+     * 水位基值
+     */
+    @NotNull(message = "水位基值不能为空")
+    private Double wbaselevel;
+/**
+     * 水位计485从机地址
+     */
+    @NotNull(message = "水位485从机地址不能为空")
+    private Long wladdr;
+/**
+     * 水位计数据类型,0为int型1为float型
+     */
+    @NotNull(message = "水位计数据类型不能为空")
+    private Integer wltype;
+/**
+     * 水位计存储首地址
+     */
+    @NotNull(message = "水位计存储首地址不能为空")
+    private Long wlfirstadd;
+/**
+     * 水位计缩放精度
+     */
+    @NotNull(message = "水位计缩放精度不能为空")
+    private Long wlzoom;
+/**
+     * 水位计数据长度
+     */
+    @NotNull(message = "水位计数据长度不能为空")
+    private Long wllength;
+/**
+     * 水位计度量单位 0cm  1m
+     */
+    @NotNull(message = "水位计度量单位不能为空")
+    private Integer wlunit;
+/**
+     * 水位计偏移量
+     */
+    @NotNull(message = "水位计偏移量不能为空")
+    private Long wloffset;
+/**
+     * 水位修正系数,为1时不修正
+     */
+    @NotNull(message = "水位修正系数不能为空")
+    private Double wlfactor;
+/**
+     * 流速仪485从机地址
+     */
+    @NotNull(message = "流速仪485从机地址不能为空")
+    private Long wsaddr;
+/**
+     * 流速仪数据类型,0为int型1为float型
+     */
+    @NotNull(message = "流速仪数据类型不能为空")
+    private Integer wstype;
+/**
+     * 流速仪存储首地址
+     */
+    @NotNull(message = "流速仪存储首地址不能为空")
+    private Long wsfirstadd;
+/**
+     * 流速仪缩放精度
+     */
+    @NotNull(message = "流速仪缩放精度不能为空")
+    private Long wszoom;
+/**
+     * 流速仪数据长度
+     */
+    @NotNull(message = "流速仪数据长度不能为空")
+    private Long wslength;
+/**
+     * 流速仪度量单位 0cm  1m
+     */
+    @NotNull(message = "流速仪度量单位不能为空")
+    private Integer wsunit;
+/**
+     * 流速仪偏移量
+     */
+    @NotNull(message = "流速仪偏移量不能为空")
+    private Long wsoffset;
+/**
+     * 流速修正系数,为1时不修正
+     */
+    @NotNull(message = "流速修正系数不能为空")
+    private Double wsfactor;
+
+}
+

+ 21 - 0
ruoyi-system/src/main/java/com/ruoyi/system/dto/SiteInfoDTO.java

@@ -1,7 +1,10 @@
 package com.ruoyi.system.dto;
 
 import lombok.Data;
+import lombok.NonNull;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 
 /**
@@ -13,54 +16,72 @@ import java.io.Serializable;
 @Data
 public class SiteInfoDTO implements Serializable {
 
+
+    /**
+     * 站点ID
+     */
+    private Long siteId;
+
     /**
      * 站码
      */
+    @NotBlank(message = "站码不能为空")
     private String id;
 
 /**
      * 站点名称
      */
+    @NotBlank(message = "站点名称不能为空")
     private String siteName;
 /**
      * 站点类型 1.流量站 
      */
+    @NotNull(message = "站点类型不能为空")
     private Integer siteType;
 /**
      * 经度
      */
+    @NotBlank(message = "经度不能为空")
     private String lon;
 /**
      * 纬度
      */
+    @NotBlank(message = "纬度不能为空")
     private String lat;
 /**
      * 年份
      */
+    @NotBlank(message = "站点年份不能为空")
     private String siteTime;
 /**
      * 行政区域
      */
+    @NotBlank(message = "站点区域不能为空")
     private String adminRegion;
 /**
      * 管理单位
      */
+    @NotBlank(message = "站点管理单位不能为空")
     private String manageUnit;
 /**
      * 所属单位
      */
+    @NotBlank(message = "站点所属单位不能为空")
     private String affiliatedUnit;
 /**
      * 联系人姓名
      */
+    @NotBlank(message = "站点联系人姓名不能为空")
     private String contactName;
 /**
      * 联系人电话
      */
+    @NotBlank(message = "站点联系人电话不能为空")
     private String contactPhone;
 /**
      * mqtt设备ID
      */
+    @NotBlank(message = "站点设备ID不能为空")
     private String deviceId;
 
 }

+ 92 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SiteConfigMapper.java

@@ -0,0 +1,92 @@
+package com.ruoyi.system.mapper;
+
+import com.ruoyi.system.domain.SiteConfig;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.data.domain.Pageable;
+import java.util.List;
+
+/**
+ * 站点配置信息(SiteConfig)表数据库访问层
+ *
+ * @author makejava
+ * @since 2024-04-09 14:14:59
+ */
+public interface SiteConfigMapper {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param configId 主键
+     * @return 实例对象
+     */
+    SiteConfig queryById(Long configId);
+
+
+    /**
+     * 通过SiteIdID查询单条数据
+     *
+     * @param SiteId 主键
+     * @return 实例对象
+     */
+    SiteConfig queryBySiteId(Long SiteId);
+
+    /**
+     * 查询指定行数据
+     *
+     * @param siteConfig 查询条件
+     * @param pageable         分页对象
+     * @return 对象列表
+     */
+    List<SiteConfig> queryAllByLimit(SiteConfig siteConfig, @Param("pageable") Pageable pageable);
+
+    /**
+     * 统计总行数
+     *
+     * @param siteConfig 查询条件
+     * @return 总行数
+     */
+    long count(SiteConfig siteConfig);
+
+    /**
+     * 新增数据
+     *
+     * @param siteConfig 实例对象
+     * @return 影响行数
+     */
+    int insert(SiteConfig siteConfig);
+
+    /**
+     * 批量新增数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<SiteConfig> 实例对象列表
+     * @return 影响行数
+     */
+    int insertBatch(@Param("entities") List<SiteConfig> entities);
+
+    /**
+     * 批量新增或按主键更新数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<SiteConfig> 实例对象列表
+     * @return 影响行数
+     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
+     */
+    int insertOrUpdateBatch(@Param("entities") List<SiteConfig> entities);
+
+    /**
+     * 修改数据
+     *
+     * @param siteConfig 实例对象
+     * @return 影响行数
+     */
+    int update(SiteConfig siteConfig);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param configId 主键
+     * @return 影响行数
+     */
+    int deleteById(Long configId);
+
+}
+

+ 10 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/SiteService.java

@@ -2,7 +2,9 @@ package com.ruoyi.system.service;
 
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.system.domain.SiteConfig;
 import com.ruoyi.system.domain.SiteInfo;
+import com.ruoyi.system.dto.SiteConfigDTO;
 import com.ruoyi.system.dto.SiteInfoDTO;
 import com.ruoyi.system.paramet.SiteInfoQuery;
 
@@ -13,8 +15,15 @@ public interface SiteService {
 
     Page<SiteInfo> query(SiteInfoQuery siteInfoQuery);
 
-    boolean update(SiteInfo siteInfo);
+    boolean update(SiteInfoDTO siteInfoDTO);
 
     boolean delete(Long id);
 
+    boolean insertConfig(SiteConfigDTO siteConfigDTO);
+
+    SiteConfig queryConfig(Long id);
+
+    boolean updateConfig(SiteConfigDTO siteConfigDTO);
+
+
 }

+ 81 - 87
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SiteServiceImpl.java

@@ -3,13 +3,15 @@ package com.ruoyi.system.service.impl;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.exception.base.BaseException;
+import com.ruoyi.system.domain.SiteConfig;
 import com.ruoyi.system.domain.SiteInfo;
+import com.ruoyi.system.dto.SiteConfigDTO;
 import com.ruoyi.system.dto.SiteInfoDTO;
+import com.ruoyi.system.mapper.SiteConfigMapper;
 import com.ruoyi.system.mapper.SiteInfoMapper;
 import com.ruoyi.system.paramet.SiteInfoQuery;
 import com.ruoyi.system.service.SiteService;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.logging.log4j.util.Strings;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -27,61 +29,24 @@ public class SiteServiceImpl implements SiteService {
 
     @Resource
     private SiteInfoMapper siteInfoMapper;
+
+    @Resource
+    private SiteConfigMapper siteConfigMapper;
+
     @Transactional(rollbackFor = Exception.class)
     @Override
     public boolean insert(SiteInfoDTO siteInfoDTO) {
         try {
-            //判断参数
-            if (Strings.isBlank(siteInfoDTO.getSiteName())){
-                throw new BaseException("站点名不能为空");
-            }
-            if (Strings.isBlank(siteInfoDTO.getSiteTime())){
-                throw new BaseException("站点时间不能为空");
-            }
-            if (Strings.isBlank(siteInfoDTO.getContactName())){
-                throw new BaseException("联系人不能为空");
-            }
-            if (Strings.isBlank(siteInfoDTO.getContactPhone())){
-                throw new BaseException("联系电话不能为空");
-            }
-            if (Strings.isBlank(siteInfoDTO.getAdminRegion())){
-                throw new BaseException("行政区域不能为空");
-            }
-            if (Strings.isBlank(siteInfoDTO.getManageUnit())){
-                throw new BaseException("管理单位不能为空");
-            }
-            if (Strings.isBlank(siteInfoDTO.getAffiliatedUnit()))
-            {
-                throw new BaseException("所属单位不能为空");
-            }
-            if (siteInfoDTO.getSiteType() == null){
-                throw new BaseException("站点类型不能为空");
-            }
-            if (Strings.isBlank(siteInfoDTO.getDeviceId())){
-                throw new BaseException("设备id不能为空");
-            }
-            if (Strings.isBlank(siteInfoDTO.getLon())){
-                throw new BaseException("经度不能为空");
-            }
-            if (Strings.isBlank(siteInfoDTO.getLat())){
-                throw new BaseException("纬度不能为空");
-            }
-            if (Strings.isBlank(siteInfoDTO.getId())){
-                throw new BaseException("站码不能为空");
-            }
             SiteInfo siteInfo = new SiteInfo();
             BeanUtils.copyProperties(siteInfoDTO, siteInfo);
             siteInfo.setSiteId(0L);
             siteInfo.setCreatTime(new Date());
             siteInfo.setIsDel(0);
             return siteInfoMapper.insert(siteInfo) > 0;
-        } catch (BaseException e){
-            throw new BaseException(e.getMessage());
         } catch (Exception e){
             log.error("新增站点错误", e);
             throw new BaseException("新增站点错误");
         }
-
     }
 
     @Override
@@ -102,55 +67,24 @@ public class SiteServiceImpl implements SiteService {
 
     @Transactional(rollbackFor = Exception.class)
     @Override
-    public boolean update(SiteInfo siteInfo) {
+    public boolean update(SiteInfoDTO siteInfoDTO) {
         try {
-            //判断参数
-            if (siteInfo.getId() == null){
-                throw new BaseException("站点ID不能为空");
-            }
-            if (Strings.isBlank(siteInfo.getSiteName())){
-                throw new BaseException("站点名不能为空");
-            }
-            if (Strings.isBlank(siteInfo.getSiteTime())){
-                throw new BaseException("站点时间不能为空");
-            }
-            if (Strings.isBlank(siteInfo.getContactName())){
-                throw new BaseException("联系人不能为空");
-            }
-            if (Strings.isBlank(siteInfo.getContactPhone())){
-                throw new BaseException("联系电话不能为空");
-            }
-            if (Strings.isBlank(siteInfo.getAdminRegion())){
-                throw new BaseException("行政区域不能为空");
-            }
-            if (Strings.isBlank(siteInfo.getManageUnit())){
-                throw new BaseException("管理单位不能为空");
-            }
-            if (Strings.isBlank(siteInfo.getAffiliatedUnit()))
-            {
-                throw new BaseException("所属单位不能为空");
-            }
-            if (siteInfo.getSiteType() == null){
-                throw new BaseException("站点类型不能为空");
-            }
-            if (Strings.isBlank(siteInfo.getDeviceId())){
-                throw new BaseException("设备id不能为空");
-            }
-            if (Strings.isBlank(siteInfo.getLon())){
-                throw new BaseException("经度不能为空");
-            }
-            if (Strings.isBlank(siteInfo.getLat())){
-                throw new BaseException("纬度不能为空");
+            if (siteInfoDTO.getSiteId() == null) {
+                throw new BaseException("站点id不能为空");
             }
-            if (Strings.isBlank(siteInfo.getId())){
-                throw new BaseException("站码不能为空");
+            SiteInfo siteInfo;
+            siteInfo = siteInfoMapper.queryById(siteInfoDTO.getSiteId());
+            if (siteInfo == null) {
+                throw new BaseException("站点id不存在");
             }
-            return siteInfoMapper.insert(siteInfo) > 0;
+            siteInfo = new SiteInfo();
+            BeanUtils.copyProperties(siteInfoDTO, siteInfo);
+            return siteInfoMapper.update(siteInfo) > 0;
         } catch (BaseException e){
             throw new BaseException(e.getMessage());
         } catch (Exception e){
-            log.error("更新供应商错误", e);
-            throw new BaseException("更新供应商错误");
+            log.error("更新站点错误", e);
+            throw new BaseException("更新站点错误");
         }
     }
 
@@ -159,9 +93,69 @@ public class SiteServiceImpl implements SiteService {
         try {
             return siteInfoMapper.deleteById(SiteId) > 0;
         } catch (Exception e){
-            log.error("更新供应商错误", e);
-            throw new BaseException("更新供应商错误");
+            log.error("删除站点错误", e);
+            throw new BaseException("删除站点错误");
+        }
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public boolean insertConfig(SiteConfigDTO siteConfigDTO) {
+        try {
+            SiteConfig siteConfig;
+            siteConfig = siteConfigMapper.queryBySiteId(siteConfigDTO.getSiteId());
+            if (siteConfig != null){
+                throw new BaseException("新增失败,该站点已存在配置信息");
+            }
+            siteConfig = new SiteConfig();
+            BeanUtils.copyProperties(siteConfigDTO, siteConfig);
+            siteConfig.setConfigId(0L);
+            return siteConfigMapper.insert(siteConfig) > 0;
+            //TODO 下发MQTT消息
+        } catch (BaseException e){
+            throw new BaseException(e.getMessage());
+        } catch (Exception e){
+            log.error("更新站点信息错误", e);
+            throw new BaseException("更新站点信息错误");
+        }
+    }
+
+    @Override
+    public SiteConfig queryConfig(Long SiteId) {
+        try {
+            return siteConfigMapper.queryBySiteId(SiteId);
+        } catch (Exception e){
+            log.error("查询站点信息错误", e);
+            throw new BaseException("查询站点信息错误");
+        }
+    }
+
+
+    @Override
+    public boolean updateConfig(SiteConfigDTO siteConfigDTO) {
+        try {
+            if (siteConfigDTO.getSiteId() == null) {
+                throw new BaseException("站点id不能为空");
+            }
+            SiteConfig siteConfig;
+            siteConfig = siteConfigMapper.queryBySiteId(siteConfigDTO.getSiteId());
+            if (siteConfig == null) {
+                throw new BaseException("站点id不存在");
+            }
+            Long configId = siteConfig.getConfigId();
+            siteConfig = new SiteConfig();
+            BeanUtils.copyProperties(siteConfigDTO, siteConfig);
+            siteConfig.setConfigId(configId);
+            return siteConfigMapper.update(siteConfig) > 0;
+            //TODO 下发MQTT消息
+        } catch (BaseException e){
+            throw new BaseException(e.getMessage());
+        } catch (Exception e){
+            log.error("更新站点信息错误", e);
+            throw new BaseException("更新站点信息错误");
         }
     }
 
+
+
 }

+ 394 - 0
ruoyi-system/src/main/resources/mapper/SiteConfigMapper.xml

@@ -0,0 +1,394 @@
+<?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.ruoyi.system.mapper.SiteConfigMapper">
+
+    <resultMap type="com.ruoyi.system.domain.SiteConfig" id="SiteConfigMap">
+        <result property="configId" column="config_id" jdbcType="INTEGER"/>
+        <result property="siteId" column="site_id" jdbcType="INTEGER"/>
+        <result property="type" column="type" jdbcType="INTEGER"/>
+        <result property="id" column="id" jdbcType="VARCHAR"/>
+        <result property="local" column="local" jdbcType="INTEGER"/>
+        <result property="offset" column="offset" jdbcType="NUMERIC"/>
+        <result property="stoptime" column="stoptime" jdbcType="INTEGER"/>
+        <result property="wltime" column="wltime" jdbcType="INTEGER"/>
+        <result property="speed" column="speed" jdbcType="INTEGER"/>
+        <result property="wlevelmin" column="wlevelmin" jdbcType="NUMERIC"/>
+        <result property="wlevelmax" column="wlevelmax" jdbcType="NUMERIC"/>
+        <result property="eqmin" column="eqmin" jdbcType="INTEGER"/>
+        <result property="wbaselevel" column="wbaselevel" jdbcType="NUMERIC"/>
+        <result property="wladdr" column="wladdr" jdbcType="INTEGER"/>
+        <result property="wltype" column="wltype" jdbcType="INTEGER"/>
+        <result property="wlfirstadd" column="wlfirstadd" jdbcType="INTEGER"/>
+        <result property="wlzoom" column="wlzoom" jdbcType="INTEGER"/>
+        <result property="wllength" column="wllength" jdbcType="INTEGER"/>
+        <result property="wlunit" column="wlunit" jdbcType="INTEGER"/>
+        <result property="wloffset" column="wloffset" jdbcType="INTEGER"/>
+        <result property="wlfactor" column="wlfactor" jdbcType="NUMERIC"/>
+        <result property="wsaddr" column="wsaddr" jdbcType="INTEGER"/>
+        <result property="wstype" column="wstype" jdbcType="INTEGER"/>
+        <result property="wsfirstadd" column="wsfirstadd" jdbcType="INTEGER"/>
+        <result property="wszoom" column="wszoom" jdbcType="INTEGER"/>
+        <result property="wslength" column="wslength" jdbcType="INTEGER"/>
+        <result property="wsunit" column="wsunit" jdbcType="INTEGER"/>
+        <result property="wsoffset" column="wsoffset" jdbcType="INTEGER"/>
+        <result property="wsfactor" column="wsfactor" jdbcType="NUMERIC"/>
+    </resultMap>
+
+    <!--查询单个-->
+    <select id="queryById" resultMap="SiteConfigMap">
+        select
+config_id, site_id, type, id, local, offset, stoptime, wltime, speed, wlevelmin, wlevelmax, eqmin, wbaselevel, wladdr, wltype, wlfirstadd, wlzoom, wllength, wlunit, wloffset, wlfactor, wsaddr, wstype, wsfirstadd, wszoom, wslength, wsunit, wsoffset, wsfactor
+        from site_config
+        where config_id = #{configId}
+    </select>
+
+    <!--查询单个-->
+    <select id="queryBySiteId" resultMap="SiteConfigMap">
+        select
+            config_id, site_id, type, id, local, offset, stoptime, wltime, speed, wlevelmin, wlevelmax, eqmin, wbaselevel, wladdr, wltype, wlfirstadd, wlzoom, wllength, wlunit, wloffset, wlfactor, wsaddr, wstype, wsfirstadd, wszoom, wslength, wsunit, wsoffset, wsfactor
+        from site_config
+        where site_id = #{siteId}
+    </select>
+
+    <!--查询指定行数据-->
+    <select id="queryAllByLimit" resultMap="SiteConfigMap">
+        select
+config_id, site_id, type, id, local, offset, stoptime, wltime, speed, wlevelmin, wlevelmax, eqmin, wbaselevel, wladdr, wltype, wlfirstadd, wlzoom, wllength, wlunit, wloffset, wlfactor, wsaddr, wstype, wsfirstadd, wszoom, wslength, wsunit, wsoffset, wsfactor
+        from site_config
+        <where>
+            <if test="configId != null">
+                and config_id = #{configId}
+            </if>
+            <if test="siteId != null">
+                and site_id = #{siteId}
+            </if>
+            <if test="type != null">
+                and type = #{type}
+            </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
+            <if test="local != null">
+                and local = #{local}
+            </if>
+            <if test="offset != null">
+                and offset = #{offset}
+            </if>
+            <if test="stoptime != null">
+                and stoptime = #{stoptime}
+            </if>
+            <if test="wltime != null">
+                and wltime = #{wltime}
+            </if>
+            <if test="speed != null">
+                and speed = #{speed}
+            </if>
+            <if test="wlevelmin != null">
+                and wlevelmin = #{wlevelmin}
+            </if>
+            <if test="wlevelmax != null">
+                and wlevelmax = #{wlevelmax}
+            </if>
+            <if test="eqmin != null">
+                and eqmin = #{eqmin}
+            </if>
+            <if test="wbaselevel != null">
+                and wbaselevel = #{wbaselevel}
+            </if>
+            <if test="wladdr != null">
+                and wladdr = #{wladdr}
+            </if>
+            <if test="wltype != null">
+                and wltype = #{wltype}
+            </if>
+            <if test="wlfirstadd != null">
+                and wlfirstadd = #{wlfirstadd}
+            </if>
+            <if test="wlzoom != null">
+                and wlzoom = #{wlzoom}
+            </if>
+            <if test="wllength != null">
+                and wllength = #{wllength}
+            </if>
+            <if test="wlunit != null">
+                and wlunit = #{wlunit}
+            </if>
+            <if test="wloffset != null">
+                and wloffset = #{wloffset}
+            </if>
+            <if test="wlfactor != null">
+                and wlfactor = #{wlfactor}
+            </if>
+            <if test="wsaddr != null">
+                and wsaddr = #{wsaddr}
+            </if>
+            <if test="wstype != null">
+                and wstype = #{wstype}
+            </if>
+            <if test="wsfirstadd != null">
+                and wsfirstadd = #{wsfirstadd}
+            </if>
+            <if test="wszoom != null">
+                and wszoom = #{wszoom}
+            </if>
+            <if test="wslength != null">
+                and wslength = #{wslength}
+            </if>
+            <if test="wsunit != null">
+                and wsunit = #{wsunit}
+            </if>
+            <if test="wsoffset != null">
+                and wsoffset = #{wsoffset}
+            </if>
+            <if test="wsfactor != null">
+                and wsfactor = #{wsfactor}
+            </if>
+        </where>
+        limit #{pageable.offset}, #{pageable.pageSize}
+    </select>
+
+    <!--统计总行数-->
+    <select id="count" resultType="java.lang.Long">
+        select count(1)
+        from site_config
+        <where>
+            <if test="configId != null">
+                and config_id = #{configId}
+            </if>
+            <if test="siteId != null">
+                and site_id = #{siteId}
+            </if>
+            <if test="type != null">
+                and type = #{type}
+            </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
+            <if test="local != null">
+                and local = #{local}
+            </if>
+            <if test="offset != null">
+                and offset = #{offset}
+            </if>
+            <if test="stoptime != null">
+                and stoptime = #{stoptime}
+            </if>
+            <if test="wltime != null">
+                and wltime = #{wltime}
+            </if>
+            <if test="speed != null">
+                and speed = #{speed}
+            </if>
+            <if test="wlevelmin != null">
+                and wlevelmin = #{wlevelmin}
+            </if>
+            <if test="wlevelmax != null">
+                and wlevelmax = #{wlevelmax}
+            </if>
+            <if test="eqmin != null">
+                and eqmin = #{eqmin}
+            </if>
+            <if test="wbaselevel != null">
+                and wbaselevel = #{wbaselevel}
+            </if>
+            <if test="wladdr != null">
+                and wladdr = #{wladdr}
+            </if>
+            <if test="wltype != null">
+                and wltype = #{wltype}
+            </if>
+            <if test="wlfirstadd != null">
+                and wlfirstadd = #{wlfirstadd}
+            </if>
+            <if test="wlzoom != null">
+                and wlzoom = #{wlzoom}
+            </if>
+            <if test="wllength != null">
+                and wllength = #{wllength}
+            </if>
+            <if test="wlunit != null">
+                and wlunit = #{wlunit}
+            </if>
+            <if test="wloffset != null">
+                and wloffset = #{wloffset}
+            </if>
+            <if test="wlfactor != null">
+                and wlfactor = #{wlfactor}
+            </if>
+            <if test="wsaddr != null">
+                and wsaddr = #{wsaddr}
+            </if>
+            <if test="wstype != null">
+                and wstype = #{wstype}
+            </if>
+            <if test="wsfirstadd != null">
+                and wsfirstadd = #{wsfirstadd}
+            </if>
+            <if test="wszoom != null">
+                and wszoom = #{wszoom}
+            </if>
+            <if test="wslength != null">
+                and wslength = #{wslength}
+            </if>
+            <if test="wsunit != null">
+                and wsunit = #{wsunit}
+            </if>
+            <if test="wsoffset != null">
+                and wsoffset = #{wsoffset}
+            </if>
+            <if test="wsfactor != null">
+                and wsfactor = #{wsfactor}
+            </if>
+        </where>
+    </select>
+
+    <!--新增所有列-->
+    <insert id="insert" keyProperty="configId" useGeneratedKeys="true">
+        insert into site_config(site_id, type, id, local, offset, stoptime, wltime, speed, wlevelmin, wlevelmax, eqmin, wbaselevel, wladdr, wltype, wlfirstadd, wlzoom, wllength, wlunit, wloffset, wlfactor, wsaddr, wstype, wsfirstadd, wszoom, wslength, wsunit, wsoffset, wsfactor)
+        values (#{siteId}, #{type}, #{id}, #{local}, #{offset}, #{stoptime}, #{wltime}, #{speed}, #{wlevelmin}, #{wlevelmax}, #{eqmin}, #{wbaselevel}, #{wladdr}, #{wltype}, #{wlfirstadd}, #{wlzoom}, #{wllength}, #{wlunit}, #{wloffset}, #{wlfactor}, #{wsaddr}, #{wstype}, #{wsfirstadd}, #{wszoom}, #{wslength}, #{wsunit}, #{wsoffset}, #{wsfactor})
+    </insert>
+
+    <insert id="insertBatch" keyProperty="configId" useGeneratedKeys="true">
+        insert into site_config(site_id, type, id, local, offset, stoptime, wltime, speed, wlevelmin, wlevelmax, eqmin, wbaselevel, wladdr, wltype, wlfirstadd, wlzoom, wllength, wlunit, wloffset, wlfactor, wsaddr, wstype, wsfirstadd, wszoom, wslength, wsunit, wsoffset, wsfactor)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+        (#{entity.siteId}, #{entity.type}, #{entity.id}, #{entity.local}, #{entity.offset}, #{entity.stoptime}, #{entity.wltime}, #{entity.speed}, #{entity.wlevelmin}, #{entity.wlevelmax}, #{entity.eqmin}, #{entity.wbaselevel}, #{entity.wladdr}, #{entity.wltype}, #{entity.wlfirstadd}, #{entity.wlzoom}, #{entity.wllength}, #{entity.wlunit}, #{entity.wloffset}, #{entity.wlfactor}, #{entity.wsaddr}, #{entity.wstype}, #{entity.wsfirstadd}, #{entity.wszoom}, #{entity.wslength}, #{entity.wsunit}, #{entity.wsoffset}, #{entity.wsfactor})
+        </foreach>
+    </insert>
+
+    <insert id="insertOrUpdateBatch" keyProperty="configId" useGeneratedKeys="true">
+        insert into site_config(site_id, type, id, local, offset, stoptime, wltime, speed, wlevelmin, wlevelmax, eqmin, wbaselevel, wladdr, wltype, wlfirstadd, wlzoom, wllength, wlunit, wloffset, wlfactor, wsaddr, wstype, wsfirstadd, wszoom, wslength, wsunit, wsoffset, wsfactor)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.siteId}, #{entity.type}, #{entity.id}, #{entity.local}, #{entity.offset}, #{entity.stoptime}, #{entity.wltime}, #{entity.speed}, #{entity.wlevelmin}, #{entity.wlevelmax}, #{entity.eqmin}, #{entity.wbaselevel}, #{entity.wladdr}, #{entity.wltype}, #{entity.wlfirstadd}, #{entity.wlzoom}, #{entity.wllength}, #{entity.wlunit}, #{entity.wloffset}, #{entity.wlfactor}, #{entity.wsaddr}, #{entity.wstype}, #{entity.wsfirstadd}, #{entity.wszoom}, #{entity.wslength}, #{entity.wsunit}, #{entity.wsoffset}, #{entity.wsfactor})
+        </foreach>
+        on duplicate key update
+site_id = values(site_id),
+type = values(type),
+id = values(id),
+local = values(local),
+offset = values(offset),
+stoptime = values(stoptime),
+wltime = values(wltime),
+speed = values(speed),
+wlevelmin = values(wlevelmin),
+wlevelmax = values(wlevelmax),
+eqmin = values(eqmin),
+wbaselevel = values(wbaselevel),
+wladdr = values(wladdr),
+wltype = values(wltype),
+wlfirstadd = values(wlfirstadd),
+wlzoom = values(wlzoom),
+wllength = values(wllength),
+wlunit = values(wlunit),
+wloffset = values(wloffset),
+wlfactor = values(wlfactor),
+wsaddr = values(wsaddr),
+wstype = values(wstype),
+wsfirstadd = values(wsfirstadd),
+wszoom = values(wszoom),
+wslength = values(wslength),
+wsunit = values(wsunit),
+wsoffset = values(wsoffset),
+wsfactor = values(wsfactor)
+    </insert>
+
+    <!--通过主键修改数据-->
+    <update id="update">
+        update site_config
+        <set>
+            <if test="siteId != null">
+                site_id = #{siteId},
+            </if>
+            <if test="type != null">
+                type = #{type},
+            </if>
+            <if test="id != null and id != ''">
+                id = #{id},
+            </if>
+            <if test="local != null">
+                local = #{local},
+            </if>
+            <if test="offset != null">
+                offset = #{offset},
+            </if>
+            <if test="stoptime != null">
+                stoptime = #{stoptime},
+            </if>
+            <if test="wltime != null">
+                wltime = #{wltime},
+            </if>
+            <if test="speed != null">
+                speed = #{speed},
+            </if>
+            <if test="wlevelmin != null">
+                wlevelmin = #{wlevelmin},
+            </if>
+            <if test="wlevelmax != null">
+                wlevelmax = #{wlevelmax},
+            </if>
+            <if test="eqmin != null">
+                eqmin = #{eqmin},
+            </if>
+            <if test="wbaselevel != null">
+                wbaselevel = #{wbaselevel},
+            </if>
+            <if test="wladdr != null">
+                wladdr = #{wladdr},
+            </if>
+            <if test="wltype != null">
+                wltype = #{wltype},
+            </if>
+            <if test="wlfirstadd != null">
+                wlfirstadd = #{wlfirstadd},
+            </if>
+            <if test="wlzoom != null">
+                wlzoom = #{wlzoom},
+            </if>
+            <if test="wllength != null">
+                wllength = #{wllength},
+            </if>
+            <if test="wlunit != null">
+                wlunit = #{wlunit},
+            </if>
+            <if test="wloffset != null">
+                wloffset = #{wloffset},
+            </if>
+            <if test="wlfactor != null">
+                wlfactor = #{wlfactor},
+            </if>
+            <if test="wsaddr != null">
+                wsaddr = #{wsaddr},
+            </if>
+            <if test="wstype != null">
+                wstype = #{wstype},
+            </if>
+            <if test="wsfirstadd != null">
+                wsfirstadd = #{wsfirstadd},
+            </if>
+            <if test="wszoom != null">
+                wszoom = #{wszoom},
+            </if>
+            <if test="wslength != null">
+                wslength = #{wslength},
+            </if>
+            <if test="wsunit != null">
+                wsunit = #{wsunit},
+            </if>
+            <if test="wsoffset != null">
+                wsoffset = #{wsoffset},
+            </if>
+            <if test="wsfactor != null">
+                wsfactor = #{wsfactor},
+            </if>
+        </set>
+        where config_id = #{configId}
+    </update>
+
+    <!--通过主键删除-->
+    <delete id="deleteById">
+        delete from site_config where config_id = #{configId}
+    </delete>
+
+</mapper>
+

+ 26 - 5
waterAffairs-admin/src/main/java/com/ruoyi/web/controller/tool/SiteController.java

@@ -4,7 +4,9 @@ package com.ruoyi.web.controller.tool;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.annotation.Anonymous;
 import com.ruoyi.common.utils.R;
+import com.ruoyi.system.domain.SiteConfig;
 import com.ruoyi.system.domain.SiteInfo;
+import com.ruoyi.system.dto.SiteConfigDTO;
 import com.ruoyi.system.dto.SiteInfoDTO;
 import com.ruoyi.system.paramet.SiteInfoQuery;
 import com.ruoyi.system.service.SiteService;
@@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import javax.validation.Valid;
 
 
 /**
@@ -32,10 +35,9 @@ public class SiteController {
 
     @PostMapping(value = "/insert")
     @ApiOperation("新增站点")
-    public R<Boolean> insert(@RequestBody SiteInfoDTO siteInfoDTO)  {
+    public R<Boolean> insert(@Valid @RequestBody SiteInfoDTO siteInfoDTO)  {
         return R.ok(siteService.insert(siteInfoDTO));
     }
-
     //查询供应商
     @PostMapping(value = "/query")
     @ApiOperation("查询站点")
@@ -45,9 +47,28 @@ public class SiteController {
 
     @PostMapping(value = "/update")
     @ApiOperation("修改站点")
-    public R<Boolean> update(@RequestBody SiteInfo siteInfo) {
-        return R.ok(siteService.update(siteInfo));
+    public R<Boolean> update(@Valid @RequestBody SiteInfoDTO siteInfoDTO) {
+        return R.ok(siteService.update(siteInfoDTO));
     }
 
+
+    @PostMapping(value = "/insertConfig")
+    @ApiOperation("新增站点配置")
+    public R<Boolean> insertConfig(@Valid @RequestBody SiteConfigDTO siteConfigDTO)  {
+        return R.ok(siteService.insertConfig(siteConfigDTO));
+    }
+
+    @PostMapping(value = "/querytConfig")
+    @ApiOperation("查询站点配置")
+    public R<SiteConfig> queryConfig(Long siteId)  {
+        return R.ok(siteService.queryConfig(siteId));
+    }
+
+    @PostMapping(value = "/updateConfig")
+    @ApiOperation("修改站点配置")
+    public R<Boolean> updateConfig(@Valid @RequestBody SiteConfigDTO siteConfigDTO)  {
+        return R.ok(siteService.updateConfig(siteConfigDTO));
+    }
+
+
 }
-//参数

+ 2 - 2
waterAffairs-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java

@@ -113,9 +113,9 @@ public class SwaggerConfig
         // 用ApiInfoBuilder进行定制
         return new ApiInfoBuilder()
                 // 设置标题
-                .title("标题:若依管理系统_接口文档")
+                .title("标题:流量精算系统_接口文档")
                 // 描述
-                .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
+                .description("描述:具体包括XXX,XXX模块...")
                 // 作者信息
                 .contact(new Contact(ruoyiConfig.getName(), null, null))
                 // 版本