Browse Source

任务提交 增加时间策略接口

qinguocai 1 year ago
parent
commit
b2c38e03b2

+ 5 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/BerthingPoint.java

@@ -53,5 +53,10 @@ public class BerthingPoint implements Serializable {
      */
     private String factors;
 
+    /**
+     * 站点名称
+     */
+    private String siteName;
+
 }
 

+ 8 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/BerthingPointConfig.java

@@ -2,6 +2,8 @@ package com.ruoyi.system.domain;
 
 import java.util.Date;
 import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 /**
@@ -40,6 +42,7 @@ public class BerthingPointConfig implements Serializable {
 /**
      * 创建时间
      */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date createTime;
 /**
      * 状态 0:无效 1.有效 
@@ -58,5 +61,10 @@ public class BerthingPointConfig implements Serializable {
      */
     private String factors;
 
+    /**
+     * 站点名称
+     */
+    private String siteName;
+
 }
 

+ 66 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/BerthingTimeConfig.java

@@ -0,0 +1,66 @@
+package com.ruoyi.system.domain;
+
+import java.util.Date;
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+/**
+ * 停泊点策略时间配置(BerthingTimeConfig)实体类
+ *
+ * @author makejava
+ * @since 2024-04-16 15:23:49
+ */
+@Data
+public class BerthingTimeConfig implements Serializable {
+    private static final long serialVersionUID = 206251015677523945L;
+/**
+     * 测流计划ID
+     */
+    private Long timeId;
+/**
+     * 站码
+     */
+    private String id;
+/**
+     * 站点ID
+     */
+    private Long siteId;
+/**
+     * 策略编号
+     */
+    private Long planid;
+/**
+     * 创建时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+/**
+     * 状态 0:无效 1.有效 
+     */
+    private Integer status;
+/**
+     * 是否删除
+     */
+    private Integer isDel;
+/**
+     * 起测水位
+     */
+    private Double wlevel;
+/**
+     * 时间数组 json 例子:[“18:00”,“19:00”]
+     */
+    private String times;
+/**
+     * 设备类型,0:移动测流;1:固定测流
+     */
+    private Integer type;
+
+    /**
+     * 站点名称
+     */
+    private String siteName;
+
+}
+

+ 53 - 0
ruoyi-system/src/main/java/com/ruoyi/system/dto/BerthingTimeDTO.java

@@ -0,0 +1,53 @@
+package com.ruoyi.system.dto;
+
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.ArrayList;
+
+
+/**
+ * 停泊点策略时间配置(BerthingTimeConfig)实体类
+ *
+ * @author makejava
+ * @since 2024-04-16 15:23:49
+ */
+@Data
+public class BerthingTimeDTO implements Serializable {
+
+/**
+     * 测流计划ID
+     */
+    private Long timeId;
+/**
+     * 站点ID
+     */
+    @NotNull(message = "站点ID不能为空")
+    private Long siteId;
+/**
+     * 策略编号
+     */
+    @NotNull(message = "策略编号不能为空")
+    private Long planid;
+/**
+     * 起测水位
+     */
+    @NotNull(message = "起测水位不能为空")
+    private Double wlevel;
+/**
+     * 时间数组 json 例子:[“18:00”,“19:00”]
+     */
+    @NotEmpty(message = "时间数组不能为空")
+    private ArrayList<String> times;
+/**
+     * 设备类型,0:移动测流;1:固定测流
+     */
+    @NotNull(message = "设备类型不能为空")
+    private Integer type;
+
+}
+

+ 5 - 4
ruoyi-system/src/main/java/com/ruoyi/system/mapper/BerthingPointConfigMapper.java

@@ -1,8 +1,9 @@
 package com.ruoyi.system.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.system.domain.BerthingPointConfig;
+import com.ruoyi.system.paramet.StopPointQuery;
 import org.apache.ibatis.annotations.Param;
-import org.springframework.data.domain.Pageable;
 import java.util.List;
 
 /**
@@ -24,11 +25,11 @@ public interface BerthingPointConfigMapper {
     /**
      * 查询指定行数据
      *
-     * @param berthingPointConfig 查询条件
-     * @param pageable         分页对象
+     * @param stopPointQuery 查询条件
+     * @param page         分页对象
      * @return 对象列表
      */
-    List<BerthingPointConfig> queryAllByLimit(BerthingPointConfig berthingPointConfig, @Param("pageable") Pageable pageable);
+    Page<BerthingPointConfig> queryAllByLimit(@Param("stopPointQuery") StopPointQuery stopPointQuery , Page page);
 
     /**
      * 统计总行数

+ 86 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/BerthingTimeConfigMapper.java

@@ -0,0 +1,86 @@
+package com.ruoyi.system.mapper;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.system.domain.BerthingTimeConfig;
+import com.ruoyi.system.paramet.StopPointQuery;
+import com.ruoyi.system.paramet.TimePointQuery;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.data.domain.Pageable;
+import java.util.List;
+
+/**
+ * 停泊点策略时间配置(BerthingTimeConfig)表数据库访问层
+ *
+ * @author makejava
+ * @since 2024-04-16 15:23:48
+ */
+public interface BerthingTimeConfigMapper {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param timeId 主键
+     * @return 实例对象
+     */
+    BerthingTimeConfig queryById(Long timeId);
+
+    /**
+     * 查询指定行数据
+     *
+     * @param timePointQuery 查询条件
+     * @param page         分页对象
+     * @return 对象列表
+     */
+    Page<BerthingTimeConfig> queryAllByLimit(@Param("timePointQuery") TimePointQuery timePointQuery, Page page);
+
+    /**
+     * 统计总行数
+     *
+     * @param berthingTimeConfig 查询条件
+     * @return 总行数
+     */
+    long count(BerthingTimeConfig berthingTimeConfig);
+
+    /**
+     * 新增数据
+     *
+     * @param berthingTimeConfig 实例对象
+     * @return 影响行数
+     */
+    int insert(BerthingTimeConfig berthingTimeConfig);
+
+    /**
+     * 批量新增数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<BerthingTimeConfig> 实例对象列表
+     * @return 影响行数
+     */
+    int insertBatch(@Param("entities") List<BerthingTimeConfig> entities);
+
+    /**
+     * 批量新增或按主键更新数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<BerthingTimeConfig> 实例对象列表
+     * @return 影响行数
+     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
+     */
+    int insertOrUpdateBatch(@Param("entities") List<BerthingTimeConfig> entities);
+
+    /**
+     * 修改数据
+     *
+     * @param berthingTimeConfig 实例对象
+     * @return 影响行数
+     */
+    int update(BerthingTimeConfig berthingTimeConfig);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param timeId 主键
+     * @return 影响行数
+     */
+    int deleteById(Long timeId);
+
+}
+

+ 6 - 0
ruoyi-system/src/main/java/com/ruoyi/system/paramet/BerthingPointQuery.java

@@ -14,6 +14,12 @@ import java.io.Serializable;
 @Data
 public class BerthingPointQuery implements Serializable {
 
+
+    /**
+     * 断面ID
+     */
+    private Long berthingId;
+
     /**
      * 站点ID
      */

+ 38 - 0
ruoyi-system/src/main/java/com/ruoyi/system/paramet/StopPointQuery.java

@@ -0,0 +1,38 @@
+package com.ruoyi.system.paramet;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 停泊点配置(BerthingPoint)实体类
+ *
+ * @author makejava
+ * @since 2024-04-10 15:29:55
+ */
+@Data
+public class StopPointQuery implements Serializable {
+
+
+    /**
+     * 停泊点策略ID
+     */
+    private Long stopId;
+
+    /**
+     * 站点ID
+     */
+    private Long siteId;
+
+    /**
+     * 分页
+     */
+    private Long page;
+
+    /**
+     * 分页长度
+     */
+    private Long size;
+
+}
+

+ 38 - 0
ruoyi-system/src/main/java/com/ruoyi/system/paramet/TimePointQuery.java

@@ -0,0 +1,38 @@
+package com.ruoyi.system.paramet;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 停泊点配置(BerthingPoint)实体类
+ *
+ * @author makejava
+ * @since 2024-04-10 15:29:55
+ */
+@Data
+public class TimePointQuery implements Serializable {
+
+
+    /**
+     * 停泊点时间策略ID
+     */
+    private Long TimeId;
+
+    /**
+     * 站点ID
+     */
+    private Long siteId;
+
+    /**
+     * 分页
+     */
+    private Long page;
+
+    /**
+     * 分页长度
+     */
+    private Long size;
+
+}
+

+ 13 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/BerthingService.java

@@ -3,10 +3,15 @@ package com.ruoyi.system.service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.system.domain.BerthingPoint;
+import com.ruoyi.system.domain.BerthingPointConfig;
+import com.ruoyi.system.domain.BerthingTimeConfig;
 import com.ruoyi.system.dto.BerthingPointConfigDTO;
 import com.ruoyi.system.dto.BerthingPointDTO;
+import com.ruoyi.system.dto.BerthingTimeDTO;
 import com.ruoyi.system.dto.PrintExcelDTO;
 import com.ruoyi.system.paramet.BerthingPointQuery;
+import com.ruoyi.system.paramet.StopPointQuery;
+import com.ruoyi.system.paramet.TimePointQuery;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
@@ -28,4 +33,12 @@ public interface BerthingService {
 
 
     boolean addStopPrint(BerthingPointConfigDTO berthingPointConfigDTO);
+
+    Page<BerthingPointConfig> queryStopPrint(StopPointQuery stopPointQuery);
+
+
+    boolean addTimePrint(BerthingTimeDTO berthingTimeDTO);
+
+
+    Page<BerthingTimeConfig> queryTimePrint(TimePointQuery timePointQuery);
 }

+ 83 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BerthingServiceImpl.java

@@ -11,14 +11,19 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.exception.base.BaseException;
 import com.ruoyi.system.domain.BerthingPoint;
 import com.ruoyi.system.domain.BerthingPointConfig;
+import com.ruoyi.system.domain.BerthingTimeConfig;
 import com.ruoyi.system.domain.SiteInfo;
 import com.ruoyi.system.dto.BerthingPointConfigDTO;
 import com.ruoyi.system.dto.BerthingPointDTO;
+import com.ruoyi.system.dto.BerthingTimeDTO;
 import com.ruoyi.system.dto.PrintExcelDTO;
 import com.ruoyi.system.mapper.BerthingPointConfigMapper;
 import com.ruoyi.system.mapper.BerthingPointMapper;
+import com.ruoyi.system.mapper.BerthingTimeConfigMapper;
 import com.ruoyi.system.mapper.SiteInfoMapper;
 import com.ruoyi.system.paramet.BerthingPointQuery;
+import com.ruoyi.system.paramet.StopPointQuery;
+import com.ruoyi.system.paramet.TimePointQuery;
 import com.ruoyi.system.service.BerthingService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -26,6 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
+import javax.validation.constraints.NotBlank;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Comparator;
@@ -51,6 +57,9 @@ public class BerthingServiceImpl implements BerthingService {
     @Resource
     private BerthingPointConfigMapper berthingPointConfigMapper;
 
+    @Resource
+    private BerthingTimeConfigMapper berthingTimeConfigMapper;
+
 
     @Override
     public ArrayList<PrintExcelDTO> uploadFile(MultipartFile file) {
@@ -133,8 +142,8 @@ public class BerthingServiceImpl implements BerthingService {
         if (berthingPoint == null) {
             throw new BaseException("没有断面数据");
         }
-        List<PrintExcelDTO> positions = JSONUtil.toList(berthingPoint.getPositions(), PrintExcelDTO.class);
         try {
+            List<PrintExcelDTO> positions = JSONUtil.toList(berthingPoint.getPositions(), PrintExcelDTO.class);
             response.setContentType("application/octet-stream; charset=utf-8");
             // 文件名中文名需要转义
             String today = new SimpleDateFormat("yyyyMMdd").format(new Date());
@@ -204,6 +213,79 @@ public class BerthingServiceImpl implements BerthingService {
         return res;
 }
 
+    @Override
+    public Page<BerthingPointConfig> queryStopPrint(StopPointQuery stopPointQuery) {
+        try {
+            if (stopPointQuery.getPage() == null || stopPointQuery.getSize() == null) {
+                stopPointQuery.setPage(1L);
+                stopPointQuery.setSize(10L);
+            }
+            return berthingPointConfigMapper.queryAllByLimit(stopPointQuery, new Page<>(stopPointQuery.getPage(), stopPointQuery.getSize()));
+        } catch (Exception e) {
+            log.error("查询停泊点错误", e);
+            throw new BaseException("查询停泊点错误");
+        }
+
+    }
+
+    @Override
+    public boolean addTimePrint(BerthingTimeDTO berthingTimeDTO) {
+        SiteInfo siteInfo = siteInfoMapper.queryById(berthingTimeDTO.getSiteId());
+        if (siteInfo == null) {
+            throw new BaseException("站点不存在");
+        }
+        if (berthingTimeDTO.getTimeId() == null) {
+            berthingTimeDTO.setTimeId(0L);
+        }
+        boolean res = false;
+        BerthingTimeConfig berthingTime = berthingTimeConfigMapper.queryById(berthingTimeDTO.getTimeId());
+        try {
+            ArrayList<String> times = berthingTimeDTO.getTimes();
+            if (berthingTime == null) {
+                //新增
+                berthingTime = new BerthingTimeConfig();
+                berthingTime.setTimeId(0L);
+                berthingTime.setSiteId(siteInfo.getSiteId());
+                berthingTime.setPlanid(berthingTimeDTO.getPlanid());
+                berthingTime.setTimes(JSONUtil.toJsonStr(times));
+                berthingTime.setWlevel(berthingTimeDTO.getWlevel());
+                berthingTime.setCreateTime(new Date());
+                berthingTime.setIsDel(0);
+                berthingTime.setStatus(1);
+                berthingTime.setId(siteInfo.getId());
+                berthingTime.setType(berthingTimeDTO.getType());
+                res =  berthingTimeConfigMapper.insert(berthingTime) > 0;
+            } else {
+                //更新
+                berthingTime.setPlanid(berthingTimeDTO.getPlanid());
+                berthingTime.setWlevel(berthingTimeDTO.getWlevel());
+                berthingTime.setTimes(JSONUtil.toJsonStr(times));
+                berthingTime.setType(berthingTimeDTO.getType());
+                res =  berthingTimeConfigMapper.update(berthingTime) > 0;
+            }
+        } catch (Exception e){
+            log.error("新增或修改时间策略错误", e);
+            throw new BaseException("新增或修改时间策略错误");
+        }
+        //TODO 下发配置
+        return res;
+    }
+
+    @Override
+    public Page<BerthingTimeConfig> queryTimePrint(TimePointQuery timePointQuery) {
+        try {
+            if (timePointQuery.getPage() == null || timePointQuery.getSize() == null) {
+                timePointQuery.setPage(1L);
+                timePointQuery.setSize(10L);
+            }
+            return berthingTimeConfigMapper.queryAllByLimit(timePointQuery, new Page<>(timePointQuery.getPage(), timePointQuery.getSize()));
+        } catch (Exception e) {
+            log.error("查询停泊点错误", e);
+            throw new BaseException("查询停泊点错误");
+        }
+
+    }
+
 
 
 

+ 9 - 35
ruoyi-system/src/main/resources/mapper/BerthingPointConfigMapper.xml

@@ -14,12 +14,13 @@
         <result property="isDel" column="is_del" jdbcType="INTEGER"/>
         <result property="wlevel" column="wlevel" jdbcType="NUMERIC"/>
         <result property="factors" column="factors" jdbcType="VARCHAR"/>
+        <result property="siteName" column="site_name" jdbcType="VARBINARY"/>
     </resultMap>
 
     <!--查询单个-->
     <select id="queryById" resultMap="BerthingPointConfigMap">
         select
-stop_id, id, site_id, planid, berthing_id, positions, create_time, status, is_del, wlevel, factors
+            stop_id, id, site_id, planid, berthing_id, positions, create_time, status, is_del, wlevel, factors
         from berthing_point_config
         where stop_id = #{stopId}
     </select>
@@ -27,44 +28,17 @@ stop_id, id, site_id, planid, berthing_id, positions, create_time, status, is_de
     <!--查询指定行数据-->
     <select id="queryAllByLimit" resultMap="BerthingPointConfigMap">
         select
-stop_id, id, site_id, planid, berthing_id, positions, create_time, status, is_del, wlevel, factors
-        from berthing_point_config
+            a.stop_id, a.id, a.site_id, a.planid, a.berthing_id, a.positions, a.create_time, a.status, a.is_del, a.wlevel, a.factors, b.site_name
+        from berthing_point_config as a
+        join site_info as b on a.site_id = b.site_id
         <where>
-            <if test="stopId != null">
-                and stop_id = #{stopId}
-            </if>
-            <if test="id != null and id != ''">
-                and id = #{id}
-            </if>
-            <if test="siteId != null">
-                and site_id = #{siteId}
-            </if>
-            <if test="planid != null">
-                and planid = #{planid}
-            </if>
-            <if test="berthingId != null">
-                and berthing_id = #{berthingId}
-            </if>
-            <if test="positions != null and positions != ''">
-                and positions = #{positions}
-            </if>
-            <if test="createTime != null">
-                and create_time = #{createTime}
-            </if>
-            <if test="status != null">
-                and status = #{status}
+            <if test="stopPointQuery.stopId != null">
+                and a.stop_id = #{stopPointQuery.stopId}
             </if>
-            <if test="isDel != null">
-                and is_del = #{isDel}
-            </if>
-            <if test="wlevel != null">
-                and wlevel = #{wlevel}
-            </if>
-            <if test="factors != null and factors != ''">
-                and factors = #{factors}
+            <if test="stopPointQuery.siteId != null">
+                and a.site_id = #{stopPointQuery.siteId}
             </if>
         </where>
-        limit #{pageable.offset}, #{pageable.pageSize}
     </select>
 
     <!--统计总行数-->

+ 8 - 3
ruoyi-system/src/main/resources/mapper/BerthingPointMapper.xml

@@ -12,6 +12,7 @@
         <result property="status" column="status" jdbcType="INTEGER"/>
         <result property="isDel" column="is_del" jdbcType="INTEGER"/>
         <result property="factors" column="factors" jdbcType="VARCHAR"/>
+        <result property="siteName" column="site_name" jdbcType="VARCHAR"/>
     </resultMap>
 
     <!--查询单个-->
@@ -43,11 +44,15 @@
     <!--查询指定行数据-->
     <select id="queryAllByLimit" resultMap="BerthingPointMap">
         select
-            berthing_id, id, site_id, berthing_name, positions, create_time, status, is_del, factors
-        from berthing_point
+            a.berthing_id, a.id, a.site_id, a.berthing_name, a.positions, a.create_time, a.status, a.is_del, a.factors, b.site_name
+        from berthing_point as a
+        join site_info as b on a.site_id = b.site_id
         <where>
+            <if test="berthingPointQuery.berthingId != null">
+                and a.berthing_id = #{berthingPointQuery.berthingId}
+            </if>
             <if test="berthingPointQuery.siteId != null">
-                and site_id= #{berthingPointQuery.siteId}
+                and a.site_id= #{berthingPointQuery.siteId}
             </if>
         </where>
         ORDER BY create_time DESC

+ 154 - 0
ruoyi-system/src/main/resources/mapper/BerthingTimeConfigMapper.xml

@@ -0,0 +1,154 @@
+<?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.BerthingTimeConfigMapper">
+
+    <resultMap type="com.ruoyi.system.domain.BerthingTimeConfig" id="BerthingTimeConfigMap">
+        <result property="timeId" column="time_id" jdbcType="INTEGER"/>
+        <result property="id" column="id" jdbcType="VARCHAR"/>
+        <result property="siteId" column="site_id" jdbcType="INTEGER"/>
+        <result property="planid" column="planid" jdbcType="INTEGER"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="status" column="status" jdbcType="INTEGER"/>
+        <result property="isDel" column="is_del" jdbcType="INTEGER"/>
+        <result property="wlevel" column="wlevel" jdbcType="NUMERIC"/>
+        <result property="times" column="times" jdbcType="VARCHAR"/>
+        <result property="type" column="type" jdbcType="INTEGER"/>
+        <result property="siteName" column="site_name" jdbcType="VARBINARY"/>
+    </resultMap>
+
+    <!--查询单个-->
+    <select id="queryById" resultMap="BerthingTimeConfigMap">
+        select
+time_id, id, site_id, planid, create_time, status, is_del, wlevel, times, type
+        from berthing_time_config
+        where time_id = #{timeId}
+    </select>
+
+    <!--查询指定行数据-->
+    <select id="queryAllByLimit" resultMap="BerthingTimeConfigMap">
+        select
+            a.time_id, a.id, a.site_id, a.planid, a.create_time, a.status, a.is_del, a.wlevel, a.times, a.type, b.site_name
+        from berthing_time_config as a
+        join site_info as b on a.site_id = b.site_id
+        <where>
+            <if test="timePointQuery.timeId != null">
+                and a.time_id = #{timePointQuery.timeId}
+            </if>
+            <if test="timePointQuery.siteId != null">
+                and a.site_id = #{timePointQuery.siteId}
+            </if>
+        </where>
+    </select>
+
+    <!--统计总行数-->
+    <select id="count" resultType="java.lang.Long">
+        select count(1)
+        from berthing_time_config
+        <where>
+            <if test="timeId != null">
+                and time_id = #{timeId}
+            </if>
+            <if test="id != null and id != ''">
+                and id = #{id}
+            </if>
+            <if test="siteId != null">
+                and site_id = #{siteId}
+            </if>
+            <if test="planid != null">
+                and planid = #{planid}
+            </if>
+            <if test="createTime != null">
+                and create_time = #{createTime}
+            </if>
+            <if test="status != null">
+                and status = #{status}
+            </if>
+            <if test="isDel != null">
+                and is_del = #{isDel}
+            </if>
+            <if test="wlevel != null">
+                and wlevel = #{wlevel}
+            </if>
+            <if test="times != null and times != ''">
+                and times = #{times}
+            </if>
+            <if test="type != null">
+                and type = #{type}
+            </if>
+        </where>
+    </select>
+
+    <!--新增所有列-->
+    <insert id="insert" keyProperty="timeId" useGeneratedKeys="true">
+        insert into berthing_time_config(id, site_id, planid, create_time, status, is_del, wlevel, times, type)
+        values (#{id}, #{siteId}, #{planid}, #{createTime}, #{status}, #{isDel}, #{wlevel}, #{times}, #{type})
+    </insert>
+
+    <insert id="insertBatch" keyProperty="timeId" useGeneratedKeys="true">
+        insert into berthing_time_config(id, site_id, planid, create_time, status, is_del, wlevel, times, type)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+        (#{entity.id}, #{entity.siteId}, #{entity.planid}, #{entity.createTime}, #{entity.status}, #{entity.isDel}, #{entity.wlevel}, #{entity.times}, #{entity.type})
+        </foreach>
+    </insert>
+
+    <insert id="insertOrUpdateBatch" keyProperty="timeId" useGeneratedKeys="true">
+        insert into berthing_time_config(id, site_id, planid, create_time, status, is_del, wlevel, times, type)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.id}, #{entity.siteId}, #{entity.planid}, #{entity.createTime}, #{entity.status}, #{entity.isDel}, #{entity.wlevel}, #{entity.times}, #{entity.type})
+        </foreach>
+        on duplicate key update
+id = values(id),
+site_id = values(site_id),
+planid = values(planid),
+create_time = values(create_time),
+status = values(status),
+is_del = values(is_del),
+wlevel = values(wlevel),
+times = values(times),
+type = values(type)
+    </insert>
+
+    <!--通过主键修改数据-->
+    <update id="update">
+        update berthing_time_config
+        <set>
+            <if test="id != null and id != ''">
+                id = #{id},
+            </if>
+            <if test="siteId != null">
+                site_id = #{siteId},
+            </if>
+            <if test="planid != null">
+                planid = #{planid},
+            </if>
+            <if test="createTime != null">
+                create_time = #{createTime},
+            </if>
+            <if test="status != null">
+                status = #{status},
+            </if>
+            <if test="isDel != null">
+                is_del = #{isDel},
+            </if>
+            <if test="wlevel != null">
+                wlevel = #{wlevel},
+            </if>
+            <if test="times != null and times != ''">
+                times = #{times},
+            </if>
+            <if test="type != null">
+                type = #{type},
+            </if>
+        </set>
+        where time_id = #{timeId}
+    </update>
+
+    <!--通过主键删除-->
+    <delete id="deleteById">
+        delete from berthing_time_config where time_id = #{timeId}
+    </delete>
+
+</mapper>
+

+ 28 - 2
waterAffairs-admin/src/main/java/com/ruoyi/web/controller/tool/BerthingController.java

@@ -4,10 +4,15 @@ 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.BerthingPoint;
+import com.ruoyi.system.domain.BerthingPointConfig;
+import com.ruoyi.system.domain.BerthingTimeConfig;
 import com.ruoyi.system.dto.BerthingPointConfigDTO;
 import com.ruoyi.system.dto.BerthingPointDTO;
+import com.ruoyi.system.dto.BerthingTimeDTO;
 import com.ruoyi.system.dto.PrintExcelDTO;
 import com.ruoyi.system.paramet.BerthingPointQuery;
+import com.ruoyi.system.paramet.StopPointQuery;
+import com.ruoyi.system.paramet.TimePointQuery;
 import com.ruoyi.system.service.BerthingService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -38,13 +43,13 @@ public class BerthingController {
 
     @PostMapping(value = "/uploadFile")
     @ApiOperation("上传断面Excel")
-    public R<ArrayList<PrintExcelDTO>> uploadFile(@ApiParam(required = true, value = "The file to be uploaded", name = "file") @RequestPart("file") MultipartFile file)  {
+    public R<ArrayList<PrintExcelDTO>> uploadFile(@ApiParam(required = true, value = "The file to be uploaded", name = "file") @RequestPart("file") MultipartFile file) {
         return R.ok(berthingService.uploadFile(file));
     }
 
     @PostMapping(value = "/insertBerthing")
     @ApiOperation("新增断面")
-    public R<Boolean> insertBerthing(@Valid  @RequestBody BerthingPointDTO berthingPointDTO) {
+    public R<Boolean> insertBerthing(@Valid @RequestBody BerthingPointDTO berthingPointDTO) {
         return R.ok(berthingService.insertBerthing(berthingPointDTO));
     }
 
@@ -68,5 +73,26 @@ public class BerthingController {
     }
 
 
+    @PostMapping(value = "/queryStopPrint")
+    @ApiOperation("查询停泊点")
+    public R<Page<BerthingPointConfig>> queryStopPrint(@RequestBody StopPointQuery stopPointQuery) {
+        return R.ok(berthingService.queryStopPrint(stopPointQuery));
+    }
+
+
+    @PostMapping(value = "/addTimePrint")
+    @ApiOperation("增加或修改时间策略")
+    public R<Boolean> addTimePrint(@Valid @RequestBody BerthingTimeDTO berthingTimeDTO) {
+        return R.ok(berthingService.addTimePrint(berthingTimeDTO));
+    }
 
+
+    @PostMapping(value = "/queryTimePrint")
+    @ApiOperation("查询时间策略")
+    public R<Page<BerthingTimeConfig>> queryTimePrint(@RequestBody TimePointQuery timePointQuery) {
+        return R.ok(berthingService.queryTimePrint(timePointQuery));
     }
+
+
+
+}