作者 陈志颖

feat:优化模糊查询

@@ -831,7 +831,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in @@ -831,7 +831,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
831 cooperationContracts := make([]*domain.CooperationContract, 0) 831 cooperationContracts := make([]*domain.CooperationContract, 0)
832 query := sqlbuilder.BuildQuery(tx.Model(&cooperationContractModels), queryOptions) 832 query := sqlbuilder.BuildQuery(tx.Model(&cooperationContractModels), queryOptions)
833 if cooperationContractNumber, ok := queryOptions["cooperationContractNumber"]; ok && cooperationContractNumber != "" { 833 if cooperationContractNumber, ok := queryOptions["cooperationContractNumber"]; ok && cooperationContractNumber != "" {
834 - query.Where("cooperation_contract_number like ?", fmt.Sprintf("%%%s%%", cooperationContractNumber)) 834 + query.Where("cooperation_contract_number ilike ?", fmt.Sprintf("%%%s%%", cooperationContractNumber))
835 } 835 }
836 if cooperationContractName, ok := queryOptions["cooperationContactName"]; ok && cooperationContractName != "" { 836 if cooperationContractName, ok := queryOptions["cooperationContactName"]; ok && cooperationContractName != "" {
837 query.Where("cooperation_contract_name like ?", fmt.Sprintf("%%%s%%", cooperationContractName)) 837 query.Where("cooperation_contract_name like ?", fmt.Sprintf("%%%s%%", cooperationContractName))
@@ -170,8 +170,8 @@ func (repository *OrderGoodRepository) Find(queryOptions map[string]interface{}) @@ -170,8 +170,8 @@ func (repository *OrderGoodRepository) Find(queryOptions map[string]interface{})
170 } 170 }
171 if orderOrReturnedOrderNum, ok := queryOptions["orderOrReturnedOrderNum"]; ok && orderOrReturnedOrderNum != "" { 171 if orderOrReturnedOrderNum, ok := queryOptions["orderOrReturnedOrderNum"]; ok && orderOrReturnedOrderNum != "" {
172 query.WhereGroup(func(q *orm.Query) (*orm.Query, error) { 172 query.WhereGroup(func(q *orm.Query) (*orm.Query, error) {
173 - q.WhereOr("dividends_order_number like ?", fmt.Sprintf("%%%s%%", orderOrReturnedOrderNum))  
174 - q.WhereOr("dividends_returned_order_number like ?", fmt.Sprintf("%%%s%%", orderOrReturnedOrderNum)) 173 + q.WhereOr("dividends_order_number ilike ?", fmt.Sprintf("%%%s%%", orderOrReturnedOrderNum))
  174 + q.WhereOr("dividends_returned_order_number ilike ?", fmt.Sprintf("%%%s%%", orderOrReturnedOrderNum))
175 return q, nil 175 return q, nil
176 }) 176 })
177 } 177 }