feat 修改article的搜索

This commit is contained in:
timerzz 2024-12-02 20:14:25 +08:00
parent 277d73739b
commit 6def3252d8

View File

@ -119,7 +119,12 @@ func (f *FindArticleQuery) Scope(db *gorm.DB) *gorm.DB {
db = db.Where("available=?", *f.Available)
}
if f.Ban != nil {
db = db.Where("ban=?", *f.Ban)
if *f.Ban {
db = db.Where("ban=?", *f.Ban)
} else {
db = db.Where("(ban=? or ban is null)", false)
}
}
return db
}