fix(search): 修复跨租户重复手机号查询报错
This commit is contained in:
@@ -1151,7 +1151,7 @@ func (r *Repository) ListOrders(ctx context.Context, query DistributionOrderList
|
||||
if strings.TrimSpace(query.Keyword) != "" {
|
||||
keyword := strings.TrimSpace(query.Keyword)
|
||||
if isPhoneKeyword(keyword) {
|
||||
base = base.Where("ro.renter_id = (SELECT id FROM users WHERE phone = ?)", keyword)
|
||||
base = base.Where("ro.renter_id IN (SELECT id FROM users WHERE phone = ?)", keyword)
|
||||
} else {
|
||||
kw := "%" + keyword + "%"
|
||||
base = base.Where("(ro.order_no LIKE ? OR rl.listing_no LIKE ? OR ga.title LIKE ? OR u.phone LIKE ?)", kw, kw, kw, kw)
|
||||
@@ -3055,7 +3055,7 @@ func (r *Repository) ListReceivedListings(ctx context.Context, adminID, siteID u
|
||||
if q.Keyword != "" {
|
||||
keyword := strings.TrimSpace(q.Keyword)
|
||||
if isPhoneKeyword(keyword) {
|
||||
base = base.Where("rl.owner_id = (SELECT id FROM users WHERE phone = ?)", keyword)
|
||||
base = base.Where("rl.owner_id IN (SELECT id FROM users WHERE phone = ?)", keyword)
|
||||
} else {
|
||||
kw := "%" + keyword + "%"
|
||||
base = base.Where("(rl.listing_no LIKE ? OR ga.title LIKE ? OR u.phone LIKE ? OR u.nickname LIKE ?)", kw, kw, kw, kw)
|
||||
|
||||
Reference in New Issue
Block a user