@provis/provis-common-be-module 2.2.10 → 2.2.12
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.
|
@@ -190,6 +190,7 @@ class MainRepository extends typeorm_1.Repository {
|
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
if (relations && relations.length > 0) {
|
|
193
|
+
let isFirstJoin = true;
|
|
193
194
|
relations.forEach((relation) => {
|
|
194
195
|
var _a, _b;
|
|
195
196
|
if (relation) {
|
|
@@ -199,9 +200,22 @@ class MainRepository extends typeorm_1.Repository {
|
|
|
199
200
|
else {
|
|
200
201
|
query.innerJoin(`${modelName}.${relation.model}`, relation.model);
|
|
201
202
|
}
|
|
203
|
+
let index = 0;
|
|
202
204
|
(_a = relation.searchs) === null || _a === void 0 ? void 0 : _a.forEach((valueSearch) => {
|
|
203
205
|
if (valueSearch) {
|
|
204
|
-
|
|
206
|
+
if (index == 0) {
|
|
207
|
+
if (isFirstJoin) {
|
|
208
|
+
query = query.andWhere(`${relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
|
|
209
|
+
isFirstJoin = false;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
query = query.orWhere(`${relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
|
|
213
|
+
}
|
|
214
|
+
index++;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
query = query.andWhere(`${relation.model}.${valueSearch.query}`, { [valueSearch.key]: valueSearch.value });
|
|
218
|
+
}
|
|
205
219
|
}
|
|
206
220
|
});
|
|
207
221
|
(_b = relation.additionalSearchOr) === null || _b === void 0 ? void 0 : _b.forEach((group) => {
|