From e0e7bd44e7584ef1b0b275b925e2944bab2cd67a Mon Sep 17 00:00:00 2001 From: x2Skyz Date: Tue, 25 Nov 2025 22:06:05 +0700 Subject: [PATCH] -. --- .../src/controllers/budgetSearchController.js | 2 +- .../src/controllers/projectSearchController.js | 11 ++++++----- .../src/controllers/transactionSearchController.js | 5 +++-- .../src/services/projectSearchService.js | 1 + .../src/services/transactionSearchService.js | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/exthernal-ttc-api/src/controllers/budgetSearchController.js b/exthernal-ttc-api/src/controllers/budgetSearchController.js index e58da8e..2916467 100644 --- a/exthernal-ttc-api/src/controllers/budgetSearchController.js +++ b/exthernal-ttc-api/src/controllers/budgetSearchController.js @@ -36,7 +36,7 @@ export class budgetSearch { column = `bdgseq, bdgnam, bdgcod, bdgttl` condition['bdgseq'] = req.body.request.bdgseq } else if(columnParams == 'result' || columnParams == undefined || columnParams == ''){ - column = `bdgnam, bdgttl` + column = `bdgnam, bdgcod` } aryResult = await this.budgetSearchService.getBudgetSearch(database, column, condition); diff --git a/exthernal-ttc-api/src/controllers/projectSearchController.js b/exthernal-ttc-api/src/controllers/projectSearchController.js index 7854f11..af4c6c1 100644 --- a/exthernal-ttc-api/src/controllers/projectSearchController.js +++ b/exthernal-ttc-api/src/controllers/projectSearchController.js @@ -58,16 +58,17 @@ export class projectSearch { FROM ${database}.trnmst WHERE trnprjseq = prjseq ) - ) as bdgnam, + ) as prjbdgnam, ( SELECT string_agg(DISTINCT trnbdgcod, ',') FROM ${database}.trnmst WHERE trnprjseq = prjseq - ) as bdgcod, + ) as prjbdgcod, - p.prjacpbdg, - ${database}.translatedtl('COMSTT', prjcomstt) as prjcomstt, - p.prjacpdtm + prjacpbdg, + ${database}.translatedtl('COMSTT', prjcomstt) as prjcomsttnam, + prjcomstt, + prjacpdtm `; // ใช้ Service ตัวใหม่ (Detail Search / Join) diff --git a/exthernal-ttc-api/src/controllers/transactionSearchController.js b/exthernal-ttc-api/src/controllers/transactionSearchController.js index 2436af5..35f3ea0 100644 --- a/exthernal-ttc-api/src/controllers/transactionSearchController.js +++ b/exthernal-ttc-api/src/controllers/transactionSearchController.js @@ -36,7 +36,8 @@ export class transactionSearch { column = `trnseq, trnprjnam, trnprjseq, trnbdgcod, trncomstt` condition['trnseq'] = req.body.request.trnseq } else if(columnParams == 'result' || columnParams == undefined || columnParams == ''){ - column = `trnprjnam, trnbdgcod, ${database}.translatedtl('COMSTT', trncomstt) AS trncomstt, trnacpdtm` + condition['trnprjseq'] = req.body.request.trnprjseq + column = `trnseq, trnprjnam, trnbdgcod, ${database}.translatebdg(trnbdgcod) AS trnbdgnam, ${database}.translatedtl('COMSTT', trncomstt) AS trncomstt, trnexpbdg, trnacpdtm` } aryResult = await this.transactionSearchService.getTransactionSearch(database, column, condition); @@ -45,7 +46,7 @@ export class transactionSearch { idx = 1; } finally { if (idx === 1) return sendError('เกิดข้อผิดพลาดไม่คาดคิดเกิดขึ้น', 'Unexpected error'); - if (aryResult == 0) return sendError('ไม่พบการมีอยู่ของข้อมูล', 'Cannot Find Any Data'); + // if (aryResult == 0) return sendError('ไม่พบการมีอยู่ของข้อมูล', 'Cannot Find Any Data'); return aryResult } } diff --git a/exthernal-ttc-api/src/services/projectSearchService.js b/exthernal-ttc-api/src/services/projectSearchService.js index a97394a..ef275b1 100644 --- a/exthernal-ttc-api/src/services/projectSearchService.js +++ b/exthernal-ttc-api/src/services/projectSearchService.js @@ -37,6 +37,7 @@ export class ProjectSearchService { LEFT JOIN ${database}.usrmst u ON prjusrseq = usrseq LEFT JOIN ${database}.bdgmst b ON prjbdgcod = bdgcod WHERE 1=1 + ORDER BY prjseq ASC `; const result = await this.generalService.executeQueryConditions(database, sql, condition); diff --git a/exthernal-ttc-api/src/services/transactionSearchService.js b/exthernal-ttc-api/src/services/transactionSearchService.js index 0545cc5..2f895a2 100644 --- a/exthernal-ttc-api/src/services/transactionSearchService.js +++ b/exthernal-ttc-api/src/services/transactionSearchService.js @@ -10,7 +10,7 @@ export class TransactionSearchService { const sql = ` SELECT ${column} - FROM ${database}.bdgmst + FROM ${database}.trnmst WHERE 1=1 ` const params = []