pg-mvc-service 2.0.102 → 2.0.103
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.
|
@@ -244,9 +244,18 @@ class TableModel {
|
|
|
244
244
|
where(param1, param2, right) {
|
|
245
245
|
if (typeof param1 === 'string') {
|
|
246
246
|
if (param2 === undefined || right === undefined || Array.isArray(param2)) {
|
|
247
|
-
this.whereExpressions.push(param1);
|
|
248
247
|
if (Array.isArray(param2)) {
|
|
248
|
+
let expression = param1;
|
|
249
|
+
const startIndex = this.vars.length + 1;
|
|
250
|
+
expression = expression.replace(/\$(\d+)/g, (match, num) => {
|
|
251
|
+
const originalNum = parseInt(num, 10);
|
|
252
|
+
return `$${startIndex + originalNum - 1}`;
|
|
253
|
+
});
|
|
249
254
|
this.vars = [...this.vars, ...param2];
|
|
255
|
+
this.whereExpressions.push(expression);
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
this.whereExpressions.push(param1);
|
|
250
259
|
}
|
|
251
260
|
}
|
|
252
261
|
else {
|
package/package.json
CHANGED
package/src/models/TableModel.ts
CHANGED
|
@@ -293,9 +293,17 @@ export class TableModel {
|
|
|
293
293
|
public where(param1: string | TColumnInfo | Array<TNestedCondition>, param2?: Array<any> | TOperator, right?: TColumnInfo | any): void {
|
|
294
294
|
if (typeof param1 === 'string') {
|
|
295
295
|
if (param2 === undefined || right === undefined || Array.isArray(param2)) {
|
|
296
|
-
this.whereExpressions.push(param1);
|
|
297
296
|
if (Array.isArray(param2)) {
|
|
297
|
+
let expression = param1;
|
|
298
|
+
const startIndex = this.vars.length + 1;
|
|
299
|
+
expression = expression.replace(/\$(\d+)/g, (match, num) => {
|
|
300
|
+
const originalNum = parseInt(num, 10);
|
|
301
|
+
return `$${startIndex + originalNum - 1}`;
|
|
302
|
+
});
|
|
298
303
|
this.vars = [...this.vars, ...param2];
|
|
304
|
+
this.whereExpressions.push(expression);
|
|
305
|
+
} else {
|
|
306
|
+
this.whereExpressions.push(param1);
|
|
299
307
|
}
|
|
300
308
|
} else {
|
|
301
309
|
const query = WhereExpression.create({model: this, name: param1}, param2, right, this.vars.length + 1);
|