From ec2cbf749e996ed7685ca903be740dae926579dc Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期一, 31 八月 2026 17:05:34 +0800
Subject: [PATCH] 瀹屽杽鍒峰崱鍏呯數璁㈠崟鏌ヨ鎺ュ彛

---
 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TCardChargingOrderMapper.xml |   61 ++++++++++++++----------------
 1 files changed, 29 insertions(+), 32 deletions(-)

diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TCardChargingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TCardChargingOrderMapper.xml
index d5fa099..877ce4e 100644
--- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TCardChargingOrderMapper.xml
+++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TCardChargingOrderMapper.xml
@@ -5,11 +5,14 @@
     <sql id="queryCondition">
         <where>
             o.del_flag = 0
+            <if test="query.siteIds != null and query.siteIds.size() > 0">
+                AND o.site_id IN
+                <foreach collection="query.siteIds" item="siteId" open="(" separator="," close=")">
+                    #{siteId}
+                </foreach>
+            </if>
             <if test="query.code != null and query.code != ''">
                 AND o.code LIKE CONCAT('%', #{query.code}, '%')
-            </if>
-            <if test="query.cardId != null">
-                AND o.card_id = #{query.cardId}
             </if>
             <if test="query.cardNo != null and query.cardNo != ''">
                 AND o.card_no LIKE CONCAT('%', #{query.cardNo}, '%')
@@ -26,51 +29,45 @@
             <if test="query.gunId != null">
                 AND o.charging_gun_id = #{query.gunId}
             </if>
-            <if test="query.startTime != null and query.startTime != ''">
-                AND o.start_time &gt;= #{query.startTime}
+            <if test="startTime1 != null and startTime1 != ''">
+                AND o.pay_time BETWEEN #{startTime1} AND #{startTime2}
             </if>
-            <if test="query.endTime != null and query.endTime != ''">
-                AND o.start_time &lt;= #{query.endTime}
+            <if test="endTime1 != null and endTime1 != ''">
+                AND o.end_time BETWEEN #{endTime1} AND #{endTime2}
             </if>
         </where>
     </sql>
 
-    <select id="pageList" resultType="java.util.LinkedHashMap">
-        SELECT o.id,
-               o.code,
-               o.card_id AS cardId,
-               o.card_no AS cardNo,
-               o.site_id AS siteId,
-               o.charging_pile_id AS chargingPileId,
-               o.charging_gun_id AS chargingGunId,
-               o.start_time AS startTime,
-               o.end_time AS endTime,
-               o.status,
-               o.order_amount AS orderAmount,
-               o.payment_amount AS paymentAmount,
-               o.electrovalence,
-               o.service_charge AS serviceCharge,
-               o.charging_capacity AS chargingCapacity,
-               o.balance_pay_amount AS balancePayAmount,
-               o.third_pay_amount AS thirdPayAmount,
-               o.refund_amount AS refundAmount,
-               o.pay_time AS payTime,
-               o.create_time AS createTime
+    <select id="pageList" resultType="com.ruoyi.order.api.vo.ChargingOrderVO">
+        SELECT o.*
         FROM t_card_charging_order o
         <include refid="queryCondition"/>
-        ORDER BY o.id DESC
+        ORDER BY o.create_time DESC
+        LIMIT #{offset}, #{pageSize}
+    </select>
+
+    <select id="count" resultType="long">
+        SELECT COUNT(1)
+        FROM t_card_charging_order o
+        <include refid="queryCondition"/>
     </select>
 
     <select id="summary" resultType="java.util.LinkedHashMap">
         SELECT COUNT(1) AS orderCount,
+               IFNULL(SUM(o.charging_capacity), 0) AS total,
+               IFNULL(SUM(TIMESTAMPDIFF(SECOND, o.start_time, o.end_time)), 0) AS time,
+               IFNULL(SUM(o.electrovalence), 0) AS electronicMoney,
+               IFNULL(SUM(o.service_charge), 0) AS serviceMoney,
+               IFNULL(SUM(o.electrovalence), 0) + IFNULL(SUM(o.service_charge), 0) AS income,
                IFNULL(SUM(o.order_amount), 0) AS orderAmount,
                IFNULL(SUM(o.payment_amount), 0) AS paymentAmount,
                IFNULL(SUM(o.electrovalence), 0) AS electrovalence,
                IFNULL(SUM(o.service_charge), 0) AS serviceCharge,
-               IFNULL(SUM(o.charging_capacity), 0) AS chargingCapacity,
-               IFNULL(SUM(o.balance_pay_amount), 0) AS balancePayAmount,
                IFNULL(SUM(o.third_pay_amount), 0) AS thirdPayAmount,
-               IFNULL(SUM(o.refund_amount), 0) AS refundAmount
+               0 AS platformIncome,
+               0 AS partnerIncome,
+               0 AS platformIncomeTotal,
+               0 AS partnerIncomeTotal
         FROM t_card_charging_order o
         <include refid="queryCondition"/>
     </select>

--
Gitblit v1.7.1