fix(sqlbuilder): 处理 reseller_id_eq 和 plan_id_eq 过滤条件逻辑

- 添加逻辑判断当存在 plan_id_eq 过滤条件时
- 删除与 creator 相关的过滤条件 creator_in 和 creator_ids
- 优化过滤条件组合,避免冲突和冗余
- 保持现有 merchant_id_in 条件处理逻辑不变
This commit is contained in:
zhouyonggao 2025-12-19 01:14:59 +08:00
parent 57a32855fc
commit bca7892799
1 changed files with 6 additions and 0 deletions

View File

@ -397,6 +397,12 @@ func BuildSQLWithFields(req BuildRequest, whitelist map[string]bool) (string, []
}
}
if v, ok := req.Filters["reseller_id_eq"]; ok {
// 如果提供了 reseller_id_eq 或 activity_id_eq则不保留 creator 相关的过滤条件
if _, hasPlan := req.Filters["plan_id_eq"]; hasPlan {
// 删除 creator 相关条件
delete(req.Filters, "creator_in")
delete(req.Filters, "creator_ids")
}
// If merchant_id_in is present, it handles the merchant_id logic (via OR condition),
if _, hasIn := req.Filters["merchant_id_in"]; !hasIn {
s := utils.ToString(v)