Browse Source

Merge branch 'master' of http://114.55.67.98:8070/Natural_p1/YZT_YUHANG

songxy 1 tuần trước cách đây
mục cha
commit
11fb2e9db7

+ 7 - 7
YHYZT/client/src/views/DataCenter.vue

@@ -339,7 +339,7 @@
               </div>
             </div>
           </div>
-          <div v-if="kjfxData.fxType == 0" class="kjfx_contents">
+          <!-- <div v-if="kjfxData.fxType == 0" class="kjfx_contents">
             <gh-a-xz-analysis
               :kjxx="kjfxData.data[kjfxData.fxType]"
               :analysisType="kjfxData.analysisType"
@@ -350,11 +350,11 @@
               :kjxx="kjfxData.data[kjfxData.fxType]"
               analysisType=""
             />
-          </div>
-          <div v-if="kjfxData.fxType == 3" class="kjfx_yfk_contents">
+          </div> -->
+          <div v-if="kjfxData.fxType == 0" class="kjfx_yfk_contents">
             <yfk-analysis />
           </div>
-          <div v-if="kjfxData.fxType == 4" class="kjfx_yfk_contents">
+          <div v-if="kjfxData.fxType == 1" class="kjfx_yfk_contents">
             <dz-analysis />
           </div>
         </div>
@@ -615,9 +615,9 @@ export default {
       kjfxData: {
         analysisType: "报省",
         data: [
-          { name: "土地利用规划", value: "gh" },
-          { name: "土地利用现状", value: "xz" },
-          { name: "区域一键", value: "yj" },
+          // { name: "土地利用规划", value: "gh" },
+          // { name: "土地利用现状", value: "xz" },
+          // { name: "区域一键", value: "yj" },
           { name: "压覆矿", value: "yf" },
           { name: "地灾", value: "dz" },
         ],

+ 5 - 0
YHYZT/server/src/main/java/com/zjugis/yzt/beans/entity/Pewg.java

@@ -98,6 +98,11 @@ public class Pewg {
      */
     private String nczsj;
 
+    /**
+     * 剩余面积
+     */
+    private BigDecimal area;
+
 
     private String shape;
 } 

+ 41 - 33
YHYZT/server/src/main/java/com/zjugis/yzt/controller/PewgController.java

@@ -11,6 +11,8 @@ import com.zjugis.yzt.beans.entity.Pewg;
 import org.springframework.beans.BeanUtils;
 
 import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
 
 
 @RestController
@@ -21,52 +23,64 @@ public class PewgController extends BaseRestController {
     private PewgService pewgService;
 
     /**
-     * 获取批而未供信息(分页)
+     * 获取批而未供信息(分页)- 使用SQL查询,包含面积计算
      */
     @GetMapping("/page")
-    public IPage<PewgVO> getPewgList(
+    public IPage<PewgVO> getPewgListWithArea(
             @RequestParam(defaultValue = "1") Integer current,
             @RequestParam(defaultValue = "10") Integer size,
-            @RequestParam(required = false) String dkMc,      // 项目名称
-            @RequestParam(required = false) String xzqmc,      // 乡镇街道
-            @RequestParam(required = false) String pcbh,      // 批次名称
-            @RequestParam(required = false) String lx,        // 类型
-            @RequestParam(required = false) String ghyt,        // 规划用途
-            @RequestParam(required = false) String wgyy      // 未供原因
+            @RequestParam(required = false) String pch,        // 批次名称
+            @RequestParam(required = false) String dkMc,       // 项目名称
+            @RequestParam(required = false) Double minArea,    // 剩余面积最小值(平方米)
+            @RequestParam(required = false) Double maxArea,    // 剩余面积最大值(平方米)
+            @RequestParam(required = false) String xzz,        // 乡镇街道
+            @RequestParam(required = false) String dkYt,       // 土地用途
+            @RequestParam(required = false) String lx,         // 类型
+            @RequestParam(required = false) String wgyy        // 未供原因
     ) {
 
-        QueryWrapper<Pewg> queryWrapper = new QueryWrapper<>();
-
-        if (pcbh != null && !pcbh.isEmpty()) {
-            queryWrapper.like("pcbh", pcbh);
+        Page<Pewg> page = new Page<>(current, size);
+        
+        // 构建查询参数
+        Map<String, Object> params = new HashMap<>();
+        if (pch != null && !pch.isEmpty()) {
+            params.put("pch", pch);
         }
-        if (lx != null && !lx.isEmpty()) {
-            queryWrapper.like("fwlx", lx);
+        if (dkMc != null && !dkMc.isEmpty()) {
+            params.put("dkMc", dkMc);
         }
-        if (wgyy != null && !wgyy.isEmpty()) {
-            queryWrapper.like("wgyy", wgyy);
+        if (minArea != null) {
+            params.put("minArea", minArea);
         }
-        if (dkMc != null && !dkMc.isEmpty()) {
-            queryWrapper.like("dk_mc", dkMc);
+        if (maxArea != null) {
+            params.put("maxArea", maxArea);
         }
-        if (xzqmc != null && !xzqmc.isEmpty()) {
-            queryWrapper.like("xzqmc", xzqmc);
+        if (xzz != null && !xzz.isEmpty()) {
+            params.put("xzz", xzz);
         }
-        if (ghyt != null && !ghyt.isEmpty()) {
-            queryWrapper.like("ghyt", ghyt);
+        if (dkYt != null && !dkYt.isEmpty()) {
+            params.put("dkYt", dkYt);
         }
-        Page<Pewg> page = new Page<>(current, size);
-        IPage<Pewg> pewgPage = pewgService.page(page, queryWrapper);
+        if (lx != null && !lx.isEmpty()) {
+            params.put("lx", lx);
+        }
+        if (wgyy != null && !wgyy.isEmpty()) {
+            params.put("wgyy", wgyy);
+        }
+        
+        // 使用自定义分页查询方法
+        IPage<Pewg> pewgPage = pewgService.pageWithAreaCustom(page, params);
 
         return pewgPage.convert(this::convertToVO);
     }
 
+
     /**
      * 根据ID获取批而未供信息
      */
     @GetMapping("/{id}")
     public PewgVO getPewgById(@PathVariable Integer id) {
-        Pewg pewg = pewgService.getById(id);
+        Pewg pewg = pewgService.getByIdWithArea(id);
         return convertToVO(pewg);
     }
 
@@ -127,13 +141,7 @@ public class PewgController extends BaseRestController {
         }
         PewgVO vo = new PewgVO();
         BeanUtils.copyProperties(pewg, vo);
-        // 通过数据库st_area(shape)函数获取面积
-        if (pewg.getObjectid() != null) {
-            Double area = pewgService.getAreaById(pewg.getObjectid());
-            if (area != null) {
-                vo.setArea(new java.math.BigDecimal(area));
-            }
-        }
         return vo;
     }
-} 
+
+}

+ 30 - 10
YHYZT/server/src/main/java/com/zjugis/yzt/dao/PewgMapper.java

@@ -1,25 +1,45 @@
 package com.zjugis.yzt.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.zjugis.yzt.beans.entity.Pewg;
 import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Select;
-import org.apache.ibatis.annotations.Update;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface PewgMapper extends BaseMapper<Pewg> {
+    
     /**
-     * @param id
-     * @param shape
-     * @param wkid
-     * @return
+     * 更新shape字段
+     * @param id objectid
+     * @param shape WKT字符串
+     * @param wkid 坐标系ID
+     * @return 更新行数
      */
-    @Update("UPDATE pewg SET shape = st_geometry(#{shape}, #{wkid}) WHERE objectid = #{id}")
     int updateShapeById(Integer id, String shape, int wkid);
 
     /**
-     * 根据objectid查询shape的面积(平方米)
+     * 根据ID查询pewg详情,返回所有字段和面积
+     * @param id 对象ID
+     * @return pewg对象
+     */
+    Pewg selectByIdWithArea(Integer id);
+
+    /**
+     * 自定义分页查询pewg表,包含所有字段和面积计算
+     * @param params 查询参数,包含分页参数和查询条件
+     * @return pewg列表
+     */
+    List<Pewg> selectPewgPageWithArea(Map<String, Object> params);
+
+    /**
+     * 统计符合条件的记录总数
+     * @param params 查询条件
+     * @return 记录总数
      */
-    @Select("SELECT st_area(shape) FROM sde.pewg WHERE objectid = #{objectid}")
-    Double selectAreaById(Integer objectid);
+    Long countPewgWithCondition(Map<String, Object> params);
 } 

+ 13 - 2
YHYZT/server/src/main/java/com/zjugis/yzt/service/PewgService.java

@@ -1,8 +1,14 @@
 package com.zjugis.yzt.service;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.zjugis.yzt.beans.entity.Pewg;
 
+import java.util.List;
+import java.util.Map;
+
 public interface PewgService extends IService<Pewg> {
     /**
      * 根据pcbh将st_nzydk中"是否农民建房"为"否"的数据批量插入pewg表,并更新shape
@@ -10,7 +16,12 @@ public interface PewgService extends IService<Pewg> {
     void importFromNzydkByPcbh(String pcbh);
 
     /**
-     * 根据objectid获取shape面积(平方米)
+     * 根据ID查询pewg详情(包含面积)
+     */
+    Pewg getByIdWithArea(Integer objectid);
+
+    /**
+     * 自定义分页查询pewg表,包含所有字段和面积计算
      */
-    Double getAreaById(Integer objectid);
+    IPage<Pewg> pageWithAreaCustom(Page<Pewg> page, Map<String, Object> params);
 } 

+ 31 - 3
YHYZT/server/src/main/java/com/zjugis/yzt/service/impl/PewgServiceImpl.java

@@ -1,6 +1,9 @@
 package com.zjugis.yzt.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zjugis.yzt.beans.entity.Pewg;
 import com.zjugis.yzt.dao.PewgMapper;
@@ -83,7 +86,32 @@ public class PewgServiceImpl extends ServiceImpl<PewgMapper, Pewg> implements Pe
     }
 
     @Override
-    public Double getAreaById(Integer objectid) {
-        return pewgMapper.selectAreaById(objectid);
+    public Pewg getByIdWithArea(Integer id) {
+        return pewgMapper.selectByIdWithArea(id);
     }
-} 
+
+    @Override
+    public IPage<Pewg> pageWithAreaCustom(Page<Pewg> page, Map<String, Object> params) {
+        // 计算分页参数
+        int current = (int) page.getCurrent();
+        int size = (int) page.getSize();
+        int offset = (current - 1) * size;
+        
+        // 添加分页参数
+        params.put("offset", offset);
+        params.put("size", size);
+        
+        // 查询总数
+        Long total = pewgMapper.countPewgWithCondition(params);
+        
+        // 查询数据
+        List<Pewg> records = pewgMapper.selectPewgPageWithArea(params);
+        
+        // 设置分页结果
+        page.setTotal(total);
+        page.setRecords(records);
+        
+        return page;
+    }
+
+}

+ 93 - 0
YHYZT/server/src/main/resources/mapper/PewgMapper.xml

@@ -0,0 +1,93 @@
+<?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.zjugis.yzt.dao.PewgMapper">
+    
+    <!-- 更新shape字段 -->
+    <update id="updateShapeById">
+        UPDATE pewg SET shape = st_geometry(#{shape}, #{wkid}) WHERE objectid = #{id}
+    </update>
+
+    <!-- 根据ID查询pewg详情,返回所有字段和面积 -->
+    <select id="selectByIdWithArea" parameterType="java.lang.Integer" resultType="com.zjugis.yzt.beans.entity.Pewg">
+        SELECT 
+            objectid, pcbh, pch, dk_bh, dk_mc, xzz, dk_yt, td_zl, dk_mj, dk_qs, lx, pwh, pzrq, pz_mj, nmjf, bz, wgyy, lyjz, nczfs, nczsj,
+            st_astext(shape) as shape,
+            st_area(shape) as area
+        FROM sde.pewg 
+        WHERE objectid = #{id}
+    </select>
+
+    <!-- 自定义分页查询pewg表,包含所有字段和面积计算 -->
+    <select id="selectPewgPageWithArea" parameterType="java.util.Map" resultType="com.zjugis.yzt.beans.entity.Pewg">
+        <![CDATA[
+        SELECT 
+            objectid, pcbh, pch, dk_bh, dk_mc, xzz, dk_yt, td_zl, dk_mj, dk_qs, lx, pwh, pzrq, pz_mj, nmjf, bz, wgyy, lyjz, nczfs, nczsj,
+            st_astext(shape) as shape,
+            st_area(shape) as area
+        FROM sde.pewg
+        ]]>
+        <where>
+            <if test="pch != null and pch != ''">
+                AND pch LIKE '%' || #{pch} || '%'
+            </if>
+            <if test="dkMc != null and dkMc != ''">
+                AND dk_mc LIKE '%' || #{dkMc} || '%'
+            </if>
+            <if test="minArea != null">
+                <![CDATA[ AND st_area(shape) >= #{minArea} ]]>
+            </if>
+            <if test="maxArea != null">
+                <![CDATA[ AND st_area(shape) <= #{maxArea} ]]>
+            </if>
+            <if test="xzz != null and xzz != ''">
+                AND xzz LIKE '%' || #{xzz} || '%'
+            </if>
+            <if test="dkYt != null and dkYt != ''">
+                AND dk_yt LIKE '%' || #{dkYt} || '%'
+            </if>
+            <if test="lx != null and lx != ''">
+                AND lx LIKE '%' || #{lx} || '%'
+            </if>
+            <if test="wgyy != null and wgyy != ''">
+                AND wgyy LIKE '%' || #{wgyy} || '%'
+            </if>
+        </where>
+        <![CDATA[ ORDER BY objectid DESC ]]>
+        LIMIT #{size} OFFSET #{offset}
+    </select>
+
+    <!-- 统计符合条件的记录总数 -->
+    <select id="countPewgWithCondition" parameterType="java.util.Map" resultType="java.lang.Long">
+        <![CDATA[
+        SELECT COUNT(*)
+        FROM sde.pewg
+        ]]>
+        <where>
+            <if test="pch != null and pch != ''">
+                AND pch LIKE '%' || #{pch} || '%'
+            </if>
+            <if test="dkMc != null and dkMc != ''">
+                AND dk_mc LIKE '%' || #{dkMc} || '%'
+            </if>
+            <if test="minArea != null">
+                <![CDATA[ AND st_area(shape) >= #{minArea} ]]>
+            </if>
+            <if test="maxArea != null">
+                <![CDATA[ AND st_area(shape) <= #{maxArea} ]]>
+            </if>
+            <if test="xzz != null and xzz != ''">
+                AND xzz LIKE '%' || #{xzz} || '%'
+            </if>
+            <if test="dkYt != null and dkYt != ''">
+                AND dk_yt LIKE '%' || #{dkYt} || '%'
+            </if>
+            <if test="lx != null and lx != ''">
+                AND lx LIKE '%' || #{lx} || '%'
+            </if>
+            <if test="wgyy != null and wgyy != ''">
+                AND wgyy LIKE '%' || #{wgyy} || '%'
+            </if>
+        </where>
+    </select>
+
+</mapper>