From 4e63d8427d26d0d1b366ddc53650e15f3481fc75 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 24 Jun 2025 01:44:03 +0000 Subject: (대표님/최겸) 20250624 작업사항 10시43분 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tech-vendors/service.ts | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'lib/tech-vendors/service.ts') diff --git a/lib/tech-vendors/service.ts b/lib/tech-vendors/service.ts index b2dec1ab..5fd5ef02 100644 --- a/lib/tech-vendors/service.ts +++ b/lib/tech-vendors/service.ts @@ -78,6 +78,25 @@ export async function getTechVendors(input: GetTechVendorsSchema) { // 최종 where 결합 const finalWhere = and(advancedWhere, globalWhere); + // 벤더 타입 필터링 로직 추가 + let vendorTypeWhere; + if (input.vendorType) { + // URL의 vendorType 파라미터를 실제 벤더 타입으로 매핑 + const vendorTypeMap = { + "ship": "조선", + "top": "해양TOP", + "hull": "해양HULL" + }; + + const actualVendorType = input.vendorType in vendorTypeMap + ? vendorTypeMap[input.vendorType as keyof typeof vendorTypeMap] + : undefined; + if (actualVendorType) { + // techVendorType 필드는 콤마로 구분된 문자열이므로 LIKE 사용 + vendorTypeWhere = ilike(techVendors.techVendorType, `%${actualVendorType}%`); + } + } + // 간단 검색 (advancedTable=false) 시 예시 const simpleWhere = and( input.vendorName @@ -89,8 +108,8 @@ export async function getTechVendors(input: GetTechVendorsSchema) { : undefined ); - // 실제 사용될 where - const where = finalWhere; + // 실제 사용될 where (vendorType 필터링 추가) + const where = and(finalWhere, vendorTypeWhere); // 정렬 const orderBy = -- cgit v1.2.3