feat: 增加蝦皮店铺名称搜索 (#182)

This commit is contained in:
chengma
2026-08-12 15:09:35 +08:00
parent aa6d812ac6
commit 889f568554
11 changed files with 94 additions and 40 deletions
+9 -4
View File
@@ -131,10 +131,11 @@ type ShopeeProductRow struct {
// 认不出的取值一律当作 ""(不筛选),由 service 层的 ParseShopeeStatus 兜底,
// 这里不做校验——repository 只管拼 SQL。
type ShopeeFilter struct {
Keyword string
Status string
Shop string // has / missing / 空(全部)
Image string // has / missing / 空(全部)
Keyword string
ShopName string
Status string
Shop string // has / missing / 空(全部)
Image string // has / missing / 空(全部)
}
// shopeeFilterClause 把关键字、状态、店铺和图片筛选拼成 WHERE 子句,供 ListShopeeProducts
@@ -153,6 +154,10 @@ func shopeeFilterClause(filter ShopeeFilter) (string, []any) {
clauses = append(clauses, `(sp.goods_id LIKE ? ESCAPE '!' OR sp.title LIKE ? ESCAPE '!')`)
args = append(args, like, like)
}
if shopName := strings.TrimSpace(filter.ShopName); shopName != "" {
clauses = append(clauses, `sp.shopee_shop_name LIKE ? ESCAPE '!'`)
args = append(args, "%"+escapeLike(shopName)+"%")
}
switch filter.Status {
case "pending_spec":