Skip to content

Commit 79faa17

Browse files
committed
Java:MultiDataSource 更新 APIAuto 代码;MySQL:更新表
1 parent 941e4a9 commit 79faa17

27 files changed

+205
-209
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/target/
2+
/bin/

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<dependency>
3030
<groupId>com.alibaba</groupId>
3131
<artifactId>fastjson</artifactId>
32-
<version>1.2.79</version>
32+
<version>1.2.83</version>
3333
</dependency>
3434

3535
<!-- apijson-framework 需要用的依赖库,4.0.0 以上 -->
@@ -123,7 +123,7 @@
123123
<version>1.2.9</version>
124124
</dependency>
125125

126-
</dependencies>
126+
</dependencies>
127127

128128
<build>
129129
<plugins>

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ https://github.com/TommyLemon/APIAuto
177177

178178
### 其它项目
179179

180-
[APIJSON](https://github.com/Tencent/APIJSON) 腾讯零代码、热更新、全自动 ORM 库 🏆 后端接口和文档自动化,前端(客户端) 定制返回 JSON 的数据和结构
180+
[APIJSON](https://github.com/Tencent/APIJSON) 腾讯零代码、全功能、强安全 ORM 库 🏆 后端接口和文档零代码,前端(客户端) 定制返回 JSON 的数据和结构
181181

182182
[UnitAuto](https://github.com/TommyLemon/UnitAuto) 机器学习单元测试平台,零代码、全方位、自动化 测试 方法/函数 的正确性和可用性
183183

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

+25-17
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ var CodeUtil = {
111111
var hintComment;
112112

113113
if (line.endsWith('{')) { //对象,判断是不是Table,再加对应的注释
114-
// value = {}
114+
if (value == null) {
115+
value = {}
116+
}
115117

116118
if (depth > 0 && comment.length > 0) {
117119
standardObj = JSONResponse.updateStandardByPath(standardObj, names, key, value, comment)
@@ -132,7 +134,9 @@ var CodeUtil = {
132134
}
133135
else {
134136
if (line.endsWith('}')) {
135-
// value = {}
137+
if (value == null) {
138+
value = {}
139+
}
136140

137141
if (depth > 0 && comment.length > 0) {
138142
standardObj = JSONResponse.updateStandardByPath(standardObj, names, key, value, comment)
@@ -164,7 +168,9 @@ var CodeUtil = {
164168
// }
165169
else {
166170
if (line.endsWith('[')) { // [] 不影响
167-
// value = []
171+
if (value == null) {
172+
value = []
173+
}
168174

169175
if (depth > 0 && comment.length > 0) {
170176
standardObj = JSONResponse.updateStandardByPath(standardObj, names, key, value, comment)
@@ -183,7 +189,9 @@ var CodeUtil = {
183189
}
184190
else {
185191
if (line.endsWith(']')) {
186-
// value = []
192+
if (value == null) {
193+
value = []
194+
}
187195

188196
if (depth > 0 && comment.length > 0) {
189197
standardObj = JSONResponse.updateStandardByPath(standardObj, names, key, value, comment)
@@ -204,19 +212,19 @@ var CodeUtil = {
204212
continue;
205213
}
206214
}
207-
else { //其它,直接在后面加上注释
208-
// value = line.substring(index + 2).trim()
209-
// if (value.startsWith('"')) {
210-
// value = value.substring(1, value.lastIndexOf('"'))
211-
// }
212-
// else {
213-
// try {
214-
// value = JSON.parse(value)
215-
// }
216-
// catch (e) {
217-
// console.log(e)
218-
// }
219-
// }
215+
else if (value == null) { //其它,直接在后面加上注释
216+
value = line.substring(index + 2).trim()
217+
if (value.startsWith('"')) {
218+
value = value.substring(1, value.lastIndexOf('"'))
219+
}
220+
else {
221+
try {
222+
value = JSON.parse(value)
223+
}
224+
catch (e) {
225+
console.log(e)
226+
}
227+
}
220228
}
221229
// alert('depth = ' + depth + '; line = ' + line + '; isArray = ' + isArray);
222230
hintComment = CodeUtil.getComment4Request(tableList, names[depth - 1], key, value, method, isInSubquery, database, language, isReq, names, isRestful, standardObj, isWarning, isAPIJSONRouter);

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/apijson/JSONRequest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
const TAG_REQUEST_UTIL = 'RequestUtil';
2222

23-
var URL_BASE = "http://localhost:8080"; // "http://apijson.cn:8080"; // 基地址
23+
var URL_BASE = "http://apijson.cn:8080"; // 基地址
2424
var URL_GET = URL_BASE + "/get"; // 常规获取数据方式
2525
var URL_HEAD = URL_BASE + "/head"; // 检查,默认是非空检查,返回数据总数
2626
var URL_GETS = URL_BASE + "/gets"; // 通过POST来GET数据,不显示请求内容和返回结果,一般用于对安全要求比较高的请求

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ var JSONResponse = {
150150
* @param fullName
151151
* @return {@link #formatKey(String, boolean, boolean, boolean)} formatColon = true, formatAt = true, formatHyphen = true, firstCase = true
152152
*/
153-
getVariableName(fullName, listSuffix) {
153+
getVariableName: function(fullName, listSuffix) {
154154
if (JSONObject.isArrayKey(fullName)) {
155155
fullName = StringUtil.addSuffix(fullName.substring(0, fullName.length - 2), listSuffix || "list");
156156
}
@@ -161,7 +161,7 @@ var JSONResponse = {
161161
* @param key empty ? "list" : key + "List" 且首字母小写
162162
* @return {@link #formatKey(String, boolean, boolean, boolean)} formatColon = false, formatAt = true, formatHyphen = true, firstCase = true
163163
*/
164-
formatArrayKey(key) {
164+
formatArrayKey: function(key) {
165165
if (JSONObject.isArrayKey(key)) {
166166
key = StringUtil.addSuffix(key.substring(0, key.length - 2), "list");
167167
}
@@ -177,7 +177,7 @@ var JSONResponse = {
177177
* @param key name 或 name:alias
178178
* @return {@link #formatKey(String, boolean, boolean, boolean)} formatColon = false, formatAt = true, formatHyphen = false, firstCase = true
179179
*/
180-
formatObjectKey(key) {
180+
formatObjectKey: function(key) {
181181
var index = key == null ? -1 : key.indexOf(":");
182182
if (index >= 0) {
183183
return key.substring(index + 1); //不处理自定义的
@@ -190,7 +190,7 @@ var JSONResponse = {
190190
* @param fullName name 或 name:alias
191191
* @return {@link #formatKey(String, boolean, boolean, boolean)} formatColon = false, formatAt = true, formatHyphen = false, firstCase = false
192192
*/
193-
formatOtherKey(fullName) {
193+
formatOtherKey: function(fullName) {
194194
return JSONResponse.formatKey(fullName, false, true, false, false); //节约性能,除了关键词 @key ,一般都符合变量命名规范,不符合也原样返回便于调试
195195
},
196196

@@ -202,7 +202,7 @@ var JSONResponse = {
202202
* @param firstCase 第一个单词首字母小写,后面的首字母大写, Ab => ab ; A-b-Cd => aBCd
203203
* @return name => name; name:alias => alias
204204
*/
205-
formatKey(fullName, formatAlias, formatAt, formatHyphen, firstCase, formatUnderline, formatFunChar) {
205+
formatKey: function(fullName, formatAlias, formatAt, formatHyphen, firstCase, formatUnderline, formatFunChar) {
206206
if (fullName == null) {
207207
log(JSONResponse.TAG, "formatKey fullName == null >> return null;");
208208
return null;
@@ -231,15 +231,15 @@ var JSONResponse = {
231231
* @param key
232232
* @return
233233
*/
234-
formatAt(key) {
234+
formatAt: function(key) {
235235
var k = key.startsWith("@") ? key.substring(1) : key;
236236
return k; //由 formatFunChar 实现去掉末尾的 @ k.endsWith("@") ? k.substring(0, k.length - 1) : k;
237237
},
238238
/**key:alias => keyAsAlias
239239
* @param key
240240
* @return
241241
*/
242-
formatAlias(key) {
242+
formatAlias: function(key) {
243243
var index = key.indexOf(":");
244244
return index < 0 ? key : key.substring(0, index) + 'As' + StringUtil.firstCase(key.substring(index + 1), true);
245245
},
@@ -248,7 +248,7 @@ var JSONResponse = {
248248
* @param key
249249
* @return
250250
*/
251-
formatHyphen(key, firstCase) {
251+
formatHyphen: function(key, firstCase) {
252252
var first = true;
253253
var index;
254254

@@ -272,7 +272,7 @@ var JSONResponse = {
272272
* @param key
273273
* @return
274274
*/
275-
formatUnderline(key, firstCase) {
275+
formatUnderline: function(key, firstCase) {
276276
var first = true;
277277
var index;
278278

@@ -296,7 +296,7 @@ var JSONResponse = {
296296
* @param key
297297
* @return
298298
*/
299-
formatFunChar(key) {
299+
formatFunChar: function(key) {
300300
var name = key.replace(/@/g, 'At');
301301
name = name.replace(/{}/g, 'In')
302302
name = name.replace(/}{/g, 'Exists')
@@ -1489,7 +1489,7 @@ var JSONResponse = {
14891489
return StringUtil.isEmpty(folder, true) ? name : folder + divider + name;
14901490
},
14911491

1492-
getShowString(arr, lineItemCount) {
1492+
getShowString: function(arr, lineItemCount) {
14931493
if (arr == null || arr.length <= 0) {
14941494
return '';
14951495
}

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

+4
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ var StringUtil = {
167167

168168
isNumber: function (s) {
169169
return typeof s == 'string' && /^[0-9]+$/.test(s);
170+
},
171+
172+
join: function (arr, separator) {
173+
return arr == null ? '' : arr.join(separator)
170174
}
171175

172176
}
Loading

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/index.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969

7070
<img src="img/logo.png" class="logo-img"/>
7171
<a class="logo" href="http://apijson.cn" target="_blank">
72-
<span class="on">APIJSON</span><span >.cn</span>
72+
<span class="on">APIAuto</span><span >: APIJSON.cn</span>
7373
</a>
7474
<a v-show="isDelayShow" >2s</a>
7575

@@ -194,7 +194,7 @@
194194
<textarea id="vComment" style="width: 100%; height: 100%; position: absolute; z-index: 0; color: darkseagreen; background-color: white;" wrap="off" disabled>
195195
</textarea>
196196
<textarea v-show="! isEditResponse" id="vWarning" style="width: 100%; height: 100%; position: absolute; z-index: 0; color: orangered; background-color: #0000;" wrap="off" disabled>
197-
</textarea>
197+
</textarea>
198198
<textarea id="vInput" @copy="doOnCopy" @paste="doOnPaste" @keyup="onChange(true)" style="width: 100%;height: 100%; position: absolute; z-index: 100; background: #0000;" wrap="off" placeholder="{ // 根对象,可在内部加 format,tag,version,@role,@database,@schema,@datasource,@explain,@cache 等全局关键词键值对
199199
'[]': { // 数组,可在内部加 count,page,query,join 等关键词键值对
200200
'count': 5, // 每页数量
@@ -489,6 +489,7 @@
489489
<use xlink:href="svg/icon.svg#record"></use>
490490
</svg>
491491
</a>
492+
<img v-show="isLoading" width="15" height="15" src="img/loading.gif" style="margin-bottom: 4px; margin-left: 6px" />
492493

493494
</div>
494495

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

+18-7
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@
576576
error: {},
577577
requestVersion: 3,
578578
requestCount: 1,
579-
urlComment: '关联查询 Comment.userId = User.id',
579+
urlComment: '一对多关联查询 Comment.userId = User.id',
580580
historys: [],
581581
history: {name: '请求0'},
582582
remotes: [],
@@ -617,6 +617,7 @@
617617
testRandomCount: 1,
618618
testRandomProcess: '',
619619
compareColor: '#0000',
620+
isLoading: false,
620621
isRandomTest: false,
621622
isDelayShow: false,
622623
isSaveShow: false,
@@ -1710,7 +1711,7 @@
17101711
const isReleaseRESTful = isExportRandom && btnIndex == 1 && ! isEditResponse
17111712

17121713
const method = App.getMethod();
1713-
const methodInfo = isReleaseRESTful ? (CodeUtil.parseUri(method, true) || {}) : {};
1714+
const methodInfo = isReleaseRESTful ? (JSONObject.parseUri(method, true) || {}) : {};
17141715
if (isReleaseRESTful) {
17151716
var isRestful = methodInfo.isRestful;
17161717
var tag = methodInfo.tag;
@@ -3173,7 +3174,7 @@
31733174
this.password = user.password
31743175
},
31753176

3176-
setRememberLogin(remember) {
3177+
setRememberLogin: function (remember) {
31773178
vRemember.checked = remember || false
31783179
},
31793180

@@ -3816,8 +3817,13 @@
38163817

38173818
//请求
38183819
request: function (isAdminOperation, type, url, req, header, callback) {
3820+
this.isLoading = true
3821+
38193822
type = type || REQUEST_TYPE_JSON
38203823
url = StringUtil.noBlank(url)
3824+
if (url.startsWith('/')) {
3825+
url = (isAdminOperation ? this.server : this.project) + url
3826+
}
38213827

38223828
var isDelegate = (isAdminOperation == false && this.isDelegateEnabled) || (isAdminOperation && url.indexOf('://apijson.cn:9090') > 0)
38233829

@@ -3856,6 +3862,8 @@
38563862
// crossDomain: true
38573863
})
38583864
.then(function (res) {
3865+
App.isLoading = false
3866+
38593867
res = res || {}
38603868

38613869
if (isDelegate) {
@@ -3897,6 +3905,8 @@
38973905
App.onResponse(url, res, null)
38983906
})
38993907
.catch(function (err) {
3908+
App.isLoading = false
3909+
39003910
log('send >> error:\n' + err)
39013911
if (isAdminOperation) {
39023912
App.delegateId = null
@@ -4714,7 +4724,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
47144724
var column_comment = (o || {}).column_comment
47154725

47164726
// column.column_comment = column_comment
4717-
doc += '\n' + name + ' | ' + type + ' | ' + length + ' | ' + App.toMD(column_comment);
4727+
doc += '\n' + name + ' | ' + type.replace(/</g, '&lt;').replace(/>/g, '&gt;') + ' | ' + length + ' | ' + App.toMD(column_comment);
47184728

47194729
}
47204730

@@ -5268,7 +5278,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
52685278

52695279
// alert('< json = ' + JSON.stringify(json, null, ' '))
52705280

5271-
for (let i = 0; i < lines.length; i ++) {
5281+
for (let i = 0; i < reqCount; i ++) {
52725282
const which = i;
52735283
const lineItem = lines[i] || '';
52745284

@@ -5658,7 +5668,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
56585668
continue
56595669
}
56605670
if (document.url == '/login' || document.url == '/logout') { //login会导致登录用户改变为默认的但UI上还显示原来的,单独测试OWNER权限时能通过很困惑
5661-
this.log('test document.url == "/login" || document.url == "/logout" >> continue')
5671+
this.log('startTest document.url == "/login" || document.url == "/logout" >> continue')
56625672
doneCount++
56635673
continue
56645674
}
@@ -5868,6 +5878,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
58685878
*/
58695879
removeDebugInfo: function (obj) {
58705880
if (obj != null) {
5881+
delete obj["trace"]
58715882
delete obj["debug:info|help"]
58725883
delete obj["sql:generate|cache|execute|maxExecute"]
58735884
delete obj["depth:count|max"]
@@ -6306,7 +6317,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
63066317
return result
63076318
}
63086319
},
6309-
created () {
6320+
created: function () {
63106321
try { //可能URL_BASE是const类型,不允许改,这里是初始化,不能出错
63116322
var url = this.getCache('', 'URL_BASE')
63126323
if (StringUtil.isEmpty(url, true) == false) {

MySQL/single/sys_Access.sql

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- MySQL dump 10.13 Distrib 5.7.17, for macos10.12 (x86_64)
1+
-- MySQL dump 10.13 Distrib 8.0.29, for macos12 (x86_64)
22
--
33
-- Host: apijson.cn Database: sys
44
-- ------------------------------------------------------
@@ -7,7 +7,7 @@
77
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
88
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
99
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10-
/*!40101 SET NAMES utf8 */;
10+
/*!50503 SET NAMES utf8 */;
1111
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
1212
/*!40103 SET TIME_ZONE='+00:00' */;
1313
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
@@ -21,7 +21,7 @@
2121

2222
DROP TABLE IF EXISTS `Access`;
2323
/*!40101 SET @saved_cs_client = @@character_set_client */;
24-
/*!40101 SET character_set_client = utf8 */;
24+
/*!50503 SET character_set_client = utf8mb4 */;
2525
CREATE TABLE `Access` (
2626
`id` bigint(15) NOT NULL AUTO_INCREMENT,
2727
`debug` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否为 DEBUG 调试数据,只允许在开发环境使用,测试和线上环境禁用:0-否,1-是。',
@@ -60,4 +60,4 @@ UNLOCK TABLES;
6060
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
6161
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
6262

63-
-- Dump completed on 2022-05-04 18:38:34
63+
-- Dump completed on 2022-07-12 2:51:25

0 commit comments

Comments
 (0)