pg-mvc-service 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -60,7 +60,12 @@ class TableModel {
|
|
|
60
60
|
get createSqlFromJoinWhere() {
|
|
61
61
|
let sql = ` FROM ${this.TableName} as "${this.TableAlias}"`;
|
|
62
62
|
for (const join of this.joinConditions) {
|
|
63
|
-
|
|
63
|
+
const joins = {
|
|
64
|
+
inner: ' INNER JOIN',
|
|
65
|
+
left: ' LEFT OUTER JOIN',
|
|
66
|
+
full: ' FULL OUTER JOIN',
|
|
67
|
+
};
|
|
68
|
+
sql += joins[join.type];
|
|
64
69
|
sql += ` ${join.model.TableName} as "${join.model.TableAlias}" ON `;
|
|
65
70
|
const query = WhereExpression_1.default.createCondition(join.conditions, this, this.vars.length + 1);
|
|
66
71
|
sql += query.expression;
|
package/package.json
CHANGED
package/src/models/TableModel.ts
CHANGED
|
@@ -70,7 +70,7 @@ export class TableModel {
|
|
|
70
70
|
|
|
71
71
|
private selectExpressions: Array<string> = [];
|
|
72
72
|
private joinConditions: Array<{
|
|
73
|
-
type: 'inner' | 'left',
|
|
73
|
+
type: 'inner' | 'left' | 'full',
|
|
74
74
|
model: TableModel,
|
|
75
75
|
conditions: Array<TNestedCondition>
|
|
76
76
|
}> = [];
|
|
@@ -83,7 +83,12 @@ export class TableModel {
|
|
|
83
83
|
let sql = ` FROM ${this.TableName} as "${this.TableAlias}"`;
|
|
84
84
|
|
|
85
85
|
for (const join of this.joinConditions) {
|
|
86
|
-
|
|
86
|
+
const joins = {
|
|
87
|
+
inner: ' INNER JOIN',
|
|
88
|
+
left: ' LEFT OUTER JOIN',
|
|
89
|
+
full: ' FULL OUTER JOIN',
|
|
90
|
+
}
|
|
91
|
+
sql += joins[join.type];
|
|
87
92
|
sql += ` ${join.model.TableName} as "${join.model.TableAlias}" ON `;
|
|
88
93
|
const query = WhereExpression.createCondition(join.conditions, this, this.vars.length + 1);
|
|
89
94
|
sql += query.expression;
|
|
@@ -248,7 +253,7 @@ export class TableModel {
|
|
|
248
253
|
* @param joinBaseModel 結合する対象のBaseModelインスタンスを指定します。
|
|
249
254
|
* @param conditions 結合条件を指定します。条件はオブジェクトまたは文字列で指定できます。
|
|
250
255
|
*/
|
|
251
|
-
public join(joinType: 'left' | 'inner', joinModel: TableModel, conditions: Array<TNestedCondition>): void {
|
|
256
|
+
public join(joinType: 'left' | 'inner' | 'full', joinModel: TableModel, conditions: Array<TNestedCondition>): void {
|
|
252
257
|
this.joinConditions.push({type: joinType, model: joinModel, conditions: conditions});
|
|
253
258
|
}
|
|
254
259
|
|