mm_os 2.1.5 → 2.1.7
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/core/com/api/drive.js +6 -6
- package/core/com/sql/drive.js +26 -5
- package/package.json +1 -1
package/core/com/api/drive.js
CHANGED
|
@@ -268,12 +268,12 @@ Drive.prototype.loadSql = async function(file_path) {
|
|
|
268
268
|
this.sql.load(p);
|
|
269
269
|
this.setSql(this.sql);
|
|
270
270
|
}
|
|
271
|
-
if (this.sql && this.param && this.param.config) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
271
|
+
// if (this.sql && this.param && this.param.config) {
|
|
272
|
+
// var list = this.param.config.list;
|
|
273
|
+
// if (list && list.length) {
|
|
274
|
+
// this.sql.params = list;
|
|
275
|
+
// }
|
|
276
|
+
// }
|
|
277
277
|
}
|
|
278
278
|
};
|
|
279
279
|
|
package/core/com/sql/drive.js
CHANGED
|
@@ -556,6 +556,18 @@ Drive.prototype.addOrSet = async function(db, query, body) {
|
|
|
556
556
|
return await this.addOrSet_main(db, query, body);
|
|
557
557
|
};
|
|
558
558
|
|
|
559
|
+
/**
|
|
560
|
+
* 获取数据类型
|
|
561
|
+
* @param {String} dataType 数据库数据类型
|
|
562
|
+
* @returns {String} 返回数据类型
|
|
563
|
+
*/
|
|
564
|
+
Drive.prototype.get_type = function(dataType) {
|
|
565
|
+
if (dataType.indexOf('int') !== -1) {
|
|
566
|
+
return 'number'
|
|
567
|
+
} else {
|
|
568
|
+
return 'string'
|
|
569
|
+
}
|
|
570
|
+
}
|
|
559
571
|
|
|
560
572
|
/**
|
|
561
573
|
* 获取数据
|
|
@@ -597,15 +609,16 @@ Drive.prototype.get_params = async function(db, fields) {
|
|
|
597
609
|
var note = o.note ? o.note.replace(":", ":") : name;
|
|
598
610
|
lt.push({
|
|
599
611
|
name,
|
|
600
|
-
title: note.left(":", true)
|
|
612
|
+
title: note.left(":", true),
|
|
613
|
+
type: this.get_type(o.type)
|
|
601
614
|
});
|
|
602
615
|
}
|
|
603
616
|
}
|
|
604
617
|
if (!fields) {
|
|
605
|
-
fields = cg.field_default
|
|
618
|
+
fields = cg.field_default;
|
|
606
619
|
}
|
|
607
620
|
if (fields && fields !== "*") {
|
|
608
|
-
var arr = fields.split(',');
|
|
621
|
+
var arr = fields.replace(/`/g, "").split(',');
|
|
609
622
|
var params = [];
|
|
610
623
|
arr.map((name) => {
|
|
611
624
|
var obj = lt.getObj({
|
|
@@ -618,6 +631,7 @@ Drive.prototype.get_params = async function(db, fields) {
|
|
|
618
631
|
} else {
|
|
619
632
|
params = lt;
|
|
620
633
|
}
|
|
634
|
+
console.log("列表", params, fields);
|
|
621
635
|
return params;
|
|
622
636
|
};
|
|
623
637
|
|
|
@@ -792,8 +806,15 @@ Drive.prototype.export_main = async function(db, query, body) {
|
|
|
792
806
|
if (!file) {
|
|
793
807
|
file = this.save_dir + name;
|
|
794
808
|
}
|
|
795
|
-
if (!fields
|
|
796
|
-
|
|
809
|
+
if (!fields) {
|
|
810
|
+
if (query.field) {
|
|
811
|
+
fields = query.field;
|
|
812
|
+
} else {
|
|
813
|
+
var f = this.config.field_default;
|
|
814
|
+
if (f.length !== "*") {
|
|
815
|
+
fields = f;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
797
818
|
}
|
|
798
819
|
var params = await this.get_params(db, fields);
|
|
799
820
|
var format = await this.get_format(db);
|