修改 流量计实体增加监测站ID外键和驼峰命名
流量计监测站绑定接口(同步修改流量计的监测站ID外键 和 绑定记录表)
流量计监测站解绑接口(同步修改流量计的监测站ID外键 和 绑定记录表)
条件查询监测站(绑定状态判定)
条件查询已绑定的流量计
回退误修改的获取绑定记录
10个文件已修改
174 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrFlowmeterMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowmeter.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowmeterMapper.xml 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrMonitoringFlowmeterMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/DtoToFlowmeterPojo.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterCtrl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterSv.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowCtrl.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrFlowmeterMapper.java
@@ -63,4 +63,10 @@
     * @return 全部实体
     * */
    List<PrFlowmeter> selectAll();
    /**
     * 给流量计表加监测站ID外键
     * @param
     * @return
     */
    int flowmeterAddMonId(PrFlowmeter record);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrFlowmeter.java
@@ -16,7 +16,7 @@
/**
 * @author ZhuBaoMin
 * @date 2024-01-05 9:04
 * @LastEditTime 2024-01-05 9:04
 * @LastEditTime 2024-04-01 9:04 wuzeyu
 * @Description
 */
@@ -39,6 +39,13 @@
    private Long id;
    /**
     * 外键 监测站ID
     */
    @Schema(description = "监测站ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @Length(message = "监测站ID不大于{max}字,不小于{min}字", min = 1, max = 25)
    private String monitoringId;
    /**
    * 流量计编号
    */
    @Schema(description = "流量计编号", requiredMode = Schema.RequiredMode.REQUIRED)
@@ -58,19 +65,19 @@
    * 在线状态;1-在线,2-离线
    */
    @Schema(description = "在线状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Byte onlinestate;
    private Byte onlineState;
    /**
    * 最近上报时间
    */
    @Schema(description = "最近上报时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Date reporttime;
    private Date reportTime;
    /**
    * 添加方式;1-系统自动,2-手动
    */
    @Schema(description = "添加方式", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Byte addways;
    private Byte addWays;
    /**
    * 操作人ID
@@ -82,7 +89,7 @@
    * 操作时间
    */
    @Schema(description = "操作时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Date operatedt;
    private Date operateDt;
    /**
    * 备注信息
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java
@@ -31,7 +31,7 @@
    @Schema(title = "绑定状态")
    @ExcelProperty("绑定状态")
    @ColumnWidth(15)
    private Integer bindState;
    private String bindState;
    @Schema(title = "地址")
    @ExcelProperty("地址")
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml
@@ -211,7 +211,7 @@
    <select id="getRecordCountOfFlowMonitoring" resultType="java.lang.Integer">
        SELECT COUNT(*) AS recordCountOfFlowMonitoring
        from    pr_flow_monitoring pfm
        LEFT JOIN pr_monitoring_flowmeter pmofl ON pmofl.monitoringId = pfm.id
        LEFT JOIN pr_flowmeter pf ON pf.monitoringId = pfm.id
        LEFT JOIN ba_district country ON pfm.countyId = country.id
        LEFT JOIN ba_district town ON pfm.townId = town.id
        LEFT JOIN ba_district village ON pfm.villageId = village.id
@@ -220,20 +220,26 @@
            <if test = "name != null and name !=''">
                AND pfm.`name` like CONCAT('%',#{name},'%')
            </if>
            <if test = "bindState != null and bindState > 0">
                AND pmofl.operateType = ${bindState}
            <if test = "bindState ==1 ">
                AND pf.monitoringId IS NOT NULL
            </if>
            <if test = "bindState ==2 or bindState =='' ">
                AND pf.monitoringId IS  NULL
            </if>
        </where>
    </select>
    <!--根据指定条件获取流量监测站实体记录-->
    <select id="getPrFlowMonitoring" parameterType="map" resultType="com.dy.pipIrrGlobal.voPr.VoFlowMonitoring">
        select  CAST(pfm.id AS char)                                 AS id,
        select  CAST(pfm.id AS char)                                AS id,
                CONCAT(country.`name`, town.`name`, village.`name`) AS address,
                pfm.`name`                                          AS `name`,
                pmofl.operateType                                   AS bindState
                (CASE
                 WHEN pf.monitoringId IS NOT NULL THEN "已绑定"
                 WHEN pf.monitoringId IS  NULL  THEN "未绑定"
                 END)                                               AS bindState
        from    pr_flow_monitoring pfm
        LEFT JOIN pr_monitoring_flowmeter pmofl ON pmofl.monitoringId = pfm.id
        LEFT JOIN pr_flowmeter pf ON pf.monitoringId = pfm.id
        LEFT JOIN ba_district country ON pfm.countyId = country.id
        LEFT JOIN ba_district town ON pfm.townId = town.id
        LEFT JOIN ba_district village ON pfm.villageId = village.id
@@ -243,11 +249,14 @@
            <if test = "name != null and name !=''">
                AND pfm.`name` like CONCAT('%',#{name},'%')
            </if>
            <if test = "bindState != null and bindState > 0">
                AND pmofl.operateType = ${bindState}
            <if test = "bindState ==1 ">
                AND pf.monitoringId IS NOT NULL
            </if>
            <if test = "bindState ==2 or bindState =='' ">
                AND pf.monitoringId IS  NULL
            </if>
        </where>
        ORDER BY pmofl.operateDt DESC
        ORDER BY pfm.operateDt DESC
        <trim prefix="limit " >
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowmeterMapper.xml
@@ -5,19 +5,20 @@
    <!--@mbg.generated-->
    <!--@Table pr_flowmeter-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="monitoringId" jdbcType="BIGINT" property="monitoringId" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="protocol" jdbcType="VARCHAR" property="protocol" />
    <result column="onlineState" jdbcType="TINYINT" property="onlinestate" />
    <result column="reportTime" jdbcType="TIMESTAMP" property="reporttime" />
    <result column="addWays" jdbcType="TINYINT" property="addways" />
    <result column="onlineState" jdbcType="TINYINT" property="onlineState" />
    <result column="reportTime" jdbcType="TIMESTAMP" property="reportTime" />
    <result column="addWays" jdbcType="TINYINT" property="addWays" />
    <result column="operator" jdbcType="BIGINT" property="operator" />
    <result column="operateDt" jdbcType="TIMESTAMP" property="operatedt" />
    <result column="operateDt" jdbcType="TIMESTAMP" property="operateDt" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
    <result column="deleted" jdbcType="TINYINT" property="deleted" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, code, protocol, onlineState, reportTime, addWays, `operator`, operateDt, remarks,
    id, monitoringId, code, protocol, onlineState, reportTime, addWays, `operator`, operateDt, remarks,
    deleted
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
@@ -40,8 +41,8 @@
      `operator`, operateDt, remarks, 
      deleted)
    values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR}, 
      #{onlinestate,jdbcType=TINYINT}, #{reporttime,jdbcType=TIMESTAMP}, #{addways,jdbcType=TINYINT},
      #{operator,jdbcType=BIGINT}, #{operatedt,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR},
      #{onlineState,jdbcType=TINYINT}, #{reportTime,jdbcType=TIMESTAMP}, #{addWays,jdbcType=TINYINT},
      #{operator,jdbcType=BIGINT}, #{operateDt,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR},
      #{deleted,jdbcType=TINYINT})
  </insert>
@@ -58,19 +59,19 @@
      <if test="protocol != null">
        protocol,
      </if>
      <if test="onlinestate != null">
      <if test="onlineState != null">
        onlineState,
      </if>
      <if test="reporttime != null">
      <if test="reportTime != null">
        reportTime,
      </if>
      <if test="addways != null">
      <if test="addWays != null">
        addWays,
      </if>
      <if test="operator != null">
        `operator`,
      </if>
      <if test="operatedt != null">
      <if test="operateDt != null">
        operateDt,
      </if>
      <if test="remarks != null">
@@ -90,20 +91,20 @@
      <if test="protocol != null">
        #{protocol,jdbcType=VARCHAR},
      </if>
      <if test="onlinestate != null">
        #{onlinestate,jdbcType=TINYINT},
      <if test="onlineState != null">
        #{onlineState,jdbcType=TINYINT},
      </if>
      <if test="reporttime != null">
        #{reporttime,jdbcType=TIMESTAMP},
      <if test="reportTime != null">
        #{reportTime,jdbcType=TIMESTAMP},
      </if>
      <if test="addways != null">
        #{addways,jdbcType=TINYINT},
      <if test="addWays != null">
        #{addWays,jdbcType=TINYINT},
      </if>
      <if test="operator != null">
        #{operator,jdbcType=BIGINT},
      </if>
      <if test="operatedt != null">
        #{operatedt,jdbcType=TIMESTAMP},
      <if test="operateDt != null">
        #{operateDt,jdbcType=TIMESTAMP},
      </if>
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
@@ -123,20 +124,20 @@
      <if test="protocol != null">
        protocol = #{protocol,jdbcType=VARCHAR},
      </if>
      <if test="onlinestate != null">
        onlineState = #{onlinestate,jdbcType=TINYINT},
      <if test="onlineState != null">
        onlineState = #{onlineState,jdbcType=TINYINT},
      </if>
      <if test="reporttime != null">
        reportTime = #{reporttime,jdbcType=TIMESTAMP},
      <if test="reportTime != null">
        reportTime = #{reportTime,jdbcType=TIMESTAMP},
      </if>
      <if test="addways != null">
        addWays = #{addways,jdbcType=TINYINT},
      <if test="addWays != null">
        addWays = #{addWays,jdbcType=TINYINT},
      </if>
      <if test="operator != null">
        `operator` = #{operator,jdbcType=BIGINT},
      </if>
      <if test="operatedt != null">
        operateDt = #{operatedt,jdbcType=TIMESTAMP},
      <if test="operateDt != null">
        operateDt = #{operateDt,jdbcType=TIMESTAMP},
      </if>
      <if test="remarks != null">
        remarks = #{remarks,jdbcType=VARCHAR},
@@ -152,11 +153,11 @@
    update pr_flowmeter
    set code = #{code,jdbcType=VARCHAR},
      protocol = #{protocol,jdbcType=VARCHAR},
      onlineState = #{onlinestate,jdbcType=TINYINT},
      reportTime = #{reporttime,jdbcType=TIMESTAMP},
      addWays = #{addways,jdbcType=TINYINT},
      onlineState = #{onlineState,jdbcType=TINYINT},
      reportTime = #{reportTime,jdbcType=TIMESTAMP},
      addWays = #{addWays,jdbcType=TINYINT},
      `operator` = #{operator,jdbcType=BIGINT},
      operateDt = #{operatedt,jdbcType=TIMESTAMP},
      operateDt = #{operateDt,jdbcType=TIMESTAMP},
      remarks = #{remarks,jdbcType=VARCHAR},
      deleted = #{deleted,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
@@ -176,8 +177,7 @@
  <select id="getRecordCountOfFlowMeterByOthers" resultType="_integer">
    SELECT COUNT(*) AS recordCountOfFlowmeter
    from pr_flowmeter pfm
    Left join pr_monitoring_flowmeter pmofl on pmofl.flowmeterId = pfm.id
    Left join pr_flow_monitoring pfmt on pfmt.id = pmofl.monitoringId
    Left join pr_flow_monitoring pfmt on pfmt.id = pfm.monitoringId
    <where>
      pfm.deleted = 0 AND pfmt.deleted = 0
      <if test = "code != null and code !=''">
@@ -197,8 +197,7 @@
      pfmt.`name`                                               AS `name`,
      pfm.operateDt                                             AS operateDt
    from pr_flowmeter pfm
    Left join pr_monitoring_flowmeter pmofl on pmofl.flowmeterId = pfm.id
    Left join pr_flow_monitoring pfmt on pfmt.id = pmofl.monitoringId
    Left join pr_flow_monitoring pfmt on pfmt.id = pfm.monitoringId
    <where>
      pfm.deleted = 0 AND pfmt.deleted = 0
      <if test = "code != null and code !=''">
@@ -223,4 +222,11 @@
    from pr_flowmeter pfm
    where deleted != 1
  </select>
  <update id="flowmeterAddMonId">
    update pr_flowmeter
    set monitoringId = #{monitoringId,jdbcType=BIGINT},
    `operator` = #{operator,jdbcType=BIGINT},
    operateDt = #{operateDt,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrMonitoringFlowmeterMapper.xml
@@ -158,8 +158,6 @@
    `operator`,
    operateDt
    from pr_monitoring_flowmeter pmf
    INNER JOIN (SELECT monitoringId AS a,MAX(operateDt) AS b FROM `pr_monitoring_flowmeter`
    GROUP BY monitoringId) AS b ON monitoringId=a AND operateDt=b
    where
    monitoringId=#{monitoringId,jdbcType=BIGINT}
    order by operateDt desc
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/DtoToFlowmeterPojo.java
@@ -15,11 +15,11 @@
@Mapper
public interface DtoToFlowmeterPojo {
    DtoToFlowmeterPojo INSTANCT = Mappers.getMapper(DtoToFlowmeterPojo.class);
    @Mapping(target = "code", source = "code")
    @Mapping(target = "protocol", source = "protocol")
    @Mapping(target = "onlinestate", source = "onlineState")
    @Mapping(target = "addways", source = "addWays")
    @Mapping(target = "operator", source = "operator")
    @Mapping(target = "remarks", source = "remarks")
//    @Mapping(target = "code", source = "code")
//    @Mapping(target = "protocol", source = "protocol")
//    @Mapping(target = "onlineState", source = "onlineState")
//    @Mapping(target = "addWays", source = "addWays")
//    @Mapping(target = "operator", source = "operator")
//    @Mapping(target = "remarks", source = "remarks")
    PrFlowmeter po2vo(DtoFlowmeter po);
}
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterCtrl.java
@@ -59,9 +59,9 @@
        PrFlowmeter prFlowmeter = DtoToFlowmeterPojo.INSTANCT.po2vo(po);
        Date operateTime = new Date();
        prFlowmeter.setOperatedt(operateTime);
        prFlowmeter.setOperateDt(operateTime);
        prFlowmeter.setDeleted((byte) 0);
        prFlowmeter.setReporttime(operateTime);
        prFlowmeter.setReportTime(operateTime);
        Integer rec = Optional.ofNullable(flowmeterSv.addFlowmeter(prFlowmeter)).orElse(0);
        if (rec == 0) {
            return BaseResponseUtils.buildFail(ProjectResultCode.ADD_FLOWMETER_FAIL.getMessage());
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/FlowmeterSv.java
@@ -80,4 +80,13 @@
        List<PrFlowmeter> all = prFlowmeterMapper.selectAll();
        return all;
    }
    /**
     * 给流量计表加监测站ID外键
     * @param
     * @return
     */
    public Integer flowmeterAddMonId(PrFlowmeter record){
        return prFlowmeterMapper.flowmeterAddMonId(record);
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/flowMonitoring/MoniFlowCtrl.java
@@ -5,6 +5,7 @@
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoPr.PrFlowMonitoring;
import com.dy.pipIrrGlobal.pojoPr.PrFlowmeter;
import com.dy.pipIrrGlobal.pojoPr.PrMonitoringFlowmeter;
import com.dy.pipIrrProject.result.ProjectResultCode;
import io.swagger.v3.oas.annotations.Operation;
@@ -85,8 +86,15 @@
        prMonitoringFlowmeter.setOperatedt(operateTime);
        prMonitoringFlowmeter.setOperatetype((byte) 1);
        PrFlowmeter flowmeter = new PrFlowmeter();
        flowmeter.setMonitoringId(po.getMonitoringId().toString());
        flowmeter.setId(po.getFlowmeterId());
        flowmeter.setOperator(po.getOperator());
        flowmeter.setOperateDt(operateTime);
        Integer shu = flowmeterSv.flowmeterAddMonId(flowmeter);
        Integer rec = Optional.ofNullable(moniFlowSv.addRecord(prMonitoringFlowmeter)).orElse(0);
        if (rec == 0) {
        if (rec == 0 || shu == 0) {
            return BaseResponseUtils.buildFail(ProjectResultCode.MONITORING_FLOWMETER_BIND_FAIL.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true);
@@ -127,8 +135,15 @@
        prMonitoringFlowmeter.setOperatedt(operateTime);
        prMonitoringFlowmeter.setOperatetype((byte) 2);
        PrFlowmeter flowmeter = new PrFlowmeter();
        flowmeter.setMonitoringId(null);
        flowmeter.setId(po.getFlowmeterId());
        flowmeter.setOperator(po.getOperator());
        flowmeter.setOperateDt(operateTime);
        Integer shu = flowmeterSv.flowmeterAddMonId(flowmeter);
        Integer rec = Optional.ofNullable(moniFlowSv.addRecord(prMonitoringFlowmeter)).orElse(0);
        if (rec == 0) {
        if (rec == 0 || shu == 0) {
            return BaseResponseUtils.buildFail(ProjectResultCode.MONITORING_FLOWMETER_BIND_FAIL.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true);