Skip to content

Commit 1f03d7d

Browse files
committed
Java: MultiDataSource 解决光标悬浮注释、静态检查、参数注入传参 等相关 bug
1 parent f7cb4cd commit 1f03d7d

7 files changed

Lines changed: 199 additions & 149 deletions

File tree

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/apijson/CodeUtil.js‎

Lines changed: 82 additions & 63 deletions
Large diffs are not rendered by default.

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/apijson/JSONResponse.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,8 @@ var JSONResponse = {
540540
}
541541
}
542542
codeName = StringUtil.isEmpty(codeName, true) ? JSONResponse.KEY_CODE : codeName;
543-
var tCode = (isMachineLearning != true && noBizCode) ? 0 : (target || {})[codeName];
544-
var rCode = noBizCode ? tCode : (real || {})[codeName];
543+
var tCode = (isMachineLearning != true && noBizCode) ? JSONResponse.CODE_SUCCESS : (target || {})[codeName];
544+
var rCode = noBizCode ? tCode : (real || {})[codeName] || (real == null || real == {} ? null : JSONResponse.CODE_SUCCESS);
545545

546546
//解决了弹窗提示机器学习更新标准异常,但导致所有项测试结果都变成状态码 code 改变
547547
// if (real == null) {
@@ -1924,7 +1924,7 @@ var JSONResponse = {
19241924
var notEmpty = prefix.endsWith('!')
19251925
var path = nullable || notEmpty ? prefix.substring(0, prefix.length - 1) : prefix
19261926
// sys.User.id|apijson.Moment.userId
1927-
var names = StringUtil.split(path, '/', true) || []
1927+
var names = StringUtil.split(path, '|') || []
19281928
for (var i = 0; i < names.length; i ++) {
19291929
var name = names[i] || ''
19301930

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/apijson/StringUtil.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ var StringUtil = {
105105

106106
SYNTAX_NAMES: ['bool', 'boolean', 'int', 'integer', 'num', 'number', 'str', 'string', 'arr', 'array', 'obj', 'object'
107107
, 'type', 'class', 'fun', 'func', 'function', 'var', 'variable', 'val', 'value', 'const', 'is', 'as', 'id', 'index', 'unique'
108+
, 'select', 'insert', 'update', 'delete', 'query', 'mutate', 'sleep', 'no', 'yes', 'and', 'or', 'not', 'cast', 'first', 'last'
108109
, 'from', 'join', 'on', 'at', 'in', 'out', 'where', 'by', 'having', 'limit', 'offset', 'find', 'list', 'get', 'set', 'put', 'remove'
110+
, 'slice', 'splice', 'reduce', 'add', 'minus', 'push', 'pop', 'list', 'dict', 'map', 'trim', 'of'
109111
],
110112
COLUMN_NAMES: ['page', 'count', 'size', 'pagesize', 'pagenum', 'pageno', 'col', 'column', 'name', 'age', 'sex', 'gender', 'amount'
111113
, 'email', 'phone', 'tel', 'telephone', 'detail', 'describe', 'description', 'total', 'index', 'position', 'key', 'row', 'len', 'length', 'data'

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/js/main.js‎

Lines changed: 97 additions & 68 deletions
Large diffs are not rendered by default.

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/cv/apijson/CodeUtil.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3780,7 +3780,7 @@ res_data = rep.json()
37803780
delete reqObj.orderBy;
37813781
}
37823782

3783-
// var columnStr = (StringUtil.isEmpty(colums, true) ? '' : StringUtil.trim(colums));
3783+
// var columnStr = (StringUtil.isEmpty(columns, true) ? '' : StringUtil.trim(columns));
37843784
var quote = database == 'MYSQL' ? '`' : '"';
37853785
var tablePath = (StringUtil.isEmpty(schema, true) ? '' : quote + schema + quote + '.') + quote + modelName + quote;
37863786
if (isPost) {
@@ -3799,11 +3799,11 @@ res_data = rep.json()
37993799
' DELETE FROM ' + tablePath;
38003800
}
38013801
else {
3802-
var colums = Object.keys(reqObj);
3802+
var columns = Object.keys(reqObj);
38033803
var cs = '';
3804-
if (colums != null && colums.length > 0) {
3805-
for (var i = 0; i < colums.length; i++) {
3806-
cs += (i <= 0 ? '' : ', ') + quote + colums[i] + quote; //需要尽可能保留原字段 [] 肯定不是字段名 JSONResponse.getVariableName(colums[i]) + quote;
3804+
if (columns != null && columns.length > 0) {
3805+
for (var i = 0; i < columns.length; i++) {
3806+
cs += (i <= 0 ? '' : ', ') + quote + columns[i] + quote; //需要尽可能保留原字段 [] 肯定不是字段名 JSONResponse.getVariableName(columns[i]) + quote;
38073807
}
38083808
}
38093809

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/sql/apijson/CodeUtil.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3472,7 +3472,7 @@ var CodeUtil = {
34723472
delete reqObj.orderBy;
34733473
}
34743474

3475-
// var columnStr = (StringUtil.isEmpty(colums, true) ? '' : StringUtil.trim(colums));
3475+
// var columnStr = (StringUtil.isEmpty(columns, true) ? '' : StringUtil.trim(columns));
34763476
var quote = database == 'MYSQL' ? '`' : '"';
34773477
var tablePath = (StringUtil.isEmpty(schema, true) ? '' : quote + schema + quote + '.') + quote + modelName + quote;
34783478
if (isPost) {
@@ -3491,11 +3491,11 @@ var CodeUtil = {
34913491
' DELETE FROM ' + tablePath;
34923492
}
34933493
else {
3494-
var colums = Object.keys(reqObj);
3494+
var columns = Object.keys(reqObj);
34953495
var cs = '';
3496-
if (colums != null && colums.length > 0) {
3497-
for (var i = 0; i < colums.length; i++) {
3498-
cs += (i <= 0 ? '' : ', ') + quote + colums[i] + quote; //需要尽可能保留原字段 [] 肯定不是字段名 JSONResponse.getVariableName(colums[i]) + quote;
3496+
if (columns != null && columns.length > 0) {
3497+
for (var i = 0; i < columns.length; i++) {
3498+
cs += (i <= 0 ? '' : ', ') + quote + columns[i] + quote; //需要尽可能保留原字段 [] 肯定不是字段名 JSONResponse.getVariableName(columns[i]) + quote;
34993499
}
35003500
}
35013501

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/unit/apijson/CodeUtil.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3777,7 +3777,7 @@ res_data = rep.json()
37773777
delete reqObj.orderBy;
37783778
}
37793779

3780-
// var columnStr = (StringUtil.isEmpty(colums, true) ? '' : StringUtil.trim(colums));
3780+
// var columnStr = (StringUtil.isEmpty(columns, true) ? '' : StringUtil.trim(columns));
37813781
var quote = database == 'MYSQL' ? '`' : '"';
37823782
var tablePath = (StringUtil.isEmpty(schema, true) ? '' : quote + schema + quote + '.') + quote + modelName + quote;
37833783
if (isPost) {
@@ -3796,11 +3796,11 @@ res_data = rep.json()
37963796
' DELETE FROM ' + tablePath;
37973797
}
37983798
else {
3799-
var colums = Object.keys(reqObj);
3799+
var columns = Object.keys(reqObj);
38003800
var cs = '';
3801-
if (colums != null && colums.length > 0) {
3802-
for (var i = 0; i < colums.length; i++) {
3803-
cs += (i <= 0 ? '' : ', ') + quote + colums[i] + quote; //需要尽可能保留原字段 [] 肯定不是字段名 JSONResponse.getVariableName(colums[i]) + quote;
3801+
if (columns != null && columns.length > 0) {
3802+
for (var i = 0; i < columns.length; i++) {
3803+
cs += (i <= 0 ? '' : ', ') + quote + columns[i] + quote; //需要尽可能保留原字段 [] 肯定不是字段名 JSONResponse.getVariableName(columns[i]) + quote;
38043804
}
38053805
}
38063806

0 commit comments

Comments
 (0)