作者 tangxvhui

调整模糊搜索

@@ -4,6 +4,7 @@ import ( @@ -4,6 +4,7 @@ import (
4 "encoding/json" 4 "encoding/json"
5 "fmt" 5 "fmt"
6 "strconv" 6 "strconv"
  7 + "strings"
7 "time" 8 "time"
8 9
9 "github.com/linmadan/egglib-go/core/application" 10 "github.com/linmadan/egglib-go/core/application"
@@ -627,6 +628,7 @@ func (srv TaskService) ListTask(param *command.ListTaskCommand) (map[string]inte @@ -627,6 +628,7 @@ func (srv TaskService) ListTask(param *command.ListTaskCommand) (map[string]inte
627 "limit": 20, 628 "limit": 20,
628 "companyId": param.CompanyId, 629 "companyId": param.CompanyId,
629 } 630 }
  631 + param.SearchWord = strings.TrimSpace(param.SearchWord)
630 if len(param.SearchWord) > 0 { 632 if len(param.SearchWord) > 0 {
631 condition["aliasOrLeader"] = "%" + param.SearchWord + "%" 633 condition["aliasOrLeader"] = "%" + param.SearchWord + "%"
632 } 634 }
@@ -1005,6 +1007,7 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i @@ -1005,6 +1007,7 @@ func (srv TaskService) ListTask3(param *command.SearchTaskCommand) (map[string]i
1005 listData, err := srv.listTask3ForHrbp(param) 1007 listData, err := srv.listTask3ForHrbp(param)
1006 return listData, err 1008 return listData, err
1007 } 1009 }
  1010 + param.SearchWord = strings.TrimSpace(param.SearchWord)
1008 if len(param.SearchWord) > 0 { 1011 if len(param.SearchWord) > 0 {
1009 param.SearchWord = "%" + param.SearchWord + "%" 1012 param.SearchWord = "%" + param.SearchWord + "%"
1010 } 1013 }
@@ -1158,6 +1161,10 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s @@ -1158,6 +1161,10 @@ func (srv TaskService) listTask3ForHrbp(param *command.SearchTaskCommand) (map[s
1158 offset = (param.PageNumber - 1) * param.PageSize 1161 offset = (param.PageNumber - 1) * param.PageSize
1159 } 1162 }
1160 } 1163 }
  1164 + param.SearchWord = strings.TrimSpace(param.SearchWord)
  1165 + if len(param.SearchWord) > 0 {
  1166 + param.SearchWord = "%" + param.SearchWord + "%"
  1167 + }
1161 condition := dao.ListTaskCondition{ 1168 condition := dao.ListTaskCondition{
1162 Limit: limit, 1169 Limit: limit,
1163 Offset: offset, 1170 Offset: offset,