add data export

This commit is contained in:
Timi
2026-10-25 01:17:24 +08:00
parent c20f0b6f45
commit f3eddc69af
34 changed files with 1890 additions and 76 deletions
@@ -11,6 +11,10 @@
AND o.`purchased_at` >= #{beginAt}
AND o.`purchased_at` <= #{endAt}
</sql>
<sql id="operatingOrderFilter">
<include refid="orderFilter"/>
<if test="status == null">AND o.`status` &lt;&gt; 'CANCELLED'</if>
</sql>
<select id="selectDaily" resultType="com.imyeyu.api.modules.gao.vo.GaoSalesOrderDailyStatView">
SELECT
@@ -23,7 +27,7 @@
COALESCE(SUM(o.`paid_amount` - o.`refunded_amount`), 0) AS `netPaidAmount`
FROM `gao_sales_order` o
WHERE 1 = 1
<include refid="orderFilter"/>
<include refid="operatingOrderFilter"/>
GROUP BY DATE_FORMAT(FROM_UNIXTIME(o.`purchased_at` / 1000), '%Y%m%d')
ORDER BY `dateValue` ASC
</select>
@@ -38,7 +42,7 @@
COALESCE(SUM(o.`paid_amount` - o.`refunded_amount`), 0) AS `netPaidAmount`
FROM `gao_sales_order` o
WHERE 1 = 1
<include refid="orderFilter"/>
<include refid="operatingOrderFilter"/>
GROUP BY o.`order_type`
ORDER BY o.`order_type` ASC
</select>
@@ -50,11 +54,11 @@
COALESCE(SUM(o.`sale_amount`), 0) AS `saleAmount`,
COALESCE(SUM(o.`paid_amount`), 0) AS `paidAmount`,
COALESCE(SUM(o.`pending_paid_amount`), 0) AS `pendingPaidAmount`,
COALESCE(SUM(o.`sale_amount` - o.`paid_amount`), 0) AS `unpaidAmount`,
COALESCE(SUM(GREATEST(o.`sale_amount` - o.`paid_amount`, 0)), 0) AS `unpaidAmount`,
COALESCE(SUM(o.`refunded_amount`), 0) AS `refundedAmount`
FROM `gao_sales_order` o
WHERE 1 = 1
<include refid="orderFilter"/>
<include refid="operatingOrderFilter"/>
GROUP BY o.`payment_status`
ORDER BY o.`payment_status` ASC
</select>
@@ -72,8 +76,7 @@
FROM `gao_sales_order` o
LEFT JOIN `gao_customer` c ON c.`id` = o.`customer_id` AND c.`deleted_at` IS NULL
WHERE 1 = 1
<include refid="orderFilter"/>
<if test="status == null">AND o.`status` &lt;&gt; 'CANCELLED'</if>
<include refid="operatingOrderFilter"/>
GROUP BY o.`customer_id`, c.`code`, c.`name`
ORDER BY `netPaidAmount` DESC, `orderCount` DESC, o.`customer_id` ASC
LIMIT #{topN}
@@ -167,12 +170,12 @@
COALESCE(SUM(o.`sale_amount`), 0) AS `saleAmount`,
COALESCE(SUM(o.`paid_amount`), 0) AS `paidAmount`,
COALESCE(SUM(o.`pending_paid_amount`), 0) AS `pendingPaidAmount`,
COALESCE(SUM(o.`sale_amount` - o.`paid_amount`), 0) AS `unpaidAmount`,
COALESCE(SUM(GREATEST(o.`sale_amount` - o.`paid_amount`, 0)), 0) AS `unpaidAmount`,
COALESCE(SUM(o.`refunded_amount`), 0) AS `refundedAmount`,
COALESCE(SUM(o.`paid_amount` - o.`refunded_amount`), 0) AS `netPaidAmount`
FROM `gao_sales_order` o
WHERE 1 = 1
<include refid="orderFilter"/>
<include refid="operatingOrderFilter"/>
</select>
<select id="selectConsumptionDaily" resultType="com.imyeyu.api.modules.gao.vo.GaoSalesOrderConsumptionDailyStatView">
@@ -208,7 +211,7 @@
COALESCE(SUM(o.`paid_amount` - o.`refunded_amount`), 0) AS `netPaidAmount`
FROM `gao_sales_order` o
WHERE 1 = 1
<include refid="orderFilter"/>
<include refid="operatingOrderFilter"/>
GROUP BY DATE_FORMAT(FROM_UNIXTIME(o.`purchased_at` / 1000), '%Y%m%d')
ORDER BY `dateValue` ASC
</select>