Browse Source

三个接口补充空间查询接口

ywf 1 month ago
parent
commit
f582fe774e

+ 1 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/ProjectFilterVo.java

@@ -11,6 +11,7 @@ import java.util.List;
 public class ProjectFilterVo {
     private String name;
     private String code;
+    private String shape;
     /**
      * 关键词:模糊匹配 name、company
      */

+ 1 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/vo/YdbpDataFilterVo.java

@@ -10,6 +10,7 @@ import java.util.List;
 @Data
 public class YdbpDataFilterVo {
     private String name;
+    private String shape;
     private Integer pageNum;
     private Integer pageSize;
     private List<String> ids;

+ 4 - 2
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/YdbpDataMapper.java

@@ -30,7 +30,9 @@ public interface YdbpDataMapper {
      * @param pageSize 每页记录数
      * @return 用地报批数据列表
      */
-    List<YdbpData> selectPage(@Param("offset") int offset, @Param("pageSize") int pageSize, @Param("ids") List<String> ids,@Param("name") String name);
+    List<YdbpData> selectPage(@Param("offset") int offset, @Param("pageSize") int pageSize,
+                              @Param("ids") List<String> ids, @Param("name") String name,
+                              @Param("shape") String shape);
 
     /**
      * 更新用地报批数据
@@ -44,7 +46,7 @@ public interface YdbpDataMapper {
      *
      * @return 用地报批数据总数
      */
-    int countAll();
+    int countAll(@Param("ids") List<String> ids, @Param("name") String name, @Param("shape") String shape);
 
     void batchDelete(@Param("ids") List<String> ids);
 

+ 3 - 2
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/YdbpDataImpl.java

@@ -78,11 +78,12 @@ public class YdbpDataImpl implements YdbpDataService {
         int offset = (pageNum - 1) * pageSize;
         List<String> ids = filterVo.getIds();
         String name = filterVo.getName();
+        String shape = filterVo.getShape();
         if(StringUtils.isBlank(name)){
             name="";
         }
-        List<YdbpData> rows = ydbpDataMapper.selectPage(offset, pageSize,ids,name);
-        int total = ydbpDataMapper.countAll();
+        List<YdbpData> rows = ydbpDataMapper.selectPage(offset, pageSize, ids, name, shape);
+        int total = ydbpDataMapper.countAll(ids, name, shape);
         Map<String, Object> result = new HashMap<>();
         result.put("rows", rows);
         result.put("total", total);

+ 20 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/ProjectMapper.xml

@@ -65,6 +65,16 @@
             <if test="isOnchain != null and isOnchain==true">
                 AND on_chain_num > 0
             </if>
+            <if test="shape != null and shape != ''">
+                AND EXISTS (
+                    SELECT 1
+                    FROM t_project_workflow pw
+                    JOIN t_node_land nl ON nl.node_id = pw.node_id
+                    JOIN t_geom_db_details gd ON gd.upload_id = nl.geom_db_id
+                    WHERE pw.project_id = t_project.id
+                      AND public.ST_Intersects(gd.geom, public.ST_GeomFromEWKT(#{shape}))
+                )
+            </if>
 
         </where>
         ORDER BY updated_at DESC
@@ -92,6 +102,16 @@
             <if test="isOnchain != null and isOnchain==true">
                 AND on_chain_num > 0
             </if>
+            <if test="shape != null and shape != ''">
+                AND EXISTS (
+                    SELECT 1
+                    FROM t_project_workflow pw
+                    JOIN t_node_land nl ON nl.node_id = pw.node_id
+                    JOIN t_geom_db_details gd ON gd.upload_id = nl.geom_db_id
+                    WHERE pw.project_id = t_project.id
+                      AND public.ST_Intersects(gd.geom, public.ST_GeomFromEWKT(#{shape}))
+                )
+            </if>
         </where>
     </select>
     <update id="update" parameterType="com.siwei.apply.domain.vo.ProjectUpdateVo">

+ 30 - 1
siwei-modules/siwei-apply/src/main/resources/mapper/YdbpDataMapper.xml

@@ -43,6 +43,15 @@
                 #{id}
             </foreach>
         </if>
+        <if test="shape != null and shape != ''">
+            AND EXISTS (
+                SELECT 1
+                FROM t_node_land nl
+                JOIN t_geom_db_details gd ON gd.upload_id = nl.geom_db_id
+                WHERE nl.node_id = t_ydbp_data.id
+                  AND public.ST_Intersects(gd.geom, public.ST_GeomFromEWKT(#{shape}))
+            )
+        </if>
         ORDER BY updated_at DESC
         LIMIT #{pageSize} OFFSET #{offset}
     </select>
@@ -63,7 +72,27 @@
         WHERE id = #{id}
     </update>
     <select id="countAll" resultType="int">
-        SELECT COUNT(1) FROM t_ydbp_data
+        SELECT COUNT(1)
+        FROM t_ydbp_data
+        where 1=1
+        <if test="name != null and name != ''">
+            AND name LIKE CONCAT('%', #{name}, '%')
+        </if>
+        <if test="ids != null and ids.size() > 0">
+            AND id IN
+            <foreach collection="ids" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </if>
+        <if test="shape != null and shape != ''">
+            AND EXISTS (
+                SELECT 1
+                FROM t_node_land nl
+                JOIN t_geom_db_details gd ON gd.upload_id = nl.geom_db_id
+                WHERE nl.node_id = t_ydbp_data.id
+                  AND public.ST_Intersects(gd.geom, public.ST_GeomFromEWKT(#{shape}))
+            )
+        </if>
     </select>
 
     <delete id="batchDelete">