瀏覽代碼

获取闲置非闲置土地

gushoubang 8 月之前
父節點
當前提交
c673d1ea6f

+ 2 - 2
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/tdgy/TdgyController.java

@@ -76,9 +76,9 @@ public class TdgyController {
     /**
      * 闲置土地列表
      */
-    @GetMapping("/idleLandList")
+    @PostMapping("/idleLandList")
     public RequestResult idleLandList(@Valid @RequestBody IdleLandListVo idleLandListVo) {
         RequestResult requestResult = tdgyService.idleLandList(idleLandListVo);
-        return null;
+        return requestResult;
     }
 }

+ 7 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/domain/tdgy/vo/IdleLandListVo.java

@@ -12,4 +12,11 @@ public class IdleLandListVo {
     // TODO 待实现
     private String xzqh;
     private String idleReason;
+
+    private Integer pageSize;
+    private Integer pageNum;
+
+
+    private Integer limit;
+    private Integer offset;
 }

+ 4 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/tdgy/LandIdleConfirmMapper.java

@@ -6,8 +6,11 @@ import com.onemap.apply.domain.tdgy.vo.IdleLandListVo;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface LandIdleConfirmMapper extends BaseMapper<LandIdleConfirmDTO> {
-    List<String> getLandIds(IdleLandListVo idleLandListVo);
+    List<Map> getIdleLandList(IdleLandListVo idleLandListVo);
+
+    Integer getIdleLandListCount(IdleLandListVo idleLandListVo);
 }

+ 14 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/tdgy/TdgyServiceImp.java

@@ -185,8 +185,21 @@ public class TdgyServiceImp implements TdgyService {
      */
     @Override
     public RequestResult idleLandList(IdleLandListVo idleLandListVo) {
+        if (idleLandListVo.getPageSize() == null) {
+            idleLandListVo.setPageSize(20);
+        }
+        if (idleLandListVo.getPageNum() == null) {
+            idleLandListVo.setPageNum(1);
+        }
 
+        idleLandListVo.setLimit(idleLandListVo.getPageSize());
+        idleLandListVo.setOffset((idleLandListVo.getPageNum() - 1) * idleLandListVo.getPageSize());
+        List<Map> mapList = landIdleConfirmMapper.getIdleLandList(idleLandListVo);
+        Integer count = landIdleConfirmMapper.getIdleLandListCount(idleLandListVo);
 
-        return null;
+        Map<String, Object> map = new HashMap<>();
+        map.put("list", mapList);
+        map.put("count", count);
+        return RequestResult.success(map);
     }
 }

+ 49 - 14
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/tdgy/LandIdelConfirmMapper.xml

@@ -2,26 +2,61 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.onemap.apply.mapper.tdgy.LandIdleConfirmMapper">
 
-    <select id="getLandIds" resultType="String">
-        SELECT td.id,td.srf,td.crmj,td.cqzh
-        from t_land_idle_confirm as confirm,tdgy_sj as td
-        WHERE confirm.land_id=td.id and is_idle=#{isConfirm}
+<!--    <select id="getIdleLandList" resultType="Map">-->
+<!--        SELECT td.id,td.srf,td.crmj,td.cqzh ,public.st_asewkt(public.st_union(tb.geom))-->
+<!--        from base.t_land_idle_confirm as confirm,vector.tdgy_sj as td,vector."TB_TDGY_SJ" as tb-->
+<!--        WHERE confirm.land_id=td.id::VARCHAR and tb.pid=td.id and is_idle=#{isConfirm}-->
+<!--        <if test="key != null and key != ''">-->
+<!--            and (td.srf like '%'||#{key}||'%' or td.cqzh like '%'||#{key}||'%')-->
+<!--        </if>-->
+<!--        <if test="xzqh != null and xzqh != ''">-->
+<!--            and td.xzqh = #{xzqh}-->
+<!--        </if>-->
+<!--        <if test="idleReason != null and idleReason != ''">-->
+<!--            and confirm.idle_reason = #{idleReason}-->
+<!--        </if>-->
+<!--        GROUP BY td.id,td.srf,td.crmj,td.cqzh-->
+<!--    </select>-->
+
+    <select id="getIdleLandList" resultType="Map">
+        SELECT td.id, td.srf, td.crmj, td.cqzh, public.st_asewkt(public.st_union(tb.geom))
+        FROM base.t_land_idle_confirm AS confirm
+        JOIN vector.tdgy_sj AS td ON confirm.land_id = td.id::VARCHAR
+        JOIN vector."TB_TDGY_SJ" AS tb ON tb.pid = td.id
+        WHERE confirm.is_idle = #{isConfirm}
+        <if test="key != null and key != ''">
+            AND (td.srf LIKE '%' || #{key} || '%' OR td.cqzh LIKE '%' || #{key} || '%')
+        </if>
+        <if test="xzqh != null and xzqh != ''">
+            AND td.xzqh = #{xzqh}
+        </if>
+        <if test="idleReason != null and idleReason != ''">
+            AND confirm.idle_reason = #{idleReason}
+        </if>
+        GROUP BY td.id, td.srf, td.crmj, td.cqzh
+        ORDER BY td.id
+        LIMIT #{limit} OFFSET #{offset}
+    </select>
+    <select id="getIdleLandListCount" resultType="Integer">
+        SELECT COUNT(td.id)
+        FROM base.t_land_idle_confirm AS confirm
+        JOIN vector.tdgy_sj AS td ON confirm.land_id = td.id::VARCHAR
+        WHERE confirm.is_idle = #{isConfirm}
         <if test="key != null and key != ''">
-            and (td.srf like '%'||#{key}||'%' or td.cqzh like '%'||#{key}||'%')
+            AND (td.srf LIKE '%' || #{key} || '%' OR td.cqzh LIKE '%' || #{key} || '%')
         </if>
         <if test="xzqh != null and xzqh != ''">
-            and td.xzqh = #{xzqh}
+            AND td.xzqh = #{xzqh}
         </if>
         <if test="idleReason != null and idleReason != ''">
-            and confirm.idle_reason = #{idleReason}
+            AND confirm.idle_reason = #{idleReason}
         </if>
-        limit #{limit} offset #{offset};
     </select>
 
-<!--    <select id="getLandGeometry" resultType="String">-->
-<!--        public.st_asewkt(public.st_union(geom))-->
-<!--        from "TB_TDGY_SJ"-->
-<!--        WHERE pid=-->
-<!--        #{pid};-->
-<!--    </select>-->
+    <!--    <select id="getLandGeometry" resultType="String">-->
+    <!--        public.st_asewkt(public.st_union(geom))-->
+    <!--        from "TB_TDGY_SJ"-->
+    <!--        WHERE pid=-->
+    <!--        #{pid};-->
+    <!--    </select>-->
 </mapper>