Browse Source

一码管地全文检索service调整

chenendian 2 weeks ago
parent
commit
a5286e44a3

+ 1 - 6
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/ProjectController.java

@@ -158,18 +158,13 @@ public class ProjectController extends BaseController {
     @PostMapping("/listSearch")
     public R<Map<String, Object>> GetListByKeyWord(@RequestBody ProjectFilterVo projectFilterVo) {
         try {
-            Map<String, Object> projects = projectService.getList(projectFilterVo);
+            Map<String, Object> projects = projectService.getListSearch(projectFilterVo);
             return R.ok(projects);
         } catch (Exception e) {
             return R.fail(e.getMessage());
         }
-
-
-
     }
 
 
 
-
-
 }

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

@@ -4,6 +4,7 @@ import com.siwei.apply.domain.NodeLand;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -20,6 +21,10 @@ public interface NodeLandMapper {
      */
     Map<String, String> selectGeomByNodeId(String nodeId);
 
+
+    Integer selectCountGeomByNodeId(@Param("nodeIdList") List<String> nodeIdList);
+
+
     /**
      * 根据node_id和geom_db_id创建记录
      *

+ 8 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/ProjectMapper.java

@@ -62,4 +62,12 @@ public interface ProjectMapper {
 
     Project getProjectByNodeId(String nodeId);
 
+    /**
+     * 获取检索的项目列表
+     */
+    List<Project> getListSearch(ProjectFilterVo projectFilterVo);
+
+    Integer getSearchCount(ProjectFilterVo projectFilterVo);
+
+
 }

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

@@ -44,6 +44,25 @@
         GROUP BY nl.geom_db_id, tgd.shppath
     </select>
 
+    <!-- 根据node_id查询地块数量信息 -->
+    <select id="selectCountGeomByNodeId" >
+        SELECT
+            count(1) as "count"
+        FROM t_node_land nl
+                 LEFT JOIN t_geom_db_details gd ON nl.geom_db_id = gd.upload_id
+                 LEFT JOIN t_geom_db tgd ON nl.geom_db_id = tgd.id
+        <where>
+            <if test="nodeIdList != null and nodeIdList.size() > 0">
+                AND nl.node_id IN
+                <foreach collection="nodeIdList" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        AND gd.geom IS NOT NULL
+    </select>
+
+
     <!-- 根据node_id和geom_db_id创建记录 -->
     <insert id="insertByNodeIdAndGeomDbId">
         INSERT INTO t_node_land (

+ 46 - 1
siwei-modules/siwei-apply/src/main/resources/mapper/ProjectMapper.xml

@@ -145,6 +145,51 @@
         WHERE flow.node_id = #{nodeId}   LIMIT 1
     </select>
 
+    <select id="getListSearch" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo" resultMap="projectMap">
+        SELECT *
+        FROM t_project
+        <where>
+            <if test="keyWords != null and keyWords.size() > 0">
+                regexp_like(name,
+                <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
+                , 'i')
+                 OR
+                regexp_like(code,
+                <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
+                , 'i')
+                OR
+                regexp_like(company,
+                <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
+                , 'i')
+            </if>
+            <if test="isOnchain != null and isOnchain">
+                AND on_chain_num > 0
+            </if>
+        </where>
+        ORDER BY updated_at DESC
+        LIMIT #{pageSize} offset #{offset}
+    </select>
 
-
+    <select id="getSearchCount" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo" resultType="int">
+        SELECT COUNT(*)
+        FROM t_project
+        <where>
+            <if test="keyWords != null and keyWords.size() > 0">
+                regexp_like(name,
+                <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
+                , 'i')
+                OR
+                regexp_like(code,
+                <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
+                , 'i')
+                OR
+                regexp_like(company,
+                <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
+                , 'i')
+            </if>
+            <if test="isOnchain != null and isOnchain">
+                AND on_chain_num > 0
+            </if>
+        </where>
+    </select>
 </mapper>