From 1290c1e1fd6ad2284d6289357f019263271ff730 Mon Sep 17 00:00:00 2001 From: timerzz Date: Sun, 1 Sep 2024 18:59:24 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=97=B6=E7=9A=84`bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- structs/storage/article.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/structs/storage/article.go b/structs/storage/article.go index f5eabbe..32e4e76 100644 --- a/structs/storage/article.go +++ b/structs/storage/article.go @@ -68,19 +68,19 @@ func (f *FindArticleQuery) SetAvailable(available bool) *FindArticleQuery { func (l *FindArticleQuery) Scope(db *gorm.DB) *gorm.DB { if l.ID != 0 { - db = db.Where("`id`=?", l.ID) + db = db.Where("id=?", l.ID) } if l.Keyword != "" { - db = db.Where("(`name` ilike ? OR `english_name ilike ? OR `remark` ilike ? )", "%"+l.Keyword+"%", "%"+l.Keyword+"%", "%"+l.Keyword+"%") + db = db.Where("(name ilike ? OR english_name ilike ? OR remark ilike ? )", "%"+l.Keyword+"%", "%"+l.Keyword+"%", "%"+l.Keyword+"%") } if l.Brand != "" { - db = db.Where("`brand`=?", l.Brand) + db = db.Where("brand=?", l.Brand) } if l.Pid != "" { - db = db.Where("`pid`=?", l.Pid) + db = db.Where("pid=?", l.Pid) } if l.Available != nil { - db = db.Where("`available`=?", *l.Available) + db = db.Where("available=?", *l.Available) } return db } @@ -133,13 +133,13 @@ func NewGetArticleQuery() *GetArticleQuery { func (g *GetArticleQuery) Scope(db *gorm.DB) *gorm.DB { db = db.Preload("Providers").Preload("Sellers") if g.ID != 0 { - db = db.Where("`id`=?", g.ID) + db = db.Where("id=?", g.ID) } if g.Brand != "" { - db = db.Where("`brand`=?", g.Brand) + db = db.Where("brand=?", g.Brand) } if g.Pid != "" { - db = db.Where("`pid`=?", g.Pid) + db = db.Where("pid=?", g.Pid) } if g.History { db = db.Preload("Providers.HistoryPrice").Preload("Sellers.HistoryPrice")