forked from ttc/micro-service-api
-ระบบ column
This commit is contained in:
@@ -25,14 +25,20 @@ export class budgetSearch {
|
||||
try {
|
||||
// let username = req.body.request.username;
|
||||
// let password = req.body.request.password;
|
||||
let token = req.body.request.token;
|
||||
let token = req.headers.authorization?.split(' ')[1];
|
||||
const decoded = verifyToken(token);
|
||||
|
||||
let id = decoded.id
|
||||
let username = decoded.name
|
||||
database = decoded.organization
|
||||
|
||||
aryResult = await this.budgetSearchService.getBudgetSearch(database, id); // เช็คกับ db กลาง ส่ง jwttoken ออกมา
|
||||
let columnParams = req.query.collumn
|
||||
var column = ""
|
||||
if(columnParams == 'edit'){
|
||||
column = `bdgseq, bdgnam, bdgcod, bdgttl`
|
||||
} else if(columnParams == 'result' || columnParams == undefined || columnParams == ''){
|
||||
column = `bdgnam, bdgttl`
|
||||
}
|
||||
aryResult = await this.budgetSearchService.getBudgetSearch(database, id, column); // เช็คกับ db กลาง ส่ง jwttoken ออกมา
|
||||
// this.generalService.devhint(1, 'budgetSearch.js', 'Login success');
|
||||
} catch (error) {
|
||||
idx = 1;
|
||||
|
||||
@@ -6,18 +6,20 @@ export class BudgetSearchService {
|
||||
this.generalService = new GeneralService()
|
||||
}
|
||||
|
||||
async getBudgetSearch(database, id) {
|
||||
async getBudgetSearch(database, id, column) {
|
||||
const sql = `
|
||||
SELECT
|
||||
bdgseq,
|
||||
bdgnam,
|
||||
bdgcod,
|
||||
bdgttl,
|
||||
bdgedtdtm
|
||||
${column}
|
||||
FROM ${database}.bdgmst
|
||||
`
|
||||
const params = []
|
||||
const result = await this.generalService.executeQueryParam(database, sql, params);
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bdgseq,
|
||||
// bdgnam,
|
||||
// bdgcod,
|
||||
// bdgttl,
|
||||
// bdgedtdtm
|
||||
Reference in New Issue
Block a user