fix: 统一供应商类型字段标签和SQL映射逻辑

修改order.is_inner和merchant.third_party字段的标签为"供应商类型"
添加SQL构建逻辑将is_inner和third_party字段值映射为"内部供应商"或"外部供应商"
This commit is contained in:
zhouyonggao 2025-12-12 18:28:00 +08:00
parent a2c6f2a08d
commit 8e6b55f003
3 changed files with 19 additions and 4 deletions

View File

@ -411,7 +411,7 @@ func ymtMetadataTables() []tableInfo {
{Key: "merchant.merchant_no", Field: "merchant_no", Label: "商户编码", Hidden: false}, {Key: "merchant.merchant_no", Field: "merchant_no", Label: "商户编码", Hidden: false},
{Key: "merchant.name", Field: "name", Label: "客户名称", Hidden: false}, {Key: "merchant.name", Field: "name", Label: "客户名称", Hidden: false},
{Key: "merchant.subject", Field: "subject", Label: "客户主体", Hidden: false}, {Key: "merchant.subject", Field: "subject", Label: "客户主体", Hidden: false},
{Key: "merchant.third_party", Field: "third_party", Label: "客户类型", Hidden: false}, {Key: "merchant.third_party", Field: "third_party", Label: "供应商类型", Hidden: false},
{Key: "merchant.status", Field: "status", Label: "状态 1:正常 2:冻结", Hidden: true}, {Key: "merchant.status", Field: "status", Label: "状态 1:正常 2:冻结", Hidden: true},
{Key: "merchant.balance", Field: "balance", Label: "分销商余额", Hidden: true}, {Key: "merchant.balance", Field: "balance", Label: "分销商余额", Hidden: true},
{Key: "merchant.total_consumption", Field: "total_consumption", Label: "累计消费", Hidden: true}, {Key: "merchant.total_consumption", Field: "total_consumption", Label: "累计消费", Hidden: true},
@ -448,7 +448,7 @@ func ymtMetadataTables() []tableInfo {
{Key: "order.num", Field: "num", Label: "购买数量", Hidden: false}, {Key: "order.num", Field: "num", Label: "购买数量", Hidden: false},
{Key: "order.pay_status", Field: "pay_status", Label: "支付状态", Hidden: false}, {Key: "order.pay_status", Field: "pay_status", Label: "支付状态", Hidden: false},
{Key: "order.supplier_product_name", Field: "supplier_product_name", Label: "供应商产品名称", Hidden: false}, {Key: "order.supplier_product_name", Field: "supplier_product_name", Label: "供应商产品名称", Hidden: false},
{Key: "order.key_batch_id", Field: "key_batch_id", Label: "key批次", Hidden: true}, {Key: "order.key_batch_id", Field: "key_batch_id", Label: "key批次", Hidden: true},
{Key: "order.is_inner", Field: "is_inner", Label: "是否内部供应商订单", Hidden: false}, {Key: "order.is_inner", Field: "is_inner", Label: "是否内部供应商订单", Hidden: false},
{Key: "order.icon", Field: "icon", Label: "订单图片", Hidden: false}, {Key: "order.icon", Field: "icon", Label: "订单图片", Hidden: false},
{Key: "order.cost_price", Field: "cost_price", Label: "成本单价", Hidden: false}, {Key: "order.cost_price", Field: "cost_price", Label: "成本单价", Hidden: false},

View File

@ -103,6 +103,10 @@ func BuildSQL(req BuildRequest, whitelist map[string]bool) (string, []interface{
cols = append(cols, "'' AS `order.supplier_name`") cols = append(cols, "'' AS `order.supplier_name`")
continue continue
} }
if f == "is_inner" {
cols = append(cols, "CASE `"+mt+"`.is_inner WHEN 1 THEN '内部供应商' ELSE '外部供应商' END AS `order.is_inner`")
continue
}
} }
if req.Datasource == "ymt" && t == "activity" { if req.Datasource == "ymt" && t == "activity" {
if f == "settlement_type" { if f == "settlement_type" {
@ -110,6 +114,17 @@ func BuildSQL(req BuildRequest, whitelist map[string]bool) (string, []interface{
continue continue
} }
} }
if t == "merchant" {
if f == "third_party" {
cols = append(cols, "CASE `"+mt+"`.third_party WHEN 1 THEN '外部供应商' WHEN 2 THEN '内部供应商' ELSE '' END AS `merchant.third_party`")
continue
}
}
// Generic mapping for order.is_inner across datasources
if t == "order" && f == "is_inner" {
cols = append(cols, "CASE `"+mt+"`.is_inner WHEN 1 THEN '内部供应商' ELSE '外部供应商' END AS `order.is_inner`")
continue
}
if req.Datasource == "ymt" && t == "order_digit" { if req.Datasource == "ymt" && t == "order_digit" {
if f == "order_type" { if f == "order_type" {
cols = append(cols, "CASE `"+mt+"`.order_type WHEN 1 THEN '直充' WHEN 2 THEN '卡密' ELSE '' END AS `order_digit.order_type`") cols = append(cols, "CASE `"+mt+"`.order_type WHEN 1 THEN '直充' WHEN 2 THEN '卡密' ELSE '' END AS `order_digit.order_type`")

View File

@ -262,7 +262,7 @@ func AllLabels() map[string]string {
"order.card_code": "卡密(脱敏)", "order.card_code": "卡密(脱敏)",
"order.supplier_product_name": "供应商产品名称", "order.supplier_product_name": "供应商产品名称",
"order.supplier_name": "供应商名称", "order.supplier_name": "供应商名称",
"order.is_inner": "内部供应商订单", "order.is_inner": "供应商类型",
"order.icon": "订单图片", "order.icon": "订单图片",
"order.cost_price": "成本价", "order.cost_price": "成本价",
"order.success_num": "到账数量", "order.success_num": "到账数量",
@ -401,7 +401,7 @@ func AllLabels() map[string]string {
"merchant.user_id": "用户中心ID", "merchant.user_id": "用户中心ID",
"merchant.merchant_no": "商户编码", "merchant.merchant_no": "商户编码",
"merchant.subject": "客户主体", "merchant.subject": "客户主体",
"merchant.third_party": "来源类型", "merchant.third_party": "供应商类型",
"merchant.status": "状态", "merchant.status": "状态",
"merchant.balance": "客户余额", "merchant.balance": "客户余额",
"merchant.total_consumption": "累计消费", "merchant.total_consumption": "累计消费",