From ec07687838713fa8ec2e654f50f43d253e507bc5 Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期三, 01 四月 2026 10:39:35 +0800
Subject: [PATCH] 兼容postgresql

---
 business/src/main/resources/mapper/ProjectInfoMapper.xml |   58 +++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 35 insertions(+), 23 deletions(-)

diff --git a/business/src/main/resources/mapper/ProjectInfoMapper.xml b/business/src/main/resources/mapper/ProjectInfoMapper.xml
index 7704f4a..0f4c27e 100644
--- a/business/src/main/resources/mapper/ProjectInfoMapper.xml
+++ b/business/src/main/resources/mapper/ProjectInfoMapper.xml
@@ -26,6 +26,8 @@
             TPI.project_phase,
             TPI.tag,
             TPI.competent_department,
+            TPI.competent_department_phone,
+            TPI.competent_department_person,
             TPI.area,
             TPI.management_centralization,
             TPI.project_approval_type,
@@ -106,14 +108,17 @@
             d.dept_name as project_owner_unit_name
         FROM
             t_project_info TPI
-        LEFT JOIN t_project_investment_funding TPIF ON TPI.id = TPIF.project_id and TPIF.deleted = 0
-        LEFT JOIN t_project_investment_info TPII ON TPI.id = TPII.project_id and TPII.deleted = 0
-        LEFT JOIN t_project_investment_policy_compliance TPIPC ON TPI.id = TPIPC.project_id and TPIPC.deleted = 0
-        LEFT JOIN t_project_unit_registration_info TPURI ON TPI.id = TPURI.project_id and TPURI.deleted = 0
-        LEFT JOIN t_project_process TPP ON TPI.id = TPP.project_id and TPP.deleted = 0
-        LEFT JOIN sys_dept d ON d.dept_id = TPI.project_owner_unit
+        LEFT JOIN t_project_investment_funding TPIF ON CONCAT('', TPI.id) = CONCAT('', TPIF.project_id) and TPIF.deleted = 0
+        LEFT JOIN t_project_investment_info TPII ON CONCAT('', TPI.id) = CONCAT('', TPII.project_id) and TPII.deleted = 0
+        LEFT JOIN t_project_investment_policy_compliance TPIPC ON CONCAT('', TPI.id) = CONCAT('', TPIPC.project_id) and TPIPC.deleted = 0
+        LEFT JOIN t_project_unit_registration_info TPURI ON CONCAT('', TPI.id) = CONCAT('', TPURI.project_id) and TPURI.deleted = 0
+        LEFT JOIN t_project_process TPP ON CONCAT('', TPI.id) = CONCAT('', TPP.project_id) and TPP.deleted = 0
+        LEFT JOIN sys_dept d ON CONCAT('', d.dept_id) = TPI.project_owner_unit
         <where>
             TPI.deleted = 0
+            <if test="query.coding !=null and query.coding!=''">
+                and TPI.coding = #{query.coding}
+            </if>
             <if test="query.projectName !=null and query.projectName!=''">
                 and TPI.project_name like concat('%',#{query.projectName},'%')
             </if>
@@ -162,28 +167,34 @@
 <!--            <if test="query.reserveOrPrevious != null and query.reserveOrPrevious == 'previous'">-->
 <!--                and TPP.process_ins_id is not null-->
 <!--            </if>-->
-            <if test="query.projectPhase == 3">
-                and (TPI.project_status = 'working' or TPI.project_status = 'stop')
-            </if>
-            <if test="query.projectPhase == null">
-                <if test="query.role != null and query.role == 1">
-                    and TPI.used_status = 1 and  FIND_IN_SET(#{query.competentDepartment}, TPI.competent_department) > 0
-                </if>
-            </if>
+<!--            <if test="query.projectPhase == 3">-->
+<!--                and (TPI.project_status = 'working' or TPI.project_status = 'stop')-->
+<!--            </if>-->
+<!--                <if test="query.role != null and query.role == 1">-->
+<!--                    and TPI.competent_department = #{query.competentDepartment}-->
+<!--                </if>-->
             <!-- 涓氫富鏁版嵁鏉冮檺 -->
             <if test="query.role != null and query.role == 0">
                 ${query.params.dataScope}
             </if>
         </where>
-        order by TPI.id DESC
+        ORDER BY
+            CASE
+                WHEN TPI.used_status = 1 THEN 1
+                WHEN TPI.used_status = -1 THEN 2
+                WHEN TPI.used_status = 0 THEN 3
+                WHEN TPI.used_status = 2 THEN 4
+                ELSE 5
+            END,
+            TPI.gmt_create ASC
     </select>
 
     <select id="homeCount" parameterType="com.ycl.common.core.domain.BaseEntity" resultType="com.ycl.domain.vo.ProjectVO">
         SELECT TPI.*,TPIF.total_investment,TPP.process_ins_id as processId
         FROM t_project_info TPI
-        LEFT JOIN t_project_investment_funding TPIF ON TPI.id = TPIF.project_id and TPIF.deleted = 0
-        LEFT JOIN t_project_process TPP ON TPI.id = TPP.project_id and TPP.deleted = 0
-        LEFT JOIN sys_dept d ON TPI.project_owner_unit = d.dept_id
+        LEFT JOIN t_project_investment_funding TPIF ON CONCAT('', TPI.id) = CONCAT('', TPIF.project_id) and TPIF.deleted = 0
+        LEFT JOIN t_project_process TPP ON CONCAT('', TPI.id) = CONCAT('', TPP.project_id) and TPP.deleted = 0
+        LEFT JOIN sys_dept d ON TPI.project_owner_unit = CONCAT('', d.dept_id)
         <where>
             TPI.deleted = 0 AND TPI.used_status = 2
             ${params.dataScope}
@@ -194,7 +205,8 @@
     <select id="selectProjectDetailByIds" resultType="com.ycl.domain.vo.ProjectVO">
         select
         TPI.id as id,TPI.project_name,TPI.project_code,TPI.attract_investment,TPI.content,TPI.construction_nature,TPI.project_type,TPI.project_sub_type,TPI.project_status,TPI.fund_type,TPI.invest_type,TPI.project_phase,
-        TPI.tag,TPI.competent_department,TPI.area,TPI.management_centralization,TPI.project_approval_type,TPI.importance_type,TPI.year,TPI.year_invest_amount,TPI.create_project_time,TPI.plan_start_time,
+        TPI.tag,TPI.competent_department, TPI.competent_department_person, TPI.competent_department_phone,
+        TPI.area,TPI.management_centralization,TPI.project_approval_type,TPI.importance_type,TPI.year,TPI.year_invest_amount,TPI.create_project_time,TPI.plan_start_time,
         TPI.plan_complete_time,TPI.win_unit,TPI.win_amount,TPI.win_time,TPI.project_address,TPI.longitude,TPI.latitude,
         TPI.project_owner_unit,TPI.project_contact_person,TPI.contact,TPI.gmt_create,TPI.gmt_update,TPI.update_by,TPI.create_by,
         TPIF.id,TPIF.project_id,TPIF.total_investment,TPIF.principal,TPIF.government_investment_total,TPIF.central_investment_total,TPIF.central_budget_investment,TPIF.central_fiscal_investment,TPIF.central_special_bond_investment,
@@ -217,10 +229,10 @@
         TPURI.legal_representative,TPURI.fixed_phone,TPURI.legal_person_idcard,TPURI.project_contact_person,TPURI.phone,TPURI.contact_idcard,
         TPURI.wechat,TPURI.contact_address,TPURI.post_code,TPURI.email,TPURI.create_by,TPURI.update_by,TPURI.gmt_create,TPURI.gmt_update
         from t_project_info TPI
-        left join t_project_investment_funding TPIF on TPI.id = TPIF.project_id and TPIF.deleted = 0
-        left join t_project_investment_info TPII on TPI.id = TPII.project_id and TPII.deleted = 0
-        left join t_project_unit_registration_info TPURI on TPI.id = TPURI.project_id and TPURI.deleted = 0
-        left join t_project_investment_policy_compliance TPIPC on TPI.id = TPIPC.project_id and TPIPC.deleted = 0
+        left join t_project_investment_funding TPIF on CONCAT('', TPI.id) = CONCAT('', TPIF.project_id) and TPIF.deleted = 0
+        left join t_project_investment_info TPII on CONCAT('', TPI.id) = CONCAT('', TPII.project_id) and TPII.deleted = 0
+        left join t_project_unit_registration_info TPURI on CONCAT('', TPI.id) = CONCAT('', TPURI.project_id) and TPURI.deleted = 0
+        left join t_project_investment_policy_compliance TPIPC on CONCAT('', TPI.id) = CONCAT('', TPIPC.project_id) and TPIPC.deleted = 0
         <where>
             TPI.deleted =0
             <if test="dataIdList != null and dataIdList.size > 0">

--
Gitblit v1.8.0