From 55d1554e136bec6a9d356ab92ebf5d2689548369 Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Mon, 5 Jan 2026 13:46:25 +0800 Subject: [PATCH] =?UTF-8?q?Updata=EF=BC=9A=E4=BF=AE=E6=AD=A3=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/bundleMetrics.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/dao/bundleMetrics.go b/internal/dao/bundleMetrics.go index 42a7d63..d5d8d09 100644 --- a/internal/dao/bundleMetrics.go +++ b/internal/dao/bundleMetrics.go @@ -20,7 +20,7 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi // ---------- 总金额统计 ---------- subQuery := app.ModuleClients.BundleDB.Model(&model.Reconciliation{}). Select("TRUNCATE(COALESCE(SUM(CAST(handling_fee AS DECIMAL(12,3))), 0), 3) as total_fee_payment_amount"). - Joins("LEFT JOIN bundle_order_records bor ON bor.order_no = bundle_order_on"). + Joins("LEFT JOIN bundle_order_records bor ON bor.order_no COLLATE utf8mb4_general_ci = reconciliation.bundle_order_on COLLATE utf8mb4_general_ci"). Where("bor.deleted_at is null and bor.status=2") // if req.BundleUuid != "" { // subQuery = subQuery.Where("bor.bundle_uuid = ?", req.BundleUuid) @@ -72,7 +72,7 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi subQuery = app.ModuleClients.BundleDB.Model(&model.Reconciliation{}). Select("SUM(handling_fee) as new_fee_payment_amount, SUM(pay_amount) as new_payment_amount"). - Joins("LEFT JOIN bundle_order_records bor ON bor.order_no = bundle_order_on"). + Joins("LEFT JOIN bundle_order_records bor ON bor.order_no COLLATE utf8mb4_general_ci = bundle_order_on COLLATE utf8mb4_general_ci"). Where("`reconciliation`.pay_time >= ?", req.Start+" 00:00:00"). Where("`reconciliation`.pay_time <= ?", req.End+" 23:59:59"). Where("`reconciliation`.deleted_at is null and reconciliation.pay_status = 2 and bor.status=2 and bor.deleted_at is null")