From 528658799b844839502e824bbf540c6827588427 Mon Sep 17 00:00:00 2001
From: houruijun <411269194@kidgrow.com>
Date: Tue, 20 Oct 2020 19:17:05 +0800
Subject: [PATCH] 增加到期套餐查询功能

---
 kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderDetailMapper.xml |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderDetailMapper.xml b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderDetailMapper.xml
index 14d010c..892860e 100644
--- a/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderDetailMapper.xml
+++ b/kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderDetailMapper.xml
@@ -264,4 +264,64 @@
 ORDER BY
 	create_time DESC
     </select>
+
+    <select id="productEndList" resultType="com.kidgrow.oprationcenter.vo.ProductEndVo">
+        SELECT
+        id,
+        pro_id,
+        pro_begintime beginTime,
+        MIN( T2.pro_endtime ) endTime,
+        MIN( T2.ailight_count ) ailight_count,
+        pro_type,
+        pro_name,
+        T2.hospital_id,
+        hospital_name,
+        T2.department_id,
+        department_name
+        FROM
+        (
+        SELECT
+        details.id id,
+        details.pro_id,
+        details.pro_begintime pro_begintime,
+        details.pro_endtime pro_endtime,
+        details.ailight_count,
+        details.pro_name pro_name,
+        details.pro_type pro_type,
+        orders.hospital_id hospital_id,
+        orders.hospital_name hospital_name,
+        orders.department_id department_id,
+        orders.department_name department_name
+        FROM
+        product_order_detail details
+        LEFT JOIN product_order orders ON orders.id = details.order_id
+        WHERE
+        details.is_del = 0
+        AND details.enabled = 1
+        AND orders.is_del = 0
+        AND orders.enabled = 1
+        AND pro_endtime BETWEEN now() AND DATE_ADD(NOW(), INTERVAL ${monthPar} MONTH)
+        AND ailight_count BETWEEN 1 AND ${aiCountPar}
+        AND pro_type=1
+        ORDER BY
+        ailight_count,
+        pro_endtime
+        ) AS T2
+        GROUP BY
+        department_id,
+        hospital_id,
+        department_name,
+        hospital_name,
+        id,
+        pro_id,
+        pro_type,
+        pro_name,
+        ailight_count,
+        pro_endtime,
+        pro_begintime
+        ORDER BY
+        ailight_count,
+        pro_endtime,
+        department_id
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0