Skip to content

Commit 33d1f7f

Browse files
committed
Java:MultiDataSource 更新内置的 APIAuto 源码
1 parent 67ae977 commit 33d1f7f

File tree

6 files changed

+135
-97
lines changed

6 files changed

+135
-97
lines changed

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

Lines changed: 49 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@
1919
在常用功能上远超 Postman, Swagger, YApi, Rap 等其它各种 开源、商业 的 API 文档/测试 工具。<br />
2020
支持 HTTP GET/POST API,智能显示和切换;支持一键导入 Swagger, Rap, YApi 的用例和文档。<br />
2121
不仅适用于 RESTful、类 RESTful、GRPC 的 API,还是腾讯 [APIJSON](https://github.com/Tencent/APIJSON) 官方建议的文档与测试工具。<br />
22-
腾讯内部用户包括 互娱、技术工程、云与智慧 等,外部用户包含 500强上市公司深圳传音、行业领头羊社保科技 等。
22+
腾讯内部用户包括 互动娱乐、技术工程、云与智慧 等,外部用户包含 500强上市公司深圳传音、行业领头羊社保科技 等。
2323

2424
#### 和华为云副总裁并列,QECon-全球软件质量&效能 大会分享总结
2525
零代码开发和测试 成为大会主会场回看预约海报唯一分会场演讲范例 <br />
26-
https://www.bilibili.com/video/BV1yv411p7Y4
27-
2826
<img width="1360" alt="wecom-temp-377bbd0daf5aed716baf7ebcb003d94c" src="https://user-images.githubusercontent.com/5738175/121370207-1b35de00-c96f-11eb-840e-cc2ff2995888.png">
2927

3028
<img width="390" src="https://user-images.githubusercontent.com/5738175/125167121-86bed580-e1d1-11eb-9dc6-2ea190146fe6.png">
@@ -39,15 +37,33 @@ https://www.bilibili.com/video/BV1yv411p7Y4
3937
* 零代码开发和测试(API测试•单元测试•API开发)
4038
* 零代码开发和测试(API测试•单元测试•API开发)
4139

42-
![image](https://user-images.githubusercontent.com/5738175/116197821-c72cbc80-a767-11eb-8df1-5dc6f1d46e8f.png)
43-
![image](https://user-images.githubusercontent.com/5738175/116197853-d3b11500-a767-11eb-902a-40be717143e2.png)
44-
![image](https://user-images.githubusercontent.com/5738175/116197886-ddd31380-a767-11eb-9a3d-af284d23c017.png)
45-
![image](https://user-images.githubusercontent.com/5738175/116198400-7b2e4780-a768-11eb-88e7-f263ff9f1be2.png)
46-
![image](https://user-images.githubusercontent.com/5738175/116197935-ee838980-a767-11eb-85e0-149c2449447a.png)
47-
![image](https://user-images.githubusercontent.com/5738175/116197967-f6dbc480-a767-11eb-8648-a1a9957c2c8b.png)
48-
![image](https://user-images.githubusercontent.com/5738175/116198123-2a1e5380-a768-11eb-9edb-61d3b30648dc.png)
49-
![image](https://user-images.githubusercontent.com/5738175/116198091-1b37a100-a768-11eb-914f-9f507b10c4e8.png)
50-
![image](https://user-images.githubusercontent.com/5738175/116338706-c0a55000-a80e-11eb-8502-78c4bb1d3af2.png)
40+
![image](https://user-images.githubusercontent.com/5738175/145665614-f9208e35-9dc2-4a02-a8c9-0d7c9f4a87bc.png)
41+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 008](https://user-images.githubusercontent.com/5738175/145665488-42b04a4b-1f74-4fb8-8a62-db3535f4256c.jpeg)
42+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 009](https://user-images.githubusercontent.com/5738175/145665490-d90dda3f-2439-44d2-b7ae-88fb6f7e6c92.jpeg)
43+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 010](https://user-images.githubusercontent.com/5738175/145665492-65409dd7-10ef-4c70-928e-48affe020df4.jpeg)
44+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 012](https://user-images.githubusercontent.com/5738175/145665496-628f7cc4-f6b9-4329-a759-8d0185de4f87.jpeg)
45+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 013](https://user-images.githubusercontent.com/5738175/145665502-94231804-5ea8-4784-b30d-d5558aad0f8d.jpeg)
46+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 014](https://user-images.githubusercontent.com/5738175/145665504-a6d6b251-0284-4026-9d62-0cc7937082b1.jpeg)
47+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 016](https://user-images.githubusercontent.com/5738175/145665508-0c02afe0-0e13-4f5f-8fd8-f0a017ed6e26.jpeg)
48+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 017](https://user-images.githubusercontent.com/5738175/145665509-cf1d841a-a7a6-441c-8b68-eaf65b452bfc.jpeg)
49+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 018](https://user-images.githubusercontent.com/5738175/145665512-86b5f067-c490-4de6-afa7-78c0f328c9cd.jpeg)
50+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 019](https://user-images.githubusercontent.com/5738175/145665514-b22e7180-237a-4f13-acc1-8eb21c9b5b37.jpeg)
51+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 020](https://user-images.githubusercontent.com/5738175/145665516-61e2693b-ec34-4775-9a71-52b5af5d3ede.jpeg)
52+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 021](https://user-images.githubusercontent.com/5738175/145665518-a35bc996-9cc2-478a-a1de-7ba731dbe557.jpeg)
53+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 022](https://user-images.githubusercontent.com/5738175/145665522-8f0ff509-5510-4d94-96e2-d088aecf6fce.jpeg)
54+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 023](https://user-images.githubusercontent.com/5738175/145665525-a624f521-4a6f-4315-9aa3-a7309348d083.jpeg)
55+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 024](https://user-images.githubusercontent.com/5738175/145665527-4a5da35a-da8c-4abd-8fb7-71059fbb4520.jpeg)
56+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 025](https://user-images.githubusercontent.com/5738175/145665528-dabbcaa0-617a-41e7-b3d3-cc66251934b1.jpeg)
57+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 026](https://user-images.githubusercontent.com/5738175/145665530-5b3b1cbd-0962-49fa-ab59-b307672b7c62.jpeg)
58+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 027](https://user-images.githubusercontent.com/5738175/145665531-2449009f-7fea-435c-ad0e-f7f2f525d4e5.jpeg)
59+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 028](https://user-images.githubusercontent.com/5738175/145665535-b86d4e49-cfa5-4aa5-8f71-d8e68a85828a.jpeg)
60+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 030](https://user-images.githubusercontent.com/5738175/145665537-de24b9b6-b47f-45cd-82bf-b7d06d156ce6.jpeg)
61+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 031](https://user-images.githubusercontent.com/5738175/145665538-983ffe6f-f293-466a-ab4c-d5de12e20fae.jpeg)
62+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 033](https://user-images.githubusercontent.com/5738175/145665542-2e1b0a43-ed06-4305-8e7d-b7c475dad0f9.jpeg)
63+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 034](https://user-images.githubusercontent.com/5738175/145665545-00229bae-726a-4426-ae76-d43ed45df65d.jpeg)
64+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 036](https://user-images.githubusercontent.com/5738175/145665552-05259dac-9546-4819-9db3-bb23e332f742.jpeg)
65+
![APIJSON 和 APIAuto - 零代码开发和测试-QECon 大会-图像 037](https://user-images.githubusercontent.com/5738175/145665553-68403dcb-4cdd-42d4-9ffc-e32657e16b2b.jpeg)
66+
5167

5268

5369
### 特点功能
@@ -96,19 +112,26 @@ https://www.bilibili.com/video/BV1yv411p7Y4
96112

97113
### 部署方法
98114

99-
可以直接下载源码解压后用浏览器打开 index.html,建议用 Chrome 或 火狐 (Safari、Edge、IE 等可能有兼容问题)。<br />
100-
也可以直接访问官方网站 http://apijson.cn/api <br />
115+
本项目是纯静态 SPA 网页,下载源码解压后:<br />
116+
可以用浏览器打开 index.html,建议用 [Chrome](https://www.google.com/intl/zh-CN/chrome)[Firefox](https://www.mozilla.org/zh-CN/firefox) (Safari、Edge、IE 等可能有兼容问题),注意此方法不显示 svg 图标。<br />
117+
也可以用 [IntelIJ Webstorm](https://www.jetbrains.com/webstorm/), [IntelliJ IDEA](https://www.jetbrains.com/idea/), [Eclipse](https://www.eclipse.org/) 等 IDE 来打开。<br />
118+
也可以部署到服务器并用 [Nginx](https://www.jianshu.com/p/11fa3a1a6d65)[Node](https://segmentfault.com/a/1190000039744899) 反向代理,或者 [把源码放到 SpringBoot 项目的 static 目录](https://github.com/APIJSON/APIJSON-Demo/tree/master/APIJSON-Java-Server)。 <br />
119+
还可以直接访问官方网站 http://apijson.cn/api <br />
101120
<br />
102121
把左侧 URL 输入框内基地址改为你主机的地址(例如 http://localhost:8080 ),<br />
103122
然后在右上角 设置 下拉菜单内修改 数据库类型Database、数据库模式Schema。<br />
104123
<br />
105124
右上角登录的默认管理员账号为 13000082001 密码为 123456,<br />
106125
右侧上方中间 3 个标签是默认的测试用户账号,点击登录/退出,左侧 - 删除,右侧 + 新增。<br />
107126
<br />
108-
自动生成文档、自动管理测试用例 这两个功能 需要部署APIJSON后端,见 <br />
127+
自动生成文档、自动管理测试用例 这两个功能 需要部署 APIJSON 后端,建议用 APIJSONBoot 系列之一 Demo,见 <br />
109128
https://github.com/APIJSON/APIJSON-Demo/tree/master/APIJSON-Java-Server
110129

111130
### 常见问题
131+
132+
**本网页工具基本每个按钮/输入框等 UI 组件都有注释或悬浮文档等形式的操作提示,<br />
133+
很多问题都不需要看文档/视频,可以直接通过把光标放上去等简单尝试来得到解答**
134+
112135
#### 1.无法访问接口
113136
Chrome 90+ 对 CORS 请求禁止携带 Cookie 或 Chrome 80-89 强制 same-site Cookie 的策略导致 <br />
114137
https://github.com/TommyLemon/APIAuto/issues/9
@@ -125,7 +148,6 @@ https://github.com/TommyLemon/APIAuto/issues/12
125148
管理后台网页改用 http://apijson.cn/api ,托管服务地址改为 http://47.74.39.68:9090 <br />
126149
https://github.com/TommyLemon/APIAuto/issues/13
127150

128-
129151
更多常见问题 <br />
130152
https://github.com/TommyLemon/APIAuto
131153

@@ -149,37 +171,31 @@ https://github.com/TommyLemon/APIAuto
149171
<br />
150172

151173

152-
153174
### 其它项目
154-
[APIJSON](https://github.com/Tencent/APIJSON) 腾讯零代码、热更新、自动化 ORM 库 🏆 后端接口和文档自动化,前端(客户端) 定制返回 JSON 的数据和结构
155-
156-
[apijson-doc](https://github.com/vincentCheng/apijson-doc) APIJSON 官方文档,提供排版清晰、搜索方便的文档内容展示,包括设计规范、图文教程等
157175

158-
[APIJSONdocs](https://github.com/ruoranw/APIJSONdocs) APIJSON 英文文档,提供排版清晰的文档内容展示,包括详细介绍、设计规范、使用方式等
176+
[APIJSON](https://github.com/Tencent/APIJSON) 腾讯零代码、热更新、全自动 ORM 库 🏆 后端接口和文档自动化,前端(客户端) 定制返回 JSON 的数据和结构
159177

160-
[apijson.org](https://github.com/APIJSON/APIJSON.org) APIJSON 官方网站,提供 APIJSON 的 功能简介、登记用户、作者与贡献者、相关链接 等
178+
[UnitAuto](https://github.com/TommyLemon/UnitAuto) 机器学习单元测试平台,零代码、全方位、自动化 测试 方法/函数 的正确性和可用性
161179

162180
[APIJSON.NET](https://github.com/liaozb/APIJSON.NET) C# 版 APIJSON ,支持 MySQL, PostgreSQL, SQL Server, Oracle, SQLite
163181

164-
[apijson-php](https://github.com/qq547057827/apijson-php) PHP 版 APIJSON,基于 ThinkPHP,支持 MySQL, PostgreSQL, SQL Server, Oracle
182+
[apijson-go](https://gitee.com/tiangao/apijson-go) Go 版 APIJSON ,支持单表查询、数组查询、多表一对一关联查询、多表一对多关联查询
165183

166-
[apijson-node](https://github.com/kevinaskin/apijson-node) Node.ts 版 APIJSON,提供 nestjs 和 typeorm 的 Demo,支持 MySQL, PostgreSQL, SQL Server, Oracle
184+
[APIJSON-php](https://github.com/xianglong111/APIJSON-php) PHP 版 APIJSON,基于 ThinkPHP,支持 MySQL, PostgreSQL, SQL Server, Oracle
167185

168-
[uliweb-apijson](https://github.com/zhangchunlin/uliweb-apijson) Python 版 APIJSON,支持 MySQL, PostgreSQL, SQL Server, Oracle, SQLite
186+
[apijson-php](https://github.com/qq547057827/apijson-php) PHP 版 APIJSON,基于 ThinkPHP,支持 MySQL, PostgreSQL, SQL Server, Oracle 等
169187

170-
[APIJSON](https://github.com/crazytaxi824/APIJSON) Go 版 APIJSON,功能开发中...
188+
[apijson-node](https://github.com/kevinaskin/apijson-node) 字节跳动工程师开源的 Node.ts 版 APIJSON,提供 nestjs 和 typeorm 的 Demo
171189

172-
[APIJSONKOTLIN](https://github.com/luckyxiaomo/APIJSONKOTLIN) Kotlin 版 APIJSON,基础框架搭建中...
190+
[uliweb-apijson](https://github.com/zhangchunlin/uliweb-apijson) Python 版 APIJSON,支持 MySQL, PostgreSQL, SQL Server, Oracle, SQLite 等
173191

174192
[APIJSONParser](https://github.com/Zerounary/APIJSONParser) 第三方 APIJSON 解析器,将 JSON 动态解析成 SQL
175193

176-
[ApiJsonByJFinal](https://gitee.com/zhiyuexin/ApiJsonByJFinal) 整合 APIJSON 和 JFinal 的 Demo
177-
178-
[SpringServer1.2-APIJSON](https://github.com/Airforce-1/SpringServer1.2-APIJSON) 智慧党建服务器端,提供 上传 和 下载 文件的接口
179-
180-
[UnitAuto](https://github.com/TommyLemon/UnitAuto) 机器学习单元测试平台,零代码、全方位、自动化 测试 方法/函数 的正确性和可用性
194+
[APIJSON-ToDo-Demo](https://github.com/jerrylususu/apijson_todo_demo) 一个简单的 todo 示例项目,精简数据,简化上手流程,带自定义鉴权逻辑
195+
196+
[apijson-practice](https://github.com/vcoolwind/apijson-practice) BAT 技术专家开源的 APIJSON 参数校验注解 Library 及相关 Demo
181197

182-
感谢热心的作者们的贡献,点 ⭐Star 支持下他们吧。
198+
[apijson-learn](https://github.com/rainboy-learn/apijson-learn) APIJSON 学习笔记和源码解析
183199

184200

185201
### 持续更新

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6220,7 +6220,7 @@ var CodeUtil = {
62206220
var t = targetObj == null ? null : targetObj.type;
62216221
var targetComment = targetObj == null ? null : targetObj.comment;
62226222
var c = targetObj == null ? null : CodeUtil.getType4Language(language, t, true) + (targetObj.notnull ? ', ' : '? ') + StringUtil.trim(targetComment);
6223-
if (CodeUtil.isTypeMatch(t, CodeUtil.getType4Request(value))) {
6223+
if (CodeUtil.isTypeMatch(t, CodeUtil.getType4Request(value)) != true) {
62246224
c = ' ! value必须是' + CodeUtil.getType4Language(language, t) + '类型!' + (isWarning ? ' ' : CodeUtil.getComment(c, false, ' '));
62256225
if (ignoreError != true) {
62266226
throw new Error(c);
@@ -6354,7 +6354,7 @@ var CodeUtil = {
63546354
t = 'number';
63556355
}
63566356

6357-
if (CodeUtil.isTypeMatch(t, CodeUtil.getType4Request(value))) {
6357+
if (CodeUtil.isTypeMatch(t, CodeUtil.getType4Request(value)) != true) {
63586358
c = ' ! value必须是' + CodeUtil.getType4Language(language, t) + '类型!' + (isWarning ? ' ' : CodeUtil.getComment(c, false, ' '))
63596359
if (ignoreError != true) {
63606360
throw new Error(c);
@@ -6648,7 +6648,7 @@ var CodeUtil = {
66486648
var c = (p.length <= 0 ? '' : p + key + ': ') + t + (column.is_nullable == 'YES' ? '? ' : ', ') + (o || {}).column_comment;
66496649

66506650
var ct = CodeUtil.getType4Language(CodeUtil.LANGUAGE_JAVA_SCRIPT, column.column_type, false);
6651-
if (verifyType && t != null && CodeUtil.isTypeMatch(ct, CodeUtil.getType4Language(CodeUtil.LANGUAGE_JAVA_SCRIPT, typeOfValue))) {
6651+
if (verifyType && t != null && CodeUtil.isTypeMatch(ct, CodeUtil.getType4Language(CodeUtil.LANGUAGE_JAVA_SCRIPT, typeOfValue)) != true) {
66526652
// c = ' ! value必须是' + t + '类型!' + CodeUtil.getComment(c, false, ' ')
66536653
// if (ignoreError != true) {
66546654
// throw new Error(c);
@@ -6676,8 +6676,11 @@ var CodeUtil = {
66766676
return typeof value;
66776677
},
66786678

6679-
isTypeMatch(targetType, realType) {
6680-
return StringUtil.isEmpty(targetType, true) == false && targetType != realType && (targetType != 'number' || realType != 'integer');
6679+
isTypeMatch: function(targetType, realType) {
6680+
if (targetType == null || targetType == realType) {
6681+
return true;
6682+
}
6683+
return (targetType == 'number' && realType == 'integer') || (targetType == 'string' && ['date', 'time', 'datetime'].indexOf(realType) >= 0);
66816684
}
66826685

66836686
}

0 commit comments

Comments
 (0)