feat(exporter): 增强SQL构建逻辑以支持供应商信息
在sqlbuilder.go中更新SQL构建逻辑,确保在导出数据时正确关联供应商名称。同时,在fields.go中更新字段标签以反映供应商名称的变化,提升导出数据的准确性和可读性。
This commit is contained in:
parent
84ab45da8c
commit
3a354a3d93
|
|
@ -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" {
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ 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": "支付时间",
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue