diff --git a/src/helpers/DatabaseHelper.ts b/src/helpers/DatabaseHelper.ts index d7d37aa..b0d933a 100644 --- a/src/helpers/DatabaseHelper.ts +++ b/src/helpers/DatabaseHelper.ts @@ -9,11 +9,13 @@ import { conf } from "./ConfigHelper"; export interface JoinTableInfo { table: string, + tableAlias ?: string, condition: string } export interface QueryInformation { table: string, + tableAlias?: string, joins ?: Array, fields ?: Array, where ?: Object, @@ -88,10 +90,13 @@ export class DatabaseHelper { request += " FROM " + info.table; + if(info.tableAlias) + request += " " + info.tableAlias + " "; + // Joins condition if(info.joins) { info.joins.forEach(join => { - request += " JOIN " + join.table + " ON " + join.condition + request += " JOIN " + join.table + (join.tableAlias ? " " + join.tableAlias : "") + " ON " + join.condition }); }