@axiosleo/orm-mysql 0.10.12 → 0.10.14
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.
- package/bin/orm-mysql.js +1 -1
- package/package.json +1 -1
- package/src/builder.js +9 -2
package/bin/orm-mysql.js
CHANGED
package/package.json
CHANGED
package/src/builder.js
CHANGED
|
@@ -58,9 +58,9 @@ class Builder {
|
|
|
58
58
|
emit(tmp, this._buildJoins(options.joins));
|
|
59
59
|
emit(tmp, this._buildCondition(options.conditions));
|
|
60
60
|
emit(tmp, this._buildGroupField(options.groupField));
|
|
61
|
-
emit(tmp, this._buildPagination(options.pageLimit, options.pageOffset));
|
|
62
61
|
emit(tmp, this._buildHaving(options.having));
|
|
63
62
|
emit(tmp, this._buildOrders(options.orders));
|
|
63
|
+
emit(tmp, this._buildPagination(options.pageLimit, options.pageOffset));
|
|
64
64
|
sql = tmp.join(' ');
|
|
65
65
|
if (options.suffix) {
|
|
66
66
|
sql += ' ' + options.suffix;
|
|
@@ -331,7 +331,14 @@ class Builder {
|
|
|
331
331
|
const opt = c.opt.toLowerCase();
|
|
332
332
|
if (opt === 'group' && Array.isArray(c.value)) {
|
|
333
333
|
let t = `(${this._buildCondition(c.value, '')})`;
|
|
334
|
-
|
|
334
|
+
if (index === 0 || conditions[index - 1].opt === 'group') {
|
|
335
|
+
return t;
|
|
336
|
+
}
|
|
337
|
+
const lastOpt = conditions[index - 1].opt;
|
|
338
|
+
if (['AND', 'OR'].indexOf(lastOpt) > -1) {
|
|
339
|
+
return t;
|
|
340
|
+
}
|
|
341
|
+
return ` AND ${t}`;
|
|
335
342
|
}
|
|
336
343
|
if (opt === 'in') {
|
|
337
344
|
return this._buildConditionIn(c);
|