@@ -15,6 +15,9 @@ http://apijson.cn/api <br />
15153.不影响现有功能的使用,不能让现有功能不可用或者使用更复杂 <br />
1616
1717#### 新增支持假删除
18+ 20230106 更新:已支持,感谢 @cloudAndMonkey 的贡献 <br />
19+ https://github.com/Tencent/APIJSON/pull/493
20+
1821一般对于互联网项目,数据非常重要,基本不会物理删除, <br />
1922只是用 is_deleted 等字段来标记已删除,然后 CRUD 时默认过滤已标记的记录。 <br />
2023这个功能非常必要,可以通过重写 SQLConfig.isFakeDelete() 来标记, <br />
@@ -30,6 +33,8 @@ POST: 用不上,不处理 <br />
3033然后读表自动配置是否为假删除 StringUtil.isNotEmpty(deletedKey, true) ,是假删除时 put 相应键值对。 <br />
3134
3235#### 新增支持 @having &
36+ 20220328 更新:5.0.0 已支持 <br />
37+ https://github.com/Tencent/APIJSON/releases/tag/5.0.0
3338
3439来实现内部条件 AND 连接,原来的 @having 由 AND 连接变为 OR 连接,保持 横或纵与 的统一规则。<br />
3540@having ! 必须性不大,可通过反转内部条件来实现,但如果实现简单、且不影响原来的功能,则可以顺便加上。<br />
@@ -44,8 +49,10 @@ POST: 用不上,不处理 <br />
4449如果有有重合字段,则抛异常,转为错误码和错误信息返回。<br />
4550
4651#### 新增支持 TSQL 的 @explain
52+ 20220809 更新:已支持 Oracle 的 EXPLAIN,感谢 @ifooling 的贡献 <br />
53+ https://github.com/Tencent/APIJSON/pull/434
4754
48- 目前 APIJSON 支持 [ Oracle] ( https://github.com/APIJSON/APIJSON-Demo/tree/master/Oracle ) 和 [ SQL Server] ( https://github.com/APIJSON/APIJSON-Demo/tree/master/SQLServer ) 这两种 TSQL 数据库(群友测试 IBM DB2 也行) 。<br />
55+ 目前 APIJSON 支持 [ Oracle] ( https://github.com/APIJSON/APIJSON-Demo/tree/master/Oracle ) , [ SQL Server] ( https://github.com/APIJSON/APIJSON-Demo/tree/master/SQLServer ) , DB2 这 3 种 TSQL 数据库 。<br />
4956但是 "@explain ": true 使用的是 SET STATISTICS PROFILE ON(具体见 [ AbstractSQLConfig] ( https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java ) 和 [ AbstrctSQLExecutor] ( https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/orm/AbstrctSQLExecutor.java ) ) <br />
5057执行后居然是 SELECT 查到的放在默认的 ResultSet,性能分析放在 moreResult,<br />
5158因为这个问题目前以上两个数据库的性能分析 @explain 实际并不可用,需要改用其它方式或解决现有方式的 bug。<br />
@@ -110,6 +117,8 @@ LIMIT 10 OFFSET 0
110117
111118
112119#### 新增支持 With
120+ 20221126 更新:已支持,感谢 @cloudAndMonkey 的贡献 <br />
121+ https://github.com/Tencent/APIJSON/pull/481
113122
114123可以减少子查询执行次数,提高性能。
115124``` js
@@ -164,52 +173,55 @@ SELECT * FROM `sys`.`Comment` WHERE ( (`userId` IN `sql` ) ) ORDER BY `date` DES
164173暂时还没有想好如何设计。如果是 SQL 原来的写法,则有点繁琐。<br />
165174
166175
167- #### 新增支持 id/userId 与其它字段同时作为增删改条件
168- AbstractVerifier.IS_UPDATE_MUST_HAVE_ID_CONDITION = false
169- 就同时支持 id、其它条件删除
176+ #### 新增支持 id 与其它字段同时作为增删改条件
177+ AbstractVerifier.IS_UPDATE_MUST_HAVE_ID_CONDITION = false < br />
178+ 就同时支持 id、其它条件删除 < br />
170179https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/orm/AbstractVerifier.java#L84-L86
171180
172- 但因为 Operation 没有 AT_LEAST_ONE/ANY_ONE 这样的操作,
173- 所以如果只配置一条规则,只能允许 MUST 配置传一种条件,不能单独 传 id 和 其它字段都行。
174-
175- 如果都传了,因为 id 强制作为 AND 条件,所以不能和其它条件 OR,
176- 可以配置两条不同规则,用不同的 tag 对应使用不同的条件。
177-
178- method: DELETE
179- 通过 id 删除
181+ 但因为 Operation 没有 AT_LEAST_ONE/ANY_ONE 这样的操作, < br />
182+ 所以如果只配置一条规则,只能允许 MUST 配置传一种条件,不能单独传 id/其它字段。 < br />
183+ < br />
184+ 如果都传了,因为 id 强制作为 AND 条件,所以不能和其它条件 OR, < br />
185+ 可以配置两条不同规则,用不同的 tag 对应使用不同的条件。 < br />
186+ < br />
187+ method: DELETE < br />
188+ 通过 id 删除 < br />
180189```
181190tag: Comment-by-id // 当然写成 Comment:id 等其它任何不符合表名格式的名称都可
182191structure: ... "MUST":"id" ...
183192```
184-
185- 通过 date 条件删除
193+ < br />
194+ 通过 date 条件删除 < br />
186195```
187196tag: Comment-by-date
188197structure: ... "MUST":"date" ...
189198```
190-
191- 如果想只配置一条规则,则 Operation 加上 AT_LEAST_ONE/ANY_ONE ,然后配置
199+ < br />
200+ 如果想只配置一条规则,则 Operation 加上 AT_LEAST_ONE/ANY_ONE ,然后配置 < br />
192201```
193202tag: Comment
194203structure: ... "AT_LEAST_ONE":"id,date" ... // 至少传其中一个
195204```
196- 或
205+ 或 < br />
197206```
198207tag: Comment
199208structure: ... "ANY_ONE":"id,date" ... // 必须传其中一个,不能同时传 2 个以上
200209```
201-
202- AT_LEAST_ONE/ANY_ONE 其中一个也可以通过扩展 MUST 来实现(目前看这种方式更好)
203- "MUST":"id | date,其它" 通过 | 或来表示其中任何一个,注意左右一定要各有一个空格,因为可能有 "name|$" "id|{}" 等包含 "|" 的 key
210+ < br />
211+ AT_LEAST_ONE/ANY_ONE 其中一个也可以通过扩展 MUST 来实现(目前看这种方式更好) < br />
212+ "MUST":"id | date,其它" 通过 | 或来表示其中任何一个,注意左右一定要各有一个空格,因为可能有 "name|$" "id|{}" 等包含 "|" 的 key < br />
204213https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/orm/Operation.java
205214
215+ <br />
206216还可以设置更复杂的表达方式
207- "MUST":"1: id | date,其它" // id,date 必须传其中一个,且不能多传
208- "MUST":">=2: id | momentId | date,其它" // id,date 必须至少其中 2 个
209- "MUST":"2+: id | momentId | date,其它" // id,date 必须至少其中 2 个,替代 >= 2
210- "MUST":"2-: id | momentId | date,其它" // id,date 最多传其中 2 个,替代 <= 2
211-
212- 这样的话就不用加 Operation 了,不过 AbstractVerifier 仍然要处理下 REFUSE 和 MUST 的互斥关系
217+ ```
218+ "MUST":"1:id | date,其它" // id, date 必须传其中一个,且不能多传 <br />
219+ "MUST":">=2:id | momentId|{} | date>=,其它" // id, momentId|{}, date>= 必须至少其中 2 个
220+ "MUST":"2+:id | momentId|{} | date>=,其它" // id, momentId|{}, date>= 必须至少其中 2 个,替代 >= 2,更方便解析,并且不用考虑 >1, != 2 等其它各种不等式
221+ "MUST":"2-:id | momentId|{} | date>=,其它" // id, momentId|{}, date>= 最多传其中 2 个,替代 <= 2
222+ ```
223+ <br />
224+ 这样的话就不用加 Operation 了,不过 AbstractVerifier 仍然要处理下 REFUSE 和 MUST 的互斥关系 <br />
213225https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/orm/AbstractVerifier.java#L1012-L1042
214226<img width =" 1117 " alt =" image " src =" https://user-images.githubusercontent.com/5738175/211016885-9e752b6c-94e5-46c0-b87d-a7be68387a9f.png " >
215227
@@ -223,6 +235,9 @@ https://github.com/Tencent/APIJSON/pull/493#issuecomment-1373376359
223235### 强化安全
224236APIJSON 提供了各种安全机制,可在目前的基础上新增或改进。
225237
238+ 20220504 更新:新增插件 apijson-router,可控地对公网暴露类 RESTful 简单接口,内部转成 APIJSON 格式请求来执行。 <br />
239+ https://github.com/APIJSON/apijson-router
240+
226241#### 防越权操作
227242
228243目前有 RBAC 自动化权限管理。<br />
@@ -240,6 +255,7 @@ APIJSONORM 提供 [@MethodAccess](https://github.com/Tencent/APIJSON/blob/master
240255目前有限流机制,getMaxQueryCount, getMaxUpdateCount, getMaxObjectCount, getMaxSQLCount, getMaxQueryDepth 等。 <br />
241256https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/orm/Parser.java <br />
242257
258+
243259#### ... //欢迎补充
244260
245261
@@ -263,6 +279,8 @@ https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/
263279[ 完善功能] ( https://github.com/Tencent/APIJSON/blob/master/Roadmap.md#%E5%AE%8C%E5%96%84%E5%8A%9F%E8%83%BD ) 中 Union 和 With 也是优化 SQL 性能的方式。 <br />
264280
265281#### 读写缓存
282+ 20230105 更新:新增 Redis 缓存 Demo
283+ https://github.com/APIJSON/APIJSON-Demo/commit/060a10e56818b31ab332770815467af9f052c261
266284
267285在 [ AbstractParser] ( https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/orm/AbstractParser.java ) 使用了 HashMap<String, JSONObject> queryResultMap 存已解析的对象、总数等数据。<br />
268286在 [ AbstractSQLExecutor] ( https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/orm/AbstractSQLExecutor.java ) 使用了 HashMap<String, JSONObject> cacheMap 存已通过 SQL 查出的结果集。<br />
@@ -325,8 +343,8 @@ https://github.com/ruoranw/APIJSONdocs <br />
325343### 丰富周边
326344#### 新增或完善各种语言 ORM 库
327345
328- Go, Kotlin, Ruby 等。<br />
329- https://github.com/APIJSON /APIJSON#%E7%94%9F%E6%80%81%E9%A1%B9%E7%9B%AE <br />
346+ Go, Node(js/ts), C#, PHP, Kotlin, Ruby 等。<br />
347+ https://github.com/Tencent /APIJSON#%E7%94%9F%E6%80%81%E9%A1%B9%E7%9B%AE <br />
330348
331349#### 新增或完善 Demo
332350
@@ -336,6 +354,7 @@ Java, C#, PHP, Node, Python 等后端 Demo 及数据。<br />
336354https://github.com/APIJSON/APIJSON-Demo <br />
337355
338356#### 新增扩展
357+ 目前官方有 apijson-column, apijson-router 两个插件
339358
340359##### 1.基于或整合 [ APIJSONORM] ( https://github.com/Tencent/APIJSON/blob/master/APIJSONORM ) 或 [ apijson-framework] ( https://github.com/APIJSON/apijson-framework ) 来实现的库/框架
341360
0 commit comments