doomiwork 3.4.0 → 3.4.1
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/database/mysqlbase.js +20 -0
- package/package.json +1 -1
|
@@ -36,6 +36,26 @@ class Database {
|
|
|
36
36
|
if (!scene) scene = this.constructor.name;
|
|
37
37
|
this.actionLogger.logError({ scene, error, user})
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* 检查是否存在数据
|
|
41
|
+
* @param {*} sqlCommand
|
|
42
|
+
* @param {*} parameters
|
|
43
|
+
*/
|
|
44
|
+
async existedSqlData(sqlCommand, parameters){
|
|
45
|
+
let sqlExecute = await this.executeSql(sqlCommand, parameters);
|
|
46
|
+
return { successed: sqlExecute.successed, existed: sqlExecute.rows.length>=1}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 获取到第一行记录的所有字段的值
|
|
50
|
+
* @param {*} sqlCommand
|
|
51
|
+
* @param {*} parameters
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
async getComputedRowValue(sqlCommand, parameters) {
|
|
55
|
+
let sqlExecute = await this.executeSql(sqlCommand, parameters);
|
|
56
|
+
if (sqlExecute.successed || sqlExecute.rows===0) return {successed:false,errcode:-1,errmsg:'没有任何记录'}
|
|
57
|
+
return { successed: true, ...sqlExecute.rows[0] }
|
|
58
|
+
}
|
|
39
59
|
/**
|
|
40
60
|
* 不事务执行SQL命令
|
|
41
61
|
* @param {*} sqlCommand
|