feat(exporter): 添加订单重试状态的SQL构建逻辑

This commit is contained in:
zhouyonggao 2025-12-12 18:32:03 +08:00
parent 8e6b55f003
commit 582a5daeea
1 changed files with 9 additions and 0 deletions

View File

@ -99,6 +99,10 @@ func BuildSQL(req BuildRequest, whitelist map[string]bool) (string, []interface{
cols = append(cols, "CASE `"+mt+"`.pay_status WHEN 1 THEN '待支付' WHEN 2 THEN '支付中' WHEN 3 THEN '已支付' WHEN 4 THEN '取消支付' WHEN 5 THEN '退款中' WHEN 6 THEN '退款成功' ELSE '' END AS `order.pay_status`") cols = append(cols, "CASE `"+mt+"`.pay_status WHEN 1 THEN '待支付' WHEN 2 THEN '支付中' WHEN 3 THEN '已支付' WHEN 4 THEN '取消支付' WHEN 5 THEN '退款中' WHEN 6 THEN '退款成功' ELSE '' END AS `order.pay_status`")
continue continue
} }
if f == "is_retry" {
cols = append(cols, "CASE `"+mt+"`.is_retry WHEN 0 THEN '可以失败重试' WHEN 1 THEN '可以失败重试' WHEN 2 THEN '不可以失败重试' ELSE '' END AS `order.is_retry`")
continue
}
if f == "supplier_name" { if f == "supplier_name" {
cols = append(cols, "'' AS `order.supplier_name`") cols = append(cols, "'' AS `order.supplier_name`")
continue continue
@ -120,6 +124,11 @@ func BuildSQL(req BuildRequest, whitelist map[string]bool) (string, []interface{
continue continue
} }
} }
// Generic mapping for order.is_retry across datasources
if t == "order" && f == "is_retry" {
cols = append(cols, "CASE `"+mt+"`.is_retry WHEN 0 THEN '可以失败重试' WHEN 1 THEN '可以失败重试' WHEN 2 THEN '不可以失败重试' ELSE '' END AS `order.is_retry`")
continue
}
// Generic mapping for order.is_inner across datasources // Generic mapping for order.is_inner across datasources
if t == "order" && f == "is_inner" { if t == "order" && f == "is_inner" {
cols = append(cols, "CASE `"+mt+"`.is_inner WHEN 1 THEN '内部供应商' ELSE '外部供应商' END AS `order.is_inner`") cols = append(cols, "CASE `"+mt+"`.is_inner WHEN 1 THEN '内部供应商' ELSE '外部供应商' END AS `order.is_inner`")