diff --git a/server/internal/exporter/sqlbuilder.go b/server/internal/exporter/sqlbuilder.go index a5c4ea7..7338ced 100644 --- a/server/internal/exporter/sqlbuilder.go +++ b/server/internal/exporter/sqlbuilder.go @@ -109,7 +109,8 @@ func BuildSQL(req BuildRequest, whitelist map[string]bool) (string, []interface{ continue } if f == "supplier_name" { - cols = append(cols, "'' AS `order.supplier_name`") + need["supplier"] = true + cols = append(cols, "`supplier`.name AS `order.supplier_name`") continue } if f == "is_inner" { diff --git a/server/internal/schema/fields.go b/server/internal/schema/fields.go index 593999e..26d07d0 100644 --- a/server/internal/schema/fields.go +++ b/server/internal/schema/fields.go @@ -34,8 +34,8 @@ func AllWhitelist() map[string]bool { "order.pay_time": true, "order.coupon_id": true, "order.discount_amount": true, - "order.supplier_product_name": true, - "order.supplier_name": true, + "order.supplier_product_name": true, + "order.supplier_name": true, "order.is_inner": true, "order.icon": true, "order.cost_price": true, @@ -252,16 +252,16 @@ func AllLabels() map[string]string { "order.create_time": "创建时间", "order.update_time": "更新时间", "order.official_price": "官方价", - "order.merchant_name": "分销商名称", + "order.merchant_name": "客户名称", "order.activity_name": "活动名称", "order.goods_name": "商品名称", "order.pay_time": "支付时间", "order.coupon_id": "优惠券ID", "order.discount_amount": "优惠金额", "order.card_code": "卡密(脱敏)", - "order.supplier_product_name": "供应商产品名称", - "order.supplier_name": "供应商名称", - "order.is_inner": "供应商类型", + "order.supplier_product_name": "供应商产品名称", + "order.supplier_name": "供应商名称", + "order.is_inner": "供应商类型", "order.icon": "订单图片", "order.cost_price": "成本价", "order.is_reset": "是否重置", @@ -446,7 +446,7 @@ func AllLabels() map[string]string { "activity.key_pay_button_text": "Key支付按钮文本", "activity.goods_pay_button_text": "商品支付按钮文本", "activity.is_open_db_transaction": "是否开启事务", - // removed bank_tag: not present in current YMT activity schema + // removed bank_tag: not present in current YMT activity schema } } diff --git a/server/internal/schema/ymt.go b/server/internal/schema/ymt.go index a39e9b5..07687e2 100644 --- a/server/internal/schema/ymt.go +++ b/server/internal/schema/ymt.go @@ -69,6 +69,9 @@ func (s ymtSchema) BuildJoins(need map[string]bool, main string) []string { if need["merchant"] { out = append(out, " LEFT JOIN `merchant` ON `merchant`.id = `order_info`.merchant_id") } + if need["supplier"] { + out = append(out, " LEFT JOIN `supplier` ON `supplier`.id = `order_info`.supplier_id") + } if need["activity"] { out = append(out, " LEFT JOIN `activity` ON `activity`.id = `order_info`.activity_id") }