feat 搜索支持货号,不区分大小写
All checks were successful
Build image / build (push) Successful in 2m39s

This commit is contained in:
timerzz 2024-09-01 17:01:50 +08:00
parent 7268758aec
commit b977fbca79

View File

@ -101,7 +101,7 @@ type ListWatcherInfoRequest struct {
func (c *Controller) List(req ListWatcherInfoRequest) (resp web.ListResponse[model.WatchInfo], err error) { func (c *Controller) List(req ListWatcherInfoRequest) (resp web.ListResponse[model.WatchInfo], err error) {
tx := c.db tx := c.db
if req.Keyword != "" { if req.Keyword != "" {
tx = tx.Where("name LIKE ? or remark LIKE ?", fmt.Sprintf("%%%s%%", req.Keyword), fmt.Sprintf("%%%s%%", req.Keyword)) tx = tx.Where("name ilike ? or remark ilike ? or pid ilike ?", fmt.Sprintf("%%%s%%", req.Keyword), fmt.Sprintf("%%%s%%", req.Keyword), fmt.Sprintf("%%%s%%", req.Keyword))
} }
if !req.Website.IsZero() { if !req.Website.IsZero() {
tx = tx.Where("website = ?", req.Website) tx = tx.Where("website = ?", req.Website)