From a272c80f565aa5ace23820558fdb7cde636d15f0 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期二, 26 十一月 2024 09:51:27 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 business/src/main/resources/mapper/PlanMapper.xml |   52 +++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 37 insertions(+), 15 deletions(-)

diff --git a/business/src/main/resources/mapper/PlanMapper.xml b/business/src/main/resources/mapper/PlanMapper.xml
index f257919..b69243e 100644
--- a/business/src/main/resources/mapper/PlanMapper.xml
+++ b/business/src/main/resources/mapper/PlanMapper.xml
@@ -9,8 +9,23 @@
         <result column="month_status" property="monthStatus" />
         <result column="season_status" property="seasonStatus" />
         <result column="year_status" property="yearStatus" />
-        <result column="gmt_create_time" property="gmtCreateTime" />
-        <result column="gmt_update_time" property="gmtUpdateTime" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_update" property="gmtUpdate" />
+    </resultMap>
+
+    <!-- 鍒嗛〉鏉′欢鏌ヨ椤圭洰璁″垝璁板綍鏄犲皠缁撴灉 -->
+    <resultMap id="PageResultMap" type="com.ycl.domain.vo.ProjectPlanResponseVO">
+        <id property="id" column="id" />
+        <result property="projectName" column="project_name" />
+        <result property="reportStatus" column="report_status" />
+        <result property="projectCode" column="project_code" />
+        <result property="projectType" column="project_type" />
+        <result property="projectPhase" column="project_phase" />
+        <result property="monthStatus" column="month_status" />
+        <result property="seasonStatus" column="season_status" />
+        <result property="yearStatus" column="year_status" />
+        <result property="projectStatus" column="project_status" />
+        <result property="investType" column="invest_type" />
     </resultMap>
 
 
@@ -36,20 +51,27 @@
     </select>
 
 
-    <select id="getPage" resultMap="BaseResultMap">
-        SELECT
-            TP.project_info_id,
-            TP.report_status,
-            TP.month_status,
-            TP.season_status,
-            TP.year_status,
-            TP.gmt_create_time,
-            TP.gmt_update_time,
-            TP.id
-        FROM
-            t_plan TP
+    <select id="getPage" resultMap="PageResultMap">
+        SELECT DISTINCT
+            pi.id,
+            pi.project_name,
+            p.report_status,
+            pi.project_code,
+            pi.project_type,
+            pi.project_phase,
+            IFNULL((select report_status from t_project_plan_record
+             WHERE plan_time_flag = 0 AND project_info_id = pi.id ORDER BY create_time DESC LIMIT 1),1) as month_status,
+            IFNULL((select report_status from t_project_plan_record
+             WHERE plan_time_flag = 1 AND project_info_id = pi.id ORDER BY create_time DESC LIMIT 1),1) as season_status,
+            IFNULL((select report_status from t_project_plan_record
+             WHERE plan_time_flag = 2 AND project_info_id = pi.id ORDER BY create_time DESC LIMIT 1),1) as year_status,
+            pi.project_status,
+            pi.invest_type
+        FROM t_plan AS p
+            INNER JOIN t_project_info AS pi ON p.project_info_id = pi.id
+            INNER JOIN t_project_plan_record AS ppr ON p.id = ppr.plan_id
         WHERE
-            TP.deleted = 0
+            p.deleted = 0
     </select>
 
 </mapper>

--
Gitblit v1.8.0