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")