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

[ORACLE] 子查询内部默认添加分页语句,导致in函数无法实现,提示Error Msg = ORA-00913: 值过多的报错 #683

Closed ostrichManX closed 7 months ago

ostrichManX commented 7 months ago

Description

apijson写法:

"[]": {
    "count":3,
    'T_EVENT_MAIN': {
        "@schema": "ZHSQ",
        "EVENT_ID{}@": {
            "from": "WF_HI_TASK",
            "WF_HI_TASK": {
                "@schema": "CDA_FLOW",
                "@column": "BUSINESS_KEY",
            }
        },
    },
},

这是根据官网的模板去掉多余参数,写的子查询apijson语句,mysql的查询语句只有简单的子查询语句,但是oracle的查询语句也会强制加上分页语句,这样就会导致id无法获取到子查询内部对应的字段,进而报错,无法使用。 mysql问题

oracle问题

我想问一下,这个怎么处理,是否存在开关或者配置,关闭子查询中的默认分页操作?

TommyLemon commented 7 months ago

像 getLimitString 一样在 getOraclePageSql 前拦截处理,不拼接分页 SQL 片段

        if (count <= 0 || RequestMethod.isHeadMethod(getMethod(), true)) { // TODO HEAD 真的不需要 LIMIT ?
            return sql;
        }

https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java#L4546-L4549

https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java#L4584-L4595

https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java#L2634-L2636

ostrichManX commented 7 months ago

问题解决,代码已提交 https://github.com/Tencent/APIJSON/pull/684