From 402ec4ceec8a087263569132803a004a216d931a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E7=8F=91?= Date: Wed, 7 Jan 2026 19:04:38 +0800 Subject: [PATCH] Fix: search by phone in customers --- src/service/customer.service.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/service/customer.service.ts b/src/service/customer.service.ts index bd84592..02ecb44 100644 --- a/src/service/customer.service.ts +++ b/src/service/customer.service.ts @@ -1,5 +1,6 @@ import { Inject, Provide } from '@midwayjs/core'; import { InjectEntityModel } from '@midwayjs/typeorm'; +import { Like } from 'typeorm'; import { Repository } from 'typeorm'; import { SyncOperationResult, UnifiedPaginationDTO, UnifiedSearchParamsDTO, BatchOperationResult } from '../dto/api.dto'; import { UnifiedCustomerDTO } from '../dto/site-api.dto'; @@ -372,6 +373,9 @@ export class CustomerService { per_page = 20, where ={}, } = params; + if (where.phone) { + where.phone = Like(`%${where.phone}%`); + } // 查询客户列表和总数 const [customers, total] = await this.customerModel.findAndCount({