|
|
@@ -23,12 +23,6 @@
|
|
|
</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)
|
|
|
@@ -211,7 +205,7 @@
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
- <select id="getListSearchOld2" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo" resultMap="SearchProjectMap">
|
|
|
+ <select id="getListSearch" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo" resultMap="SearchProjectMap">
|
|
|
SELECT
|
|
|
P."id" AS id,
|
|
|
P."name" AS name,
|
|
|
@@ -279,7 +273,7 @@
|
|
|
LIMIT #{pageSize} OFFSET #{offset}
|
|
|
</select>
|
|
|
|
|
|
- <select id="getSearchCountOld2" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo" resultType="int">
|
|
|
+ <select id="getSearchCount" parameterType="com.siwei.apply.domain.vo.ProjectFilterVo" resultType="int">
|
|
|
SELECT COUNT(*)
|
|
|
FROM (
|
|
|
SELECT DISTINCT
|
|
|
@@ -326,182 +320,6 @@
|
|
|
) 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
|
|
|
- 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
|
|
|
- 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>
|
|
|
- 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
|
|
|
- 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
|
|
|
- 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>
|
|
|
- ) AS distinct_projects
|
|
|
- </select>
|
|
|
-
|
|
|
|
|
|
<delete id="deleteNodeByTable">
|
|
|
DELETE FROM ${tableName}
|