fix 修复数据库查询bug
This commit is contained in:
parent
402be86404
commit
14abeb24b5
@ -1,9 +1,10 @@
|
||||
package productv1
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gitea.timerzz.com/kedaya_haitao/common/pkg/database"
|
||||
"gorm.io/gorm/clause"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUpsert(t *testing.T) {
|
||||
|
@ -70,7 +70,7 @@ func (l *FindArticleQuery) Scope(db *gorm.DB) *gorm.DB {
|
||||
db = db.Where("`id`=?", l.ID)
|
||||
}
|
||||
if l.Keyword != "" {
|
||||
db = db.Where("(`name` LIKE ? OR `english_name LIKE ? OR `remark` LIKE ? )", "%"+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)
|
||||
|
@ -43,7 +43,7 @@ func (g *ListProviderQuery) Scope(db *gorm.DB) *gorm.DB {
|
||||
db = db.Where("provider_id=?", g.ProviderId)
|
||||
}
|
||||
if g.Keyword != "" {
|
||||
db = db.Where("name LIKE ?", "%"+g.Keyword+"%")
|
||||
db = db.Where("name ilike ?", "%"+g.Keyword+"%")
|
||||
}
|
||||
return db
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ func (g *ListSellerQuery) Scope(db *gorm.DB) *gorm.DB {
|
||||
db = db.Where("seller_id=?", g.SellerId)
|
||||
}
|
||||
if g.Keyword != "" {
|
||||
db = db.Where("name LIKE ?", "%"+g.Keyword+"%")
|
||||
db = db.Where("name ilike ?", "%"+g.Keyword+"%")
|
||||
}
|
||||
return db
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user