1
0
Просмотр исходного кода

增加电子监管号及查询逻辑

chenendian 1 неделя назад
Родитель
Сommit
3d5d835e98
1 измененных файлов с 115 добавлено и 63 удалено
  1. 115 63
      siwei-modules/siwei-apply/src/main/resources/mapper/ProjectMapper.xml

+ 115 - 63
siwei-modules/siwei-apply/src/main/resources/mapper/ProjectMapper.xml

@@ -405,16 +405,16 @@
     <select id="getListSearch" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo"  resultMap="SearchProjectUnionMap">
             <if test="filterType==0 or filterType==1">
                 SELECT
-                P."id" AS ID,
-                P."name" AS NAME,
-                P."code" AS code,
-                P."company" AS company,
-                P."created_at" AS createAt,
-                P."updated_at" AS updateAt,
-                P."project_type" AS projectType,
-                P."on_chain_num" AS onChainNum,
-                P."creator_id" AS creatorId,
-                P."updated_at" AS updatedAt,
+                "id" AS ID,
+                "name" AS NAME,
+                "code" AS code,
+                "company" AS company,
+                "created_at" AS createAt,
+                "updated_at" AS updateAt,
+                "project_type" AS projectType,
+                "on_chain_num" AS onChainNum,
+                "creator_id" AS creatorId,
+                "updated_at" AS updatedAt,
                 '1'  AS selectType,
                 '' AS attachmentId,
                 '' AS nodeId,
@@ -423,37 +423,61 @@
                 ''  AS resourceCode,
                 ''  AS zl,
                 ''  AS area
-                FROM  PUBLIC.t_project P
-
+                from (
+                    SELECT P.*,
+                    (SELECT  hbcrfapfwh   FROM "public"."t_tdgy" 	WHERE   project_id  = P.id) hbcrfapfwh,
+                    (SELECT  hbcrhtbh   FROM "public"."t_tdgy"  WHERE   project_id  = P.id) hbcrhtbh,
+                    (SELECT  dzjgh   FROM "public"."t_tdgy" 	WHERE   project_id  = P.id) dzjgh
+                    FROM  PUBLIC.t_project P
+                    where 	 1=1
+                    <if test="isOnchain != null and isOnchain">
+                        AND on_chain_num > 0
+                    </if>
+                ) as t_out
                 <where>
                     <if test="keyWords != null and keyWords.size() > 0">
-                        regexp_like(P.name,
+                        regexp_like(t_out.name,
                         REGEXP_REPLACE(
                         <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
                         , '[\r\n\s]+', '', 'g')
                         , 'i')
                         OR
-                        regexp_like(P.code,
+                        regexp_like(t_out.code,
                         REGEXP_REPLACE(
                         <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
                         , '[\r\n\s]+', '', 'g')
                         , 'i')
                         OR
-                        regexp_like(P.company,
+                        regexp_like(t_out.company,
+                        REGEXP_REPLACE(
+                        <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
+                        , '[\r\n\s]+', '', 'g')
+                        , 'i')
+                        OR
+                        regexp_like(t_out.hbcrfapfwh,
+                        REGEXP_REPLACE(
+                        <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
+                        , '[\r\n\s]+', '', 'g')
+                        , 'i')
+                        OR
+                        regexp_like(t_out.hbcrhtbh,
+                        REGEXP_REPLACE(
+                        <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
+                        , '[\r\n\s]+', '', 'g')
+                        , 'i')
+                        OR
+                        regexp_like(t_out.dzjgh,
                         REGEXP_REPLACE(
                         <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
                         , '[\r\n\s]+', '', 'g')
                         , 'i')
-                    </if>
-                    <if test="isOnchain != null and isOnchain">
-                        AND on_chain_num > 0
                     </if>
                 </where>
             </if>
 
-                <if test="filterType==0">
-                    UNION
-                </if>
+            <if test="filterType==0">
+                UNION
+            </if>
 
             <if test="filterType==0 or filterType==2">
                 SELECT
@@ -530,6 +554,7 @@
                     <if test="keyWords != null and keyWords.size() > 0">
                         regexp_like((code.resource_immobile_code || code.resource_business_code || code.resource_project_code),
                         REGEXP_REPLACE(
+
                         <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
                         , '[\r\n\s]+', '', 'g')
                         , 'i')
@@ -693,51 +718,78 @@
     <select id="getSearchProjectCount" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo" resultType="int">
         SELECT COUNT(*)
         FROM (
-                SELECT
-                P."id" AS ID,
-                P."name" AS NAME,
-                P."code" AS code,
-                P."company" AS company,
-                P."created_at" AS createAt,
-                P."updated_at" AS updateAt,
-                P."project_type" AS projectType,
-                P."on_chain_num" AS onChainNum,
-                P."creator_id" AS creatorId,
-                P."updated_at" AS updatedAt,
-                '1'  AS selectType,
-                '' AS attachmentId,
-                '' AS nodeId  ,
-                '' AS fileName,
-                '' AS  filePath
-                FROM  PUBLIC.t_project P
-                <where>
-                    <if test="keyWords != null and keyWords.size() > 0">
-                        regexp_like(P.name,
-                        REGEXP_REPLACE(
-                        <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
-                        , '[\r\n\s]+', '', 'g')
-                        , 'i')
-                        OR
-                        regexp_like(P.code,
-                        REGEXP_REPLACE(
-                        <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
-                        , '[\r\n\s]+', '', 'g')
-                        , 'i')
-                        OR
-                        regexp_like(P.company,
-                        REGEXP_REPLACE(
-                        <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
-                        , '[\r\n\s]+', '', 'g')
-                        , 'i')
-                    </if>
-                    <if test="isOnchain != null and isOnchain">
-                        AND on_chain_num > 0
-                    </if>
-                </where>
+            SELECT
+            "id" AS ID,
+            "name" AS NAME,
+            "code" AS code,
+            "company" AS company,
+            "created_at" AS createAt,
+            "updated_at" AS updateAt,
+            "project_type" AS projectType,
+            "on_chain_num" AS onChainNum,
+            "creator_id" AS creatorId,
+            "updated_at" AS updatedAt,
+            '1'  AS selectType,
+            '' AS attachmentId,
+            '' AS nodeId,
+            '' AS fileName,
+            '' AS  filePath,
+            ''  AS resourceCode,
+            ''  AS zl,
+            ''  AS area
+            from (
+            SELECT P.*,
+            (SELECT  hbcrfapfwh   FROM "public"."t_tdgy" 	WHERE   project_id  = P.id) hbcrfapfwh,
+            (SELECT  hbcrhtbh   FROM "public"."t_tdgy"  WHERE   project_id  = P.id) hbcrhtbh,
+            (SELECT  dzjgh   FROM "public"."t_tdgy" 	WHERE   project_id  = P.id) dzjgh
+            FROM  PUBLIC.t_project P
+            where 	 1=1
+            <if test="isOnchain != null and isOnchain">
+                AND on_chain_num > 0
+            </if>
+            ) as t_out
+            <where>
+                <if test="keyWords != null and keyWords.size() > 0">
+                    regexp_like(t_out.name,
+                    REGEXP_REPLACE(
+                    <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
+                    , '[\r\n\s]+', '', 'g')
+                    , 'i')
+                    OR
+                    regexp_like(t_out.code,
+                    REGEXP_REPLACE(
+                    <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
+                    , '[\r\n\s]+', '', 'g')
+                    , 'i')
+                    OR
+                    regexp_like(t_out.company,
+                    REGEXP_REPLACE(
+                    <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
+                    , '[\r\n\s]+', '', 'g')
+                    , 'i')
+                    OR
+                    regexp_like(t_out.hbcrfapfwh,
+                    REGEXP_REPLACE(
+                    <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
+                    , '[\r\n\s]+', '', 'g')
+                    , 'i')
+                    OR
+                    regexp_like(t_out.hbcrhtbh,
+                    REGEXP_REPLACE(
+                    <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
+                    , '[\r\n\s]+', '', 'g')
+                    , 'i')
+                    OR
+                    regexp_like(t_out.dzjgh,
+                    REGEXP_REPLACE(
+                    <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
+                    , '[\r\n\s]+', '', 'g')
+                    , 'i')
+                </if>
+            </where>
         ) AS distinct_projects
     </select>
 
-
     <select id="getSearchAttachmentCount" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo" resultType="int">
         SELECT COUNT(*)
         FROM (