baja-lite 1.3.23 → 1.3.24

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 (3) hide show
  1. package/package.json +1 -1
  2. package/sql.d.ts +11 -6
  3. package/sql.js +7 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baja-lite",
3
- "version": "1.3.23",
3
+ "version": "1.3.24",
4
4
  "description": "some util for self",
5
5
  "homepage": "https://github.com/void-soul/util-man",
6
6
  "repository": {
package/sql.d.ts CHANGED
@@ -372,7 +372,7 @@ export interface GlobalSqlOption extends GlobalSqlOptionForWeb {
372
372
  isSum?: boolean;
373
373
  limitStart?: number;
374
374
  limitEnd?: number;
375
- orderBy?: string;
375
+ sortName?: string; sortType?: string;
376
376
  params?: Record<string, any>;
377
377
  }) => {
378
378
  return `
@@ -605,7 +605,8 @@ export type SqlModel = Record<string, string | ((options: {
605
605
  isSum?: boolean;
606
606
  limitStart?: number;
607
607
  limitEnd?: number;
608
- orderBy?: string;
608
+ sortName?: string;
609
+ sortType?: string;
609
610
  params?: any;
610
611
  }) => string)>;
611
612
  type _SqlModel = Record<string, string | ((options: {
@@ -614,7 +615,8 @@ type _SqlModel = Record<string, string | ((options: {
614
615
  isSum?: boolean;
615
616
  limitStart?: number;
616
617
  limitEnd?: number;
617
- orderBy?: string;
618
+ sortName?: string;
619
+ sortType?: string;
618
620
  params?: any;
619
621
  }) => string) | XML[]>;
620
622
  /**
@@ -657,7 +659,8 @@ export declare class SqlCache {
657
659
  isSum?: boolean;
658
660
  limitStart?: number;
659
661
  limitEnd?: number;
660
- orderBy?: string;
662
+ sortName?: string;
663
+ sortType?: string;
661
664
  [k: string]: any;
662
665
  }): string;
663
666
  }
@@ -1261,7 +1264,8 @@ export declare class SqlService<T extends object> {
1261
1264
  limitSelf?: boolean;
1262
1265
  countSelf?: boolean;
1263
1266
  sumSelf?: boolean;
1264
- orderBy?: string;
1267
+ sortName?: string;
1268
+ sortType?: string;
1265
1269
  hump?: boolean;
1266
1270
  mapper?: string | SqlMapper;
1267
1271
  mapperIfUndefined?: MapperIfUndefined;
@@ -1276,7 +1280,8 @@ export declare class SqlService<T extends object> {
1276
1280
  limitSelf?: boolean;
1277
1281
  countSelf?: boolean;
1278
1282
  sumSelf?: boolean;
1279
- orderBy?: string;
1283
+ sortName?: string;
1284
+ sortType?: string;
1280
1285
  hump?: boolean;
1281
1286
  mapper?: string | SqlMapper;
1282
1287
  mapperIfUndefined?: MapperIfUndefined;
package/sql.js CHANGED
@@ -1208,7 +1208,7 @@ class Build {
1208
1208
  constructor(isCount, isSum, param = {}) {
1209
1209
  this.isCount = isCount;
1210
1210
  this.isSum = isSum;
1211
- this.orderBy = param.orderBy ?? '';
1211
+ this.orderBy = param.sortName ? `${param.sortName} ${param.sortType ?? 'ASC'}` : '';
1212
1212
  Object.assign(this, param);
1213
1213
  }
1214
1214
  /**
@@ -2842,10 +2842,14 @@ export class SqlService {
2842
2842
  };
2843
2843
  option.pageNumber ?? (option.pageNumber = 1);
2844
2844
  option.pageSize ?? (option.pageSize = 0);
2845
+ if (option.hump === true || (option.hump === undefined && globalThis[_Hump] === true) && option.sortName) {
2846
+ option.sortName = P2C(option.sortName);
2847
+ }
2845
2848
  Object.assign(option.params, {
2846
2849
  limitStart: calc(option.pageNumber).sub(1).mul(option.pageSize).over(),
2847
- limitEnd: calc(option.pageSize).over(),
2848
- orderBy: option.orderBy
2850
+ limitEnd: option.pageSize - 0,
2851
+ sortName: option.sortName ?? undefined,
2852
+ sortType: option.sortType ?? undefined
2849
2853
  });
2850
2854
  let sql = globalThis[_sqlCache].load(this._matchSqlid(option.sqlId), { ctx: option.context, isCount: false, ...option.params });
2851
2855
  let sqlSum = '';