baja-lite 1.3.21 → 1.3.23

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/sql.js +3 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baja-lite",
3
- "version": "1.3.21",
3
+ "version": "1.3.23",
4
4
  "description": "some util for self",
5
5
  "homepage": "https://github.com/void-soul/util-man",
6
6
  "repository": {
package/sql.js CHANGED
@@ -1206,9 +1206,9 @@ class Build {
1206
1206
  * @param param
1207
1207
  */
1208
1208
  constructor(isCount, isSum, param = {}) {
1209
- this.brage = { haveOrderBy: false, haveLimit: false };
1210
1209
  this.isCount = isCount;
1211
1210
  this.isSum = isSum;
1211
+ this.orderBy = param.orderBy ?? '';
1212
1212
  Object.assign(this, param);
1213
1213
  }
1214
1214
  /**
@@ -1346,24 +1346,10 @@ class Build {
1346
1346
  return '';
1347
1347
  }
1348
1348
  else {
1349
- this.brage.haveOrderBy = true;
1350
1349
  const orderBy = new Array();
1351
- const renderOrder = render(text);
1352
- if (/\S/.test(renderOrder)) {
1353
- orderBy.push(renderOrder);
1350
+ if (this.orderBy) {
1351
+ orderBy.push(this.orderBy);
1354
1352
  }
1355
- return orderBy.length > 0 ? ` ORDER BY ${orderBy.join(',')} ` : '';
1356
- }
1357
- };
1358
- }
1359
- limit() {
1360
- return (text, render) => {
1361
- if (this.isCount === true || this.isSum === true) {
1362
- return '';
1363
- }
1364
- else {
1365
- this.brage.haveOrderBy = true;
1366
- const orderBy = new Array();
1367
1353
  const renderOrder = render(text);
1368
1354
  if (/\S/.test(renderOrder)) {
1369
1355
  orderBy.push(renderOrder);
@@ -2870,9 +2856,6 @@ export class SqlService {
2870
2856
  if (option.limitSelf !== true) {
2871
2857
  if (option.countSelf !== true) {
2872
2858
  }
2873
- if (option.orderBy) {
2874
- sql = `${sql} ORDER BY ${option.orderBy}`;
2875
- }
2876
2859
  if (option.pageSize > 0) {
2877
2860
  sql = `${sql} LIMIT ${option.params['limitStart']}, ${option.pageSize}`;
2878
2861
  }