|
|
@ -234,19 +234,18 @@ class Xapi { |
|
|
|
async list(req, res) { |
|
|
|
async list(req, res) { |
|
|
|
|
|
|
|
|
|
|
|
let queryParamsObj = {} |
|
|
|
let queryParamsObj = {} |
|
|
|
queryParamsObj.query = ''; |
|
|
|
queryParamsObj.query = 'select '; |
|
|
|
queryParamsObj.params = []; |
|
|
|
queryParamsObj.params = []; |
|
|
|
let cols = '' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (req.query._groupby) { |
|
|
|
if (req.query._groupby) { |
|
|
|
cols = this.mysql.getColumnsForSelectStmtWithGrpBy(req.query, req.app.locals._tableName); |
|
|
|
this.mysql.getColumnsForSelectStmtWithGrpBy(req.query, req.app.locals._tableName, queryParamsObj); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
cols = this.mysql.getColumnsForSelectStmt(req.app.locals._tableName, req.query); |
|
|
|
this.mysql.getColumnsForSelectStmt(req.app.locals._tableName, req.query, queryParamsObj); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************** tableName ****************/ |
|
|
|
/**************** tableName ****************/ |
|
|
|
queryParamsObj.query = 'select ' + cols + ' from ?? '; |
|
|
|
queryParamsObj.query += ' from ?? '; |
|
|
|
queryParamsObj.params.push(req.app.locals._tableName); |
|
|
|
queryParamsObj.params.push(req.app.locals._tableName); |
|
|
|
|
|
|
|
|
|
|
|
/**************** where clause ****************/ |
|
|
|
/**************** where clause ****************/ |
|
|
@ -274,18 +273,17 @@ class Xapi { |
|
|
|
|
|
|
|
|
|
|
|
async nestedList(req, res) { |
|
|
|
async nestedList(req, res) { |
|
|
|
|
|
|
|
|
|
|
|
let cols = '' |
|
|
|
|
|
|
|
let queryParamsObj = {} |
|
|
|
let queryParamsObj = {} |
|
|
|
queryParamsObj.query = ''; |
|
|
|
queryParamsObj.query = 'select '; |
|
|
|
queryParamsObj.params = []; |
|
|
|
queryParamsObj.params = []; |
|
|
|
|
|
|
|
|
|
|
|
/**************** tableName ****************/ |
|
|
|
/**************** tableName ****************/ |
|
|
|
if (req.query._groupby) { |
|
|
|
if (req.query._groupby) { |
|
|
|
cols = this.mysql.getColumnsForSelectStmtWithGrpBy(req.query, req.app.locals._tableName); |
|
|
|
this.mysql.getColumnsForSelectStmtWithGrpBy(req.query, req.app.locals._tableName, queryParamsObj); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
cols = this.mysql.getColumnsForSelectStmt(req.app.locals._tableName, req.query); |
|
|
|
this.mysql.getColumnsForSelectStmt(req.app.locals._tableName, req.query, queryParamsObj); |
|
|
|
} |
|
|
|
} |
|
|
|
queryParamsObj.query = 'select ' + cols + ' from ?? where '; |
|
|
|
queryParamsObj.query += ' from ?? where '; |
|
|
|
queryParamsObj.params.push(req.app.locals._childTable); |
|
|
|
queryParamsObj.params.push(req.app.locals._childTable); |
|
|
|
|
|
|
|
|
|
|
|
/**************** where foreign key ****************/ |
|
|
|
/**************** where foreign key ****************/ |
|
|
|