| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763 |
- <?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.siwei.apply.mapper.ProjectMapper">
- <resultMap id="projectMap" type="com.siwei.apply.domain.Project">
- <id column="id" property="id"/>
- <result column="name" property="name"/>
- <result column="code" property="code"/>
- <result column="company" property="company"/>
- <result column="created_at" property="createAt"/>
- <result column="updated_at" property="updateAt"/>
- <result column="project_type" property="projectType"/>
- <result column="on_chain_num" property="onChainNum"/>
- <result column="creator_id" property="creatorId"/>
- <result column="first_plot_code" property="firstPlotCode"/>
- <result column="second_plot_code" property="secondPlotCode"/>
- </resultMap>
- <!-- 扩展映射:继承基础映射并添加特有字段 -->
- <resultMap id="SearchProjectMap" type="com.siwei.apply.domain.SearchProject" extends="projectMap">
- <result property="attachmentInfoList" column="attachmentInfoList" typeHandler="com.siwei.apply.handler.JsonTypeHandler"/>
- </resultMap>
- <!-- 扩展映射:继承基础映射并添加特有字段 -->
- <resultMap id="SearchProjectUnionMap" type="com.siwei.apply.domain.SearchProjectAndAttachment">
- </resultMap>
- <insert id="add" parameterType="com.siwei.apply.domain.Project">
- INSERT INTO t_project (id, name, code, company,
- created_at, updated_at, project_type,first_plot_code,second_plot_code, creator_id)
- VALUES (#{id}, #{name}, #{code}, #{company}, now(), now(), #{projectType},
- #{firstPlotCode},#{secondPlotCode},
- #{creatorId})
- </insert>
- <select id="get" resultMap="projectMap">
- SELECT *
- FROM t_project
- where t_project.id = #{id}
- </select>
- <select id="getList" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo" resultMap="projectMap">
- SELECT *
- FROM t_project
- <where>
- <if test="name != null and name != ''">
- AND name LIKE CONCAT('%', #{name}, '%')
- </if>
- <if test="code != null and code != ''">
- AND code LIKE CONCAT('%', #{code}, '%')
- </if>
- <if test="keyWord != null and keyWord != ''">
- AND (
- name LIKE CONCAT('%', #{keyWord}, '%')
- OR company LIKE CONCAT('%', #{keyWord}, '%')
- )
- </if>
- <if test="projectType != null and projectType != 0">
- AND project_type = #{projectType}
- </if>
- <if test="isOnchain != null and isOnchain==true">
- AND on_chain_num > 0
- </if>
- </where>
- ORDER BY updated_at DESC
- LIMIT #{pageSize} offset #{offset}
- </select>
- <select id="getCount" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo" resultType="int">
- SELECT COUNT(*)
- FROM t_project
- <where>
- <if test="name != null and name != ''">
- AND name LIKE CONCAT('%', #{name}, '%')
- </if>
- <if test="code != null and code != ''">
- AND code LIKE CONCAT('%', #{code}, '%')
- </if>
- <if test="keyWord != null and keyWord != ''">
- AND (
- name LIKE CONCAT('%', #{keyWord}, '%')
- OR company LIKE CONCAT('%', #{keyWord}, '%')
- )
- </if>
- <if test="projectType != null and projectType != 0">
- AND project_type = #{projectType}
- </if>
- <if test="isOnchain != null and isOnchain==true">
- AND on_chain_num > 0
- </if>
- </where>
- </select>
- <update id="update" parameterType="com.siwei.apply.domain.vo.ProjectUpdateVo">
- UPDATE t_project
- <set>
- <if test="name != null">name = #{name},</if>
- <if test="code != null">code = #{code},</if>
- <if test="company != null">company = #{company},</if>
- <if test="projectType != null">project_type = #{projectType},</if>
- <if test="onChainNum != null">on_chain_num = #{onChainNum},</if>
- <if test="firstPlotCode != null">first_plot_code = #{firstPlotCode},</if>
- <if test="secondPlotCode != null">second_plot_code = #{secondPlotCode},</if>
- updated_at = now()
- </set>
- WHERE id = #{id}
- </update>
- <delete id="batchDelete">
- DELETE FROM t_project
- WHERE id IN
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="getProjectTypeById" parameterType="string" resultType="int">
- SELECT project_type
- FROM t_project
- WHERE id = #{id}
- </select>
- <!-- 单一方法:一次返回 1/2 和总数的统计结果 -->
- <select id="countTypeStats" resultType="com.siwei.apply.domain.res.ProjectNumRes">
- SELECT
- SUM(CASE WHEN project_type = 1 THEN 1 ELSE 0 END) AS singleCount,
- SUM(CASE WHEN project_type = 2 THEN 1 ELSE 0 END) AS batchCount,
- COUNT(*) AS total
- FROM t_project where on_chain_num>0
- </select>
- <select id="selectOtherSupply" resultType="com.siwei.apply.domain.res.ProjectSupplyRes">
- SELECT
- '其他' AS gdType,
- '亩' AS gdUnit,
- CAST(0 AS double precision) AS gdArea,
- CAST(0 AS int) AS count
- </select>
- <select id="selectOtherSupplyExcludeProject" resultType="com.siwei.apply.domain.res.ProjectSupplyRes">
- SELECT
- '其他' AS gdType,
- '亩' AS gdUnit,
- COALESCE(
- SUM(
- CASE
- WHEN gd_unit = '0' THEN COALESCE(gd_area, 0) / 666.6666667
- WHEN gd_unit = '1' THEN COALESCE(gd_area, 0) * 15
- ELSE COALESCE(gd_area, 0)
- END
- ), 0
- ) AS gdArea,
- COUNT(*) AS count
- FROM t_tdgy
- WHERE project_id IS NULL OR project_id = ''
- </select>
- <!-- 根据节点获取项目信息-->
- <select id="getProjectByNodeId" resultMap="projectMap">
- SELECT project.* FROM "public"."t_project" project
- LEFT JOIN "public"."t_project_workflow" flow
- on flow.project_id=project.id
- WHERE flow.node_id = #{nodeId} LIMIT 1
- </select>
- <select id="getListSearchOld" 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="getSearchCountOld" 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>
- <select id="getListSearchOld2" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo" resultMap="SearchProjectMap">
- 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,
- COALESCE(
- jsonb_agg(
- CASE
- WHEN
- ${haveKeyWord}
- AND A."id" IS NOT NULL
- AND A."node_id" IS NOT NULL
- AND A."file_name" IS NOT NULL
- AND A."file_path" IS NOT NULL THEN
- jsonb_build_object('id', A.id,
- 'nodeId', A.node_id,
- 'fileName', A.file_name,
- 'filePath', A.file_path)
- ELSE NULL
- END
- ),'[]' -- 确保返回空数组而不是 null
- ) AS attachmentInfoList
- FROM
- public.t_project P
- LEFT JOIN
- public.t_project_attachment_info A ON P.id = A.project_id
- <if test="keyWords != null and keyWords.size() > 0">
- AND regexp_like(A.file_name,
- REGEXP_REPLACE(
- <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
- , '[\r\n\s]+', '', 'g')
- , 'i')
- </if>
- <where>
- <if test="keyWords != null and keyWords.size() > 0">
- regexp_like(P.name,
- <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
- , 'i')
- OR
- regexp_like(P.code,
- <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
- , 'i')
- OR
- regexp_like(P.company,
- <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
- , 'i')
- OR
- regexp_like(A.file_name,
- <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>
- GROUP BY
- P.id, P.name, P.code, P.company, P.created_at, P.updated_at, P.project_type, P.on_chain_num, P.creator_id
- ORDER BY
- updated_at DESC
- LIMIT #{pageSize} OFFSET #{offset}
- </select>
- <select id="getSearchCountOld2" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo" resultType="int">
- SELECT COUNT(*)
- FROM (
- SELECT DISTINCT
- 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
- FROM "public"."t_project" P
- LEFT JOIN public.t_project_attachment_info A ON P.id = A.project_id
- <if test="keyWords != null and keyWords.size() > 0">
- AND regexp_like(A.file_name,
- REGEXP_REPLACE(
- <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
- , '[\r\n\s]+', '', 'g')
- , 'i')
- </if>
- <where>
- <if test="keyWords != null and keyWords.size() > 0">
- regexp_like(P.name,
- <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
- , 'i')
- OR
- regexp_like(P.code,
- <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
- , 'i')
- OR
- regexp_like(P.company,
- <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
- , 'i')
- OR
- regexp_like(A.file_name,
- <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>
- ) AS distinct_projects
- </select>
- <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,
- '1' AS selectType,
- '' AS attachmentId,
- '' AS nodeId,
- '' AS fileName,
- '' AS filePath,
- '' AS resourceCode,
- '' AS zl,
- '' AS area
- 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>
- </if>
- <if test="filterType==0">
- UNION
- </if>
- <if test="filterType==0 or filterType==2">
- SELECT
- project."id" AS ID,
- project."name" AS NAME,
- project."code" AS code,
- project."company" AS company,
- project."created_at" AS createAt,
- project."updated_at" AS updateAt,
- project."project_type" AS projectType,
- project."on_chain_num" AS onChainNum,
- project."creator_id" AS creatorId,
- project."updated_at" AS updatedAt,
- '2' AS selectType,
- info.ID AS attachmentId,
- info.node_id AS nodeId,
- info.file_name AS fileName,
- info.file_path AS filePath,
- '' AS resourceCode,
- '' AS zl,
- '' AS area
- FROM PUBLIC.t_project_attachment_info info
- LEFT JOIN t_project project on info.project_id=project.id
- <where>
- <if test="keyWords != null and keyWords.size() > 0">
- regexp_like(info.file_name,
- REGEXP_REPLACE(
- <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
- , '[\r\n\s]+', '', 'g')
- , 'i')
- </if>
- AND project.id is not null
- <if test="isOnchain != null and isOnchain">
- AND on_chain_num > 0
- </if>
- </where>
- </if>
- <if test="filterType==0">
- UNION
- </if>
- <if test="filterType==0 or filterType==3">
- SELECT
- project."id" AS ID,
- project."name" AS NAME,
- project."code" AS code,
- project."company" AS company,
- project."created_at" AS createAt,
- project."updated_at" AS updateAt,
- project."project_type" AS projectType,
- project."on_chain_num" AS onChainNum,
- project."creator_id" AS creatorId,
- project."updated_at" AS updatedAt,
- '3' AS selectType,
- '' AS attachmentId,
- '' AS nodeId,
- '' AS fileName,
- '' AS filePath,
- (code.resource_immobile_code || code.resource_business_code || code.resource_project_code) AS resourceCode,
- details.zl AS zl,
- CAST(ROUND(details.geom_area, 2) AS VARCHAR) AS area
- FROM
- (SELECT DISTINCT ON (project_id)
- project_id,
- land_code,
- code.resource_immobile_code,
- code.resource_business_code,
- code.resource_project_code
- FROM public.t_land_one_code code
- ORDER BY project_id) code
- LEFT JOIN "public"."t_node_land" node on code.land_code =node.id
- LEFT JOIN "public"."t_geom_db_details" details on node.geom_db_id =details.upload_id
- LEFT JOIN "public"."t_project" project on code.project_id =project.id
- <where>
- <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')
- </if>
- AND project.id is not null
- <if test="isOnchain != null and isOnchain">
- AND on_chain_num > 0
- </if>
- </where>
- </if>
- ORDER BY
- updatedAt DESC
- LIMIT #{pageSize} OFFSET #{offset}
- </select>
- <select id="getSearchCount" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo" resultType="int">
- SELECT COUNT(*)
- FROM (
- <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,
- '1' AS selectType,
- '' AS attachmentId,
- '' AS nodeId ,
- '' AS fileName,
- '' AS filePath,
- '' AS resourceCode,
- '' AS zl,
- '' AS area
- 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>
- </if>
- <if test="filterType==0">
- UNION
- </if>
- <if test="filterType==0 or filterType==2">
- SELECT
- project."id" AS ID,
- project."name" AS NAME,
- project."code" AS code,
- project."company" AS company,
- project."created_at" AS createAt,
- project."updated_at" AS updateAt,
- project."project_type" AS projectType,
- project."on_chain_num" AS onChainNum,
- project."creator_id" AS creatorId,
- project."updated_at" AS updatedAt,
- '2' AS selectType,
- info.ID AS attachmentId,
- info.node_id AS nodeId,
- info.file_name AS fileName,
- info.file_path AS filePath,
- '' AS resourceCode,
- '' AS zl,
- '' AS area
- FROM PUBLIC.t_project_attachment_info info
- LEFT JOIN t_project project on info.project_id=project.id
- <where>
- <if test="keyWords != null and keyWords.size() > 0">
- regexp_like(info.file_name,
- REGEXP_REPLACE(
- <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
- , '[\r\n\s]+', '', 'g')
- , 'i')
- </if>
- AND project.id is not null
- <if test="isOnchain != null and isOnchain">
- AND on_chain_num > 0
- </if>
- </where>
- </if>
- <if test="filterType==0">
- UNION
- </if>
- <if test="filterType==0 or filterType==3">
- SELECT
- project."id" AS ID,
- project."name" AS NAME,
- project."code" AS code,
- project."company" AS company,
- project."created_at" AS createAt,
- project."updated_at" AS updateAt,
- project."project_type" AS projectType,
- project."on_chain_num" AS onChainNum,
- project."creator_id" AS creatorId,
- project."updated_at" AS updatedAt,
- '3' AS selectType,
- '' AS attachmentId,
- '' AS nodeId ,
- '' AS fileName,
- '' AS filePath,
- (code.resource_immobile_code || code.resource_business_code || code.resource_project_code) AS resourceCode,
- details.zl AS zl,
- CAST(ROUND(details.geom_area, 2) AS VARCHAR) AS area
- FROM
- (SELECT DISTINCT ON (project_id)
- project_id,
- land_code,
- code.resource_immobile_code,
- code.resource_business_code,
- code.resource_project_code
- FROM public.t_land_one_code code
- ORDER BY project_id) code
- LEFT JOIN "public"."t_node_land" node on code.land_code =node.id
- LEFT JOIN "public"."t_geom_db_details" details on node.geom_db_id =details.upload_id
- LEFT JOIN "public"."t_project" project on code.project_id =project.id
- <where>
- <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')
- </if>
- AND project.id is not null
- <if test="isOnchain != null and isOnchain">
- AND on_chain_num > 0
- </if>
- </where>
- </if>
- ) AS distinct_projects
- </select>
- <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>
- ) AS distinct_projects
- </select>
- <select id="getSearchAttachmentCount" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo" resultType="int">
- SELECT COUNT(*)
- FROM (
- SELECT
- project."id" AS ID,
- project."name" AS NAME,
- project."code" AS code,
- project."company" AS company,
- project."created_at" AS createAt,
- project."updated_at" AS updateAt,
- project."project_type" AS projectType,
- project."on_chain_num" AS onChainNum,
- project."creator_id" AS creatorId,
- project."updated_at" AS updatedAt,
- '2' AS selectType,
- info.ID AS attachmentId,
- info.node_id AS nodeId,
- info.file_name AS fileName,
- info.file_path AS filePath
- FROM PUBLIC.t_project_attachment_info info
- LEFT JOIN t_project project on info.project_id=project.id
- <where>
- <if test="keyWords != null and keyWords.size() > 0">
- regexp_like(info.file_name,
- REGEXP_REPLACE(
- <foreach collection="keyWords" item="word" open="'(" separator="|" close=")'" >${word}</foreach>
- , '[\r\n\s]+', '', 'g')
- , 'i')
- </if>
- AND project.id is not null
- <if test="isOnchain != null and isOnchain">
- AND on_chain_num > 0
- </if>
- </where>
- ) AS distinct_projects
- </select>
- <select id="getSearchGraphicLayerCount" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo" resultType="int">
- SELECT COUNT(*)
- FROM (
- SELECT
- project."id" AS ID,
- project."name" AS NAME,
- project."code" AS code,
- project."company" AS company,
- project."created_at" AS createAt,
- project."updated_at" AS updateAt,
- project."project_type" AS projectType,
- project."on_chain_num" AS onChainNum,
- project."creator_id" AS creatorId,
- project."updated_at" AS updatedAt,
- '3' AS selectType,
- '' AS attachmentId,
- '' AS nodeId,
- '' AS fileName,
- '' AS filePath,
- (code.resource_immobile_code || code.resource_business_code || code.resource_project_code) AS resourceCode,
- details.zl AS zl,
- CAST(ROUND(details.geom_area, 2) AS VARCHAR) AS area
- FROM
- (SELECT DISTINCT ON (project_id)
- project_id,
- land_code,
- code.resource_immobile_code,
- code.resource_business_code,
- code.resource_project_code
- FROM public.t_land_one_code code
- ORDER BY project_id) code
- LEFT JOIN "public"."t_node_land" node on code.land_code =node.id
- LEFT JOIN "public"."t_geom_db_details" details on node.geom_db_id =details.upload_id
- LEFT JOIN "public"."t_project" project on code.project_id =project.id
- <where>
- <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')
- </if>
- AND project.id is not null
- <if test="isOnchain != null and isOnchain">
- AND on_chain_num > 0
- </if>
- </where>
- ) AS distinct_projects
- </select>
- <delete id="deleteNodeByTable">
- DELETE FROM ${tableName}
- WHERE id = #{nodeId}
- </delete>
- </mapper>
|