From d4067fd7261da2ada678da9cb5cce83311d2e7db Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期四, 15 八月 2024 13:56:20 +0800
Subject: [PATCH] 2024-08-15 朱宝民 修改片区(重建地图图形和坐标)、删除片区(同步删除地图图形和坐标)

---
 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockSv.java           |   18 ++
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaMapGraphMapper.xml                            |  156 +++++++++--------
 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/result/SystemResultCode.java |    3 
 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockCtrl.java         |  144 ++++++++++-----
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaMapCoordinatesMapper.java       |    7 
 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/dto/Block.java         |    5 
 pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml                                 |    2 
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaMapCoordinatesMapper.xml                      |  180 ++++++++++---------
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaMapGraphMapper.java             |    7 
 9 files changed, 316 insertions(+), 206 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaMapCoordinatesMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaMapCoordinatesMapper.java
index 46e7d7a..3cef43f 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaMapCoordinatesMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaMapCoordinatesMapper.java
@@ -24,4 +24,11 @@
     int updateByPrimaryKeySelective(BaMapCoordinates record);
 
     int updateByPrimaryKey(BaMapCoordinates record);
+
+    /**
+     * 鏍规嵁鐗囧尯ID鍒犻櫎璇ョ墖鍖轰笅鐨勫潗鏍囩偣
+     * @param blockId
+     * @return
+     */
+    int deleteByBlockId(Long blockId);
 }
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaMapGraphMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaMapGraphMapper.java
index 5a7c703..521f975 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaMapGraphMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaMapGraphMapper.java
@@ -24,4 +24,11 @@
     int updateByPrimaryKeySelective(BaMapGraph record);
 
     int updateByPrimaryKey(BaMapGraph record);
+
+    /**
+     * 鏍规嵁鐗囧尯ID鍒犻櫎鍦板浘鍥惧舰
+     * @param blockId
+     * @return
+     */
+    int deleteByBlockId(Long blockId);
 }
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
index 682d4eb..658ae3e 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml
@@ -72,7 +72,7 @@
 
 pipIrr:
     global:
-        dev: false   #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse
+        dev: fals   #鏄惁寮�鍙戦樁娈碉紝true鎴杅alse
         dsName: ym  #寮�鍙戦樁娈碉紝璁剧疆涓存椂鐨勬暟鎹簱鍚嶇О
     mw:
         webPort: 8070
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaMapCoordinatesMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaMapCoordinatesMapper.xml
index deaac4a..d8dea46 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaMapCoordinatesMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaMapCoordinatesMapper.xml
@@ -1,91 +1,103 @@
 <?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.dy.pipIrrGlobal.daoBa.BaMapCoordinatesMapper">
-  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates">
-    <!--@mbg.generated-->
-    <!--@Table ba_map_coordinates-->
-    <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="graph_id" jdbcType="BIGINT" property="graphId" />
-    <result column="lat" jdbcType="DECIMAL" property="lat" />
-    <result column="lng" jdbcType="DECIMAL" property="lng" />
-  </resultMap>
-  <sql id="Base_Column_List">
-    <!--@mbg.generated-->
-    id, graph_id, lat, lng
-  </sql>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    <!--@mbg.generated-->
-    select 
-    <include refid="Base_Column_List" />
-    from ba_map_coordinates
-    where id = #{id,jdbcType=BIGINT}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-    <!--@mbg.generated-->
-    delete from ba_map_coordinates
-    where id = #{id,jdbcType=BIGINT}
-  </delete>
-  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates">
-    <!--@mbg.generated-->
-    insert into ba_map_coordinates (id, graph_id, lat, 
-      lng)
-    values (#{id,jdbcType=BIGINT}, #{graphId,jdbcType=BIGINT}, #{lat,jdbcType=DECIMAL}, 
-      #{lng,jdbcType=DECIMAL})
-  </insert>
-  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates">
-    <!--@mbg.generated-->
-    insert into ba_map_coordinates
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
+    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates">
+        <!--@mbg.generated-->
+        <!--@Table ba_map_coordinates-->
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="graph_id" jdbcType="BIGINT" property="graphId"/>
+        <result column="lat" jdbcType="DECIMAL" property="lat"/>
+        <result column="lng" jdbcType="DECIMAL" property="lng"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        <!--@mbg.generated-->
         id,
-      </if>
-      <if test="graphId != null">
         graph_id,
-      </if>
-      <if test="lat != null">
         lat,
-      </if>
-      <if test="lng != null">
-        lng,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=BIGINT},
-      </if>
-      <if test="graphId != null">
-        #{graphId,jdbcType=BIGINT},
-      </if>
-      <if test="lat != null">
-        #{lat,jdbcType=DECIMAL},
-      </if>
-      <if test="lng != null">
-        #{lng,jdbcType=DECIMAL},
-      </if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates">
-    <!--@mbg.generated-->
-    update ba_map_coordinates
-    <set>
-      <if test="graphId != null">
-        graph_id = #{graphId,jdbcType=BIGINT},
-      </if>
-      <if test="lat != null">
-        lat = #{lat,jdbcType=DECIMAL},
-      </if>
-      <if test="lng != null">
-        lng = #{lng,jdbcType=DECIMAL},
-      </if>
-    </set>
-    where id = #{id,jdbcType=BIGINT}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates">
-    <!--@mbg.generated-->
-    update ba_map_coordinates
-    set graph_id = #{graphId,jdbcType=BIGINT},
-      lat = #{lat,jdbcType=DECIMAL},
-      lng = #{lng,jdbcType=DECIMAL}
-    where id = #{id,jdbcType=BIGINT}
-  </update>
+        lng
+    </sql>
+    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        <!--@mbg.generated-->
+        select
+        <include refid="Base_Column_List"/>
+        from ba_map_coordinates
+        where id = #{id,jdbcType=BIGINT}
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+        <!--@mbg.generated-->
+        delete
+        from ba_map_coordinates
+        where id = #{id,jdbcType=BIGINT}
+    </delete>
+    <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates">
+        <!--@mbg.generated-->
+        insert into ba_map_coordinates (id, graph_id, lat,
+                                        lng)
+        values (#{id,jdbcType=BIGINT}, #{graphId,jdbcType=BIGINT}, #{lat,jdbcType=DECIMAL},
+                #{lng,jdbcType=DECIMAL})
+    </insert>
+    <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates">
+        <!--@mbg.generated-->
+        insert into ba_map_coordinates
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                id,
+            </if>
+            <if test="graphId != null">
+                graph_id,
+            </if>
+            <if test="lat != null">
+                lat,
+            </if>
+            <if test="lng != null">
+                lng,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                #{id,jdbcType=BIGINT},
+            </if>
+            <if test="graphId != null">
+                #{graphId,jdbcType=BIGINT},
+            </if>
+            <if test="lat != null">
+                #{lat,jdbcType=DECIMAL},
+            </if>
+            <if test="lng != null">
+                #{lng,jdbcType=DECIMAL},
+            </if>
+        </trim>
+    </insert>
+    <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates">
+        <!--@mbg.generated-->
+        update ba_map_coordinates
+        <set>
+            <if test="graphId != null">
+                graph_id = #{graphId,jdbcType=BIGINT},
+            </if>
+            <if test="lat != null">
+                lat = #{lat,jdbcType=DECIMAL},
+            </if>
+            <if test="lng != null">
+                lng = #{lng,jdbcType=DECIMAL},
+            </if>
+        </set>
+        where id = #{id,jdbcType=BIGINT}
+    </update>
+    <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapCoordinates">
+        <!--@mbg.generated-->
+        update ba_map_coordinates
+        set graph_id = #{graphId,jdbcType=BIGINT},
+            lat      = #{lat,jdbcType=DECIMAL},
+            lng      = #{lng,jdbcType=DECIMAL}
+        where id = #{id,jdbcType=BIGINT}
+    </update>
+
+    <!--鏍规嵁鐗囧尯ID鍒犻櫎璇ョ墖鍖轰笅鐨勫潗鏍囩偣-->
+    <delete id="deleteByBlockId" parameterType="java.lang.Long">
+        DELETE coo.*
+        FROM ba_map_coordinates coo
+                 INNER JOIN ba_map_graph gra ON gra.id = coo.graph_id
+        WHERE gra.block_id = #{blockId}
+    </delete>
 </mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaMapGraphMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaMapGraphMapper.xml
index d8a272a..e7586ae 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaMapGraphMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaMapGraphMapper.xml
@@ -1,80 +1,88 @@
 <?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.dy.pipIrrGlobal.daoBa.BaMapGraphMapper">
-  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaMapGraph">
-    <!--@mbg.generated-->
-    <!--@Table ba_map_graph-->
-    <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="block_id" jdbcType="BIGINT" property="blockId" />
-    <result column="graph_type" jdbcType="TINYINT" property="graphType" />
-  </resultMap>
-  <sql id="Base_Column_List">
-    <!--@mbg.generated-->
-    id, block_id, graph_type
-  </sql>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    <!--@mbg.generated-->
-    select 
-    <include refid="Base_Column_List" />
-    from ba_map_graph
-    where id = #{id,jdbcType=BIGINT}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-    <!--@mbg.generated-->
-    delete from ba_map_graph
-    where id = #{id,jdbcType=BIGINT}
-  </delete>
-  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph">
-    <!--@mbg.generated-->
-    insert into ba_map_graph (id, block_id, graph_type
-      )
-    values (#{id,jdbcType=BIGINT}, #{blockId,jdbcType=BIGINT}, #{graphType,jdbcType=TINYINT}
-      )
-  </insert>
-  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph">
-    <!--@mbg.generated-->
-    insert into ba_map_graph
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
+    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaMapGraph">
+        <!--@mbg.generated-->
+        <!--@Table ba_map_graph-->
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="block_id" jdbcType="BIGINT" property="blockId"/>
+        <result column="graph_type" jdbcType="TINYINT" property="graphType"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        <!--@mbg.generated-->
         id,
-      </if>
-      <if test="blockId != null">
         block_id,
-      </if>
-      <if test="graphType != null">
-        graph_type,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=BIGINT},
-      </if>
-      <if test="blockId != null">
-        #{blockId,jdbcType=BIGINT},
-      </if>
-      <if test="graphType != null">
-        #{graphType,jdbcType=TINYINT},
-      </if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph">
-    <!--@mbg.generated-->
-    update ba_map_graph
-    <set>
-      <if test="blockId != null">
-        block_id = #{blockId,jdbcType=BIGINT},
-      </if>
-      <if test="graphType != null">
-        graph_type = #{graphType,jdbcType=TINYINT},
-      </if>
-    </set>
-    where id = #{id,jdbcType=BIGINT}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph">
-    <!--@mbg.generated-->
-    update ba_map_graph
-    set block_id = #{blockId,jdbcType=BIGINT},
-      graph_type = #{graphType,jdbcType=TINYINT}
-    where id = #{id,jdbcType=BIGINT}
-  </update>
+        graph_type
+    </sql>
+    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        <!--@mbg.generated-->
+        select
+        <include refid="Base_Column_List"/>
+        from ba_map_graph
+        where id = #{id,jdbcType=BIGINT}
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+        <!--@mbg.generated-->
+        delete
+        from ba_map_graph
+        where id = #{id,jdbcType=BIGINT}
+    </delete>
+    <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph">
+        <!--@mbg.generated-->
+        insert into ba_map_graph (id, block_id, graph_type)
+        values (#{id,jdbcType=BIGINT}, #{blockId,jdbcType=BIGINT}, #{graphType,jdbcType=TINYINT})
+    </insert>
+    <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph">
+        <!--@mbg.generated-->
+        insert into ba_map_graph
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                id,
+            </if>
+            <if test="blockId != null">
+                block_id,
+            </if>
+            <if test="graphType != null">
+                graph_type,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                #{id,jdbcType=BIGINT},
+            </if>
+            <if test="blockId != null">
+                #{blockId,jdbcType=BIGINT},
+            </if>
+            <if test="graphType != null">
+                #{graphType,jdbcType=TINYINT},
+            </if>
+        </trim>
+    </insert>
+    <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph">
+        <!--@mbg.generated-->
+        update ba_map_graph
+        <set>
+            <if test="blockId != null">
+                block_id = #{blockId,jdbcType=BIGINT},
+            </if>
+            <if test="graphType != null">
+                graph_type = #{graphType,jdbcType=TINYINT},
+            </if>
+        </set>
+        where id = #{id,jdbcType=BIGINT}
+    </update>
+    <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaMapGraph">
+        <!--@mbg.generated-->
+        update ba_map_graph
+        set block_id   = #{blockId,jdbcType=BIGINT},
+            graph_type = #{graphType,jdbcType=TINYINT}
+        where id = #{id,jdbcType=BIGINT}
+    </update>
+
+    <!--鏍规嵁鐗囧尯ID鍒犻櫎鍦板浘鍥惧舰-->
+    <delete id="deleteByBlockId" parameterType="java.lang.Long">
+        DELETE
+        FROM ba_map_graph
+        WHERE block_id = #{blockId}
+    </delete>
 </mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockCtrl.java
index 7f0ef55..a3399dc 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockCtrl.java
@@ -36,19 +36,20 @@
 @Slf4j
 @Tag(name = "鐗囧尯绠$悊", description = "鐗囧尯澧炲垹鏀规煡绛夋搷浣�")
 @RestController
-@RequestMapping(path="block")
+@RequestMapping(path = "block")
 @SuppressWarnings("unchecked")//java鐗堟湰瓒婇珮锛屽娉涘瀷绾︽潫瓒婁弗锛屾墍浠ラ厤缃甋uppressWarnings("unchecked")
 public class BlockCtrl {
 
-    private BlockSv sv ;
+    private BlockSv sv;
 
     @Autowired
-    private void setSv(BlockSv sv){
-        this.sv = sv ;
+    private void setSv(BlockSv sv) {
+        this.sv = sv;
     }
 
     /**
      * 瀹㈡埛绔姹傚緱鍒版墍鏈夌墖鍖烘暟鎹�
+     *
      * @return 鎵�鏈夌墖鍖烘暟鎹�
      */
     @Operation(summary = "鑾峰緱鍏ㄩ儴鐗囧尯", description = "杩斿洖鍏ㄩ儴鐗囧尯鏁版嵁")
@@ -62,34 +63,36 @@
     })
     @GetMapping(path = "all")
     @SsoAop()
-    public BaseResponse<QueryResultVo<List<BaBlock>>> all(){
+    public BaseResponse<QueryResultVo<List<BaBlock>>> all() {
         try {
-            QueryResultVo<List<BaBlock>> res = this.sv.selectAll() ;
+            QueryResultVo<List<BaBlock>> res = this.sv.selectAll();
             return BaseResponseUtils.buildSuccess(res);
         } catch (Exception e) {
             log.error("鏌ヨ鐗囧尯寮傚父", e);
-            return BaseResponseUtils.buildException(e.getMessage()) ;
+            return BaseResponseUtils.buildException(e.getMessage());
         }
     }
 
     /**
      * 瀹㈡埛绔姹傚緱鍒版墍鏈夌墖鍖烘暟鎹� 2024-08-14搴熷純
+     *
      * @return 鎵�鏈夌墖鍖烘暟鎹�
      */
     @PostMapping(path = "some2", consumes = MediaType.APPLICATION_JSON_VALUE)
     @SsoAop()
-    public BaseResponse<QueryResultVo<List<BaBlock>>> some(@RequestBody QueryVo vo){
+    public BaseResponse<QueryResultVo<List<BaBlock>>> some(@RequestBody QueryVo vo) {
         try {
-            QueryResultVo<List<BaBlock>> res = this.sv.selectSome(vo) ;
+            QueryResultVo<List<BaBlock>> res = this.sv.selectSome(vo);
             return BaseResponseUtils.buildSuccess(res);
         } catch (Exception e) {
             log.error("鏌ヨ鐗囧尯寮傚父", e);
-            return BaseResponseUtils.buildException(e.getMessage()) ;
+            return BaseResponseUtils.buildException(e.getMessage());
         }
     }
 
     /**
      * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鐗囧尯锛�2024-08-14鏂板锛屾浛鎹㈠師鏉ョ殑鐗囧尯鍒嗛〉鏌ヨ
+     *
      * @param qo
      * @param bindingResult
      * @return
@@ -97,19 +100,20 @@
     @GetMapping(path = "/some")
     @SsoAop()
     public BaseResponse<QueryResultVo<List<VoBlock>>> getBlocks(@Valid QueryVo qo, BindingResult bindingResult) {
-        if(bindingResult != null && bindingResult.hasErrors()){
+        if (bindingResult != null && bindingResult.hasErrors()) {
             return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
         try {
             return BaseResponseUtils.buildSuccess(this.sv.getBlocks(qo));
         } catch (Exception e) {
             log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e);
-            return BaseResponseUtils.buildException(e.getMessage()) ;
+            return BaseResponseUtils.buildException(e.getMessage());
         }
     }
 
     /**
      * 寰楀埌涓�涓墖鍖烘暟鎹�
+     *
      * @return 涓�涓墖鍖烘暟鎹�
      */
     @Operation(summary = "涓�涓墖鍖�", description = "寰楀埌涓�涓墖鍖烘暟鎹�")
@@ -124,12 +128,13 @@
     //@GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE)
     @GetMapping(path = "one")
     @SsoAop()
-    public BaseResponse<BaBlock> one(Long id){
+    public BaseResponse<BaBlock> one(Long id) {
         return BaseResponseUtils.buildSuccess(this.sv.selectById(id));
     }
 
     /**
      * 淇濆瓨鐗囧尯
+     *
      * @param po 淇濆瓨鐗囧尯form琛ㄥ崟瀵硅薄
      * @return 鏄惁鎴愬姛
      */
@@ -146,8 +151,8 @@
     @Transactional(rollbackFor = Exception.class)
     @SsoAop()
     //public BaseResponse<Boolean> save(@RequestBody @Valid BaBlock po, BindingResult bindingResult){
-    public BaseResponse<Boolean> save(@RequestBody @Valid Block po, BindingResult bindingResult){
-        if(bindingResult != null && bindingResult.hasErrors()){
+    public BaseResponse<Boolean> save(@RequestBody @Valid Block po, BindingResult bindingResult) {
+        if (bindingResult != null && bindingResult.hasErrors()) {
             return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
 
@@ -161,7 +166,7 @@
         baBlock.setRemark(po.getRemark());
         baBlock.deleted = Deleted.NO;
         Long blockId = Optional.ofNullable(this.sv.save(baBlock)).orElse(0L);
-        if(blockId.equals(0)) {
+        if (blockId.equals(0)) {
             return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage());
         }
 
@@ -184,7 +189,7 @@
                     break;
             }
             Long graphId = Optional.ofNullable(this.sv.addMapGraph(baMapGraph)).orElse(0L);
-            if(graphId.equals(0)) {
+            if (graphId.equals(0)) {
                 return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage());
             }
 
@@ -200,7 +205,7 @@
                     mapCoordinates.setLat(point.getBigDecimal("lat"));
                     mapCoordinates.setLng(point.getBigDecimal("lng"));
                     Long coordinateId = Optional.ofNullable(this.sv.addMapCoordinate(mapCoordinates)).orElse(0L);
-                    if(coordinateId.equals(0)) {
+                    if (coordinateId.equals(0)) {
                         return BaseResponseUtils.buildErrorMsg(SystemResultCode.SAVA_BLOCK_ERROR.getMessage());
                     }
                 }
@@ -225,45 +230,86 @@
     }
 
     /**
-     * 缂栬緫淇敼鐗囧尯
+     * 缂栬緫淇敼鐗囧尯 2024-08-15 浣滃簾
+     *
      * @param po 淇濆瓨鐗囧尯form琛ㄥ崟瀵硅薄
      * @return 鏄惁鎴愬姛
      */
-    @Operation(summary = "缂栬緫淇敼鐗囧尯", description = "鎻愪氦鐗囧尯鏁版嵁锛坒orm琛ㄥ崟锛夛紝杩涜淇敼")
-    @ApiResponses(value = {
-            @ApiResponse(
-                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
-                    description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
-                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
-                            schema = @Schema(implementation = Boolean.class))}
-            )
-    })
-    @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @PostMapping(path = "update2", consumes = MediaType.APPLICATION_JSON_VALUE)
     @SsoAop()
-    public BaseResponse<Boolean> update(@RequestBody @Valid BaBlock po, BindingResult bindingResult){
-        if(bindingResult != null && bindingResult.hasErrors()){
+    public BaseResponse<Boolean> update2(@RequestBody @Valid BaBlock po, BindingResult bindingResult) {
+        if (bindingResult != null && bindingResult.hasErrors()) {
             return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
         }
-        if(po.id == null){
-            return BaseResponseUtils.buildFail("鏃犳暟鎹疄浣揑D") ;
+        if (po.id == null) {
+            return BaseResponseUtils.buildFail("鏃犳暟鎹疄浣揑D");
         }
         int count;
         try {
             count = this.sv.update(po);
         } catch (Exception e) {
             log.error("淇濆瓨鐗囧尯寮傚父", e);
-            return BaseResponseUtils.buildException(e.getMessage()) ;
+            return BaseResponseUtils.buildException(e.getMessage());
         }
-        if(count <= 0){
-            return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ;
-        }else{
-            return BaseResponseUtils.buildSuccess(true) ;
+        if (count <= 0) {
+            return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
+        } else {
+            return BaseResponseUtils.buildSuccess(true);
         }
+    }
+
+    /**
+     * 淇敼鐗囧尯淇℃伅锛�2024-08-15鏂板锛屾浛鎹㈠師鏉ョ殑鐗囧尯淇敼鎺ュ彛
+     *
+     * @param po
+     * @param bindingResult
+     * @return
+     */
+    @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @SsoAop()
+    public BaseResponse<Boolean> update(@RequestBody @Valid Block po, BindingResult bindingResult) {
+        if (bindingResult != null && bindingResult.hasErrors()) {
+            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+        }
+
+        Long blockId = po.getId();
+        if (blockId == null) {
+            return BaseResponseUtils.buildErrorMsg(SystemResultCode.THE_BLOCK_NOT_EXIST.getMessage());
+        }
+
+        // 淇敼鐗囧尯淇℃伅
+        BaBlock baBlock = new BaBlock();
+        baBlock.setId(po.getId());
+        baBlock.setName(po.getName());
+        baBlock.setHeader(po.getHeader());
+        baBlock.setPhone(po.getPhone());
+        baBlock.setArea(po.getArea());
+        baBlock.setColor(po.getColor());
+        baBlock.setRemark(po.getRemark());
+        baBlock.setDeleted(po.getDeleted());
+        int count;
+        try {
+            count = this.sv.update(baBlock);
+        } catch (Exception e) {
+            log.error("淇濆瓨鐗囧尯寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+        if (count <= 0) {
+            return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
+        }
+
+        // 鍒犻櫎鐗囧尯鍏宠仈鐨勫湴鍥惧浘褰�
+        this.sv.deleteMapGraph(blockId);
+        // 鍒犻櫎鍦板浘鍥惧舰鍧愭爣
+        this.sv.deleteMapCoordinates(blockId);
+
+        return BaseResponseUtils.buildSuccess(true);
     }
 
 
     /**
      * 鍒犻櫎鐗囧尯
+     *
      * @param id 鐗囧尯ID
      * @return 鏄惁鎴愬姛
      */
@@ -276,24 +322,30 @@
                             schema = @Schema(implementation = Boolean.class))}
             )
     })
+
     //@GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE)
     @GetMapping(path = "delete")
     @SsoAop()
-    public BaseResponse<Boolean> delete(Long id){
-        if(id == null){
-            return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖") ;
+    public BaseResponse<Boolean> delete(Long id) {
+        if (id == null) {
+            return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖");
         }
         int count;
         try {
             count = this.sv.delete(id);
         } catch (Exception e) {
             log.error("淇濆瓨鐗囧尯寮傚父", e);
-            return BaseResponseUtils.buildException(e.getMessage()) ;
+            return BaseResponseUtils.buildException(e.getMessage());
         }
-        if(count <= 0){
-            return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ;
-        }else{
-            return BaseResponseUtils.buildSuccess(true) ;
+        if (count <= 0) {
+            return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�");
         }
+
+        // 鍒犻櫎鐗囧尯鍏宠仈鐨勫湴鍥惧浘褰�
+        this.sv.deleteMapGraph(id);
+        // 鍒犻櫎鍦板浘鍥惧舰鍧愭爣
+        this.sv.deleteMapCoordinates(id);
+
+        return BaseResponseUtils.buildSuccess(true);
     }
 }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockSv.java
index 11a0410..89854ee 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockSv.java
@@ -188,4 +188,22 @@
         return po.getId();
     };
 
+    /**
+     * 鏍规嵁鐗囧尯ID鍒犻櫎鍦板浘鍥惧舰
+     * @param blockId
+     * @return
+     */
+    public int deleteMapGraph(Long blockId) {
+        return this.baMapGraphMapper.deleteByBlockId(blockId);
+    }
+
+    /**
+     * 鏍规嵁鐗囧尯ID鍒犻櫎璇ョ墖鍖轰笅鐨勫潗鏍囩偣
+     * @param blockId
+     * @return
+     */
+    public int deleteMapCoordinates(Long blockId) {
+        return this.baMapCoordinatesMapper.deleteByBlockId(blockId);
+    }
+
 }
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/dto/Block.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/dto/Block.java
index 2efa888..50fda27 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/dto/Block.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/dto/Block.java
@@ -20,6 +20,11 @@
     public static final long serialVersionUID = 202408131140001L;
 
     /**
+     * 鐗囧尯ID
+     */
+    private Long id;
+
+    /**
      * 鐗囧尯鍚嶇О
      */
     @NotBlank(message = "鐗囧尯鍚嶇О涓嶈兘涓虹┖")
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/result/SystemResultCode.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/result/SystemResultCode.java
index 206afe5..7d68698 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/result/SystemResultCode.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/result/SystemResultCode.java
@@ -32,7 +32,8 @@
     /**
      * 鐗囧尯
      */
-    SAVA_BLOCK_ERROR(30001, "淇濆瓨鐗囧尯澶辫触");
+    SAVA_BLOCK_ERROR(30001, "淇濆瓨鐗囧尯澶辫触"),
+    THE_BLOCK_NOT_EXIST(30002, "鐗囧尯涓嶅瓨鍦�");
 
     private final Integer code;
     private final String message;

--
Gitblit v1.8.0