@provis/provis-common-be-module 2.3.0 → 2.3.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.
|
@@ -195,10 +195,10 @@ class MainRepository extends typeorm_1.Repository {
|
|
|
195
195
|
var _a, _b;
|
|
196
196
|
if (relation) {
|
|
197
197
|
if (relation && relation.join == "left" /* Join.LEFT */) {
|
|
198
|
-
query.leftJoin(`${modelName}.${relation.model}`, relation.model);
|
|
198
|
+
query.leftJoin(`${modelName}.${relation.model}`, relation.aliasTable || relation.model);
|
|
199
199
|
}
|
|
200
200
|
else {
|
|
201
|
-
query.innerJoin(`${modelName}.${relation.model}`, relation.model);
|
|
201
|
+
query.innerJoin(`${modelName}.${relation.model}`, relation.aliasTable || relation.model);
|
|
202
202
|
}
|
|
203
203
|
let index = 0;
|
|
204
204
|
(_a = relation.searchs) === null || _a === void 0 ? void 0 : _a.forEach((valueSearch) => {
|
|
@@ -206,18 +206,18 @@ class MainRepository extends typeorm_1.Repository {
|
|
|
206
206
|
if (index == 0) {
|
|
207
207
|
if (isFirstJoin) {
|
|
208
208
|
// where for first join in left join after primary, ex claim ... and (this) claimCargo ...
|
|
209
|
-
query = query.andWhere(`${relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
|
|
209
|
+
query = query.andWhere(`${relation.aliasTable || relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
|
|
210
210
|
isFirstJoin = false;
|
|
211
211
|
}
|
|
212
212
|
else {
|
|
213
213
|
// for next join in left join , ex claim ... and claimCargo ... or (this) claimKalog ...
|
|
214
|
-
query = query.orWhere(`${relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
|
|
214
|
+
query = query.orWhere(`${relation.aliasTable || relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
|
|
215
215
|
}
|
|
216
216
|
index++;
|
|
217
217
|
}
|
|
218
218
|
else {
|
|
219
219
|
// for next where in left join , ex claim ... and claimCargo ... or claimKalog ... and (this) claimKalog ...
|
|
220
|
-
query = query.andWhere(`${relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
|
|
220
|
+
query = query.andWhere(`${relation.aliasTable || relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
});
|
|
@@ -228,11 +228,11 @@ class MainRepository extends typeorm_1.Repository {
|
|
|
228
228
|
group.forEach((value) => {
|
|
229
229
|
if (value) {
|
|
230
230
|
if (index === 0) {
|
|
231
|
-
qb = qb.where(`${relation.model}.${value.query}`, { [value.key]: value.value });
|
|
231
|
+
qb = qb.where(`${relation.aliasTable || relation.model}.${value.query}`, { [value.key]: value.value });
|
|
232
232
|
index++;
|
|
233
233
|
}
|
|
234
234
|
else {
|
|
235
|
-
qb = qb.orWhere(`${relation.model}.${value.query}`, { [value.key]: value.value });
|
|
235
|
+
qb = qb.orWhere(`${relation.aliasTable || relation.model}.${value.query}`, { [value.key]: value.value });
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
});
|