Tencent / APIJSON

🏆 实时 零代码、全功能、强安全 ORM 库 🚀 后端接口和文档零代码,前端(客户端) 定制返回 JSON 的数据和结构 🏆 Real-Time coding-free, powerful and secure ORM 🚀 providing APIs and Docs without coding by Backend, and the returned JSON of API can be customized by Frontend(Client) users
http://apijson.cn
Other
17.14k stars 2.15k forks source link

一个json 处理同一个表的增删改无效 #760

Open zxcwindy opened 1 week ago

zxcwindy commented 1 week ago

Description

APIJSON版本:7.0.3

有一个业务需要,需要同时对一个表进行增删改操作。 这种不带别名的方式可以 1

带别名的方式,尝试了几个方式都不可以。

2

3

4

其他方式如: { "MutiTest:new[]": { "@method":"POST", "MutiTest[]":[ {"name":"1","value":"1"}] } }

也尝试过,也是异常。

为了简化测试,只用了一个带别名的数组,正常业务流程还需要另外2个数组进行put和delete操作

TommyLemon commented 1 week ago
  1. @post 等指定请求方式的 key 对应 value:{ childKey: { "tag": tag, "version": version ... } } 中,所有 childKey 都必须在 @post 同一层,且为 childKey:{} 格式; tag,version 等值必须和 Request 表里的同名字段严格一一对应。为了方便记忆减少出错,建议 childKey 和 tag 都统一用一个名称,最好也不取别名

  2. "@post": { childKey: { "version": version ... } } 省略 tag,表示直接用 childKey 作为 tag,还可以进一步省略成 "@post": childKey ,多个则用逗号隔开 "@post": "childKey1,childKey2..."

  3. 目前一次请求中同一类操作方法对应多个不同 childKey(这种场景极少),可能有 bug,可以 Access 表为同一张数据库表添加不同的 APIJSON 表名来绕过,或者断点调试找出问题代码再解决