Browse Source

节点关联土地

gushoubang 2 months ago
parent
commit
239cc58a70

+ 29 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/NodeLand.java

@@ -0,0 +1,29 @@
+package com.siwei.apply.domain;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.UUID;
+
+/**
+ * 记录业务流程对应的地块图形
+ */
+@Data
+public class NodeLand implements Serializable {
+    
+    /** 主键ID */
+    private String id;
+    
+    /** 节点id */
+    private String nodeId;
+
+    /** 对标t_geom_db数据 */
+    private String geomDbId;
+    
+    /**
+     * 生成主键ID
+     */
+    public void generateId() {
+        this.id = UUID.randomUUID().toString();
+    }
+}

+ 40 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/NodeLandMapper.java

@@ -0,0 +1,40 @@
+package com.siwei.apply.mapper;
+
+import com.siwei.apply.domain.NodeLand;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 记录业务流程对应的地块图形 Mapper 接口
+ */
+@Mapper
+public interface NodeLandMapper {
+
+    /**
+     * 根据node_id查询地块几何信息,返回ewkt格式
+     *
+     * @param nodeId 节点ID
+     * @return 包含nodeId和geom字段的Map列表,key和value都是String类型
+     */
+    List<Map<String, String>> selectGeomByNodeId(String nodeId);
+
+    /**
+     * 根据node_id和geom_db_id创建记录
+     *
+     * @param nodeId 节点ID
+     * @param geomDbId 几何数据库ID
+     * @return 影响行数
+     */
+    int insertByNodeIdAndGeomDbId(String nodeId, String geomDbId);
+
+    /**
+     * 根据node_id删除记录
+     *
+     * @param nodeId 节点ID
+     * @return 影响行数
+     */
+    int deleteByNodeId(String nodeId);
+
+}

+ 51 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/NodeLandMapper.xml

@@ -0,0 +1,51 @@
+<?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.siwei.apply.mapper.NodeLandMapper">
+
+    <!-- 结果映射 -->
+    <resultMap id="BaseResultMap" type="com.siwei.apply.domain.NodeLand">
+        <id property="id" column="id"/>
+        <result property="nodeId" column="node_id"/>
+        <result property="geomDbId" column="geom_db_id"/>
+    </resultMap>
+
+    <!-- 基础查询字段 -->
+    <sql id="Base_Column_List">
+        id, node_id, geom_db_id
+    </sql>
+
+    <!-- 根据node_id查询地块几何信息,返回ewkt格式 -->
+    <select id="selectGeomByNodeId" resultType="map" parameterType="String">
+        SELECT
+            nl.node_id as nodeId,
+            ST_AsEWKT(gd.geom) as geom
+        FROM t_node_land nl
+        LEFT JOIN t_geom_db_details gd ON nl.geom_db_id = gd.upload_id
+        WHERE nl.node_id = #{nodeId}
+        AND gd.geom IS NOT NULL
+        ORDER BY nl.id
+    </select>
+
+    <!-- 根据node_id和geom_db_id创建记录 -->
+    <insert id="insertByNodeIdAndGeomDbId">
+        INSERT INTO t_node_land (
+            id,
+            node_id,
+            geom_db_id
+        ) VALUES (
+            gen_random_uuid()::varchar,
+            #{param1},
+            #{param2}
+        )
+    </insert>
+
+    <!-- 根据node_id删除记录 -->
+    <delete id="deleteByNodeId" parameterType="String">
+        DELETE FROM t_node_land
+        WHERE node_id = #{nodeId}
+    </delete>
+
+</mapper>