-
Notifications
You must be signed in to change notification settings - Fork 2.2k
apijson 支持sql语句模版, 传递参数, 执行sql语句 #510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@raw 实现相同功能, 等空了,我整理测试用例, 如果raw支持, router方式优先级降低 |
{
"[]": {
"Moment": {
"@column": "date;left(date,10):day;sum(if(userId%2=0,1,0))",
"@group": "day",
"@having": "to_days(now())-to_days(`date`)<=7",
"@raw": "@column,@having"
}
}
} 方式二: RAW_MAP.put("siteListWhereItem1","`Opm_site_list`.`seq` < `to`.`seq`"); "sql@": {
"from": "Opm_site_list",
"join": "&/Opm_site_list:to/opm_line_id@",
"Opm_site_list": {
"@column": "opm_line_id",
"opm_site_id": 1, //出发站点id
"@raw": "siteListWhereItem1"
},
"Opm_site_list:to": {
"opm_line_id@": "/Opm_site_list/opm_line_id",
"@column": "",
"opm_site_id": 2 //到达站点id
}
} |
@TommyLemon 模版router 配置使用请参见: https://github.com/APIJSON/apijson-router Document表字段sqlauto配置sql模版SELECT * FROM Document表字段apijson配置请求json模版{
"@datasource": "master",
"paramName": ["name","state","page","count"],
"tag": "RawUserList",
"rawData()": "rawSQL(paramName)",
"removeKeys+()": "removeKeys(paramName)"
} Function表配置 远程函数 rawData()Request表配置router url客户端发起request请求{
"name": "test1",
"state": 0,
"page":0,
"count":4
} |
方式一是目前唯一可用 @raw 的,不过也必须提前在 RAW_MAP 中配置允许的 SQL 片段。 方式二 "@raw": "siteListWhereItem1" 在最近比较新的版本都不可用,@raw 原始 SQL 片段功能是 @zhoulingfengofcd 新增的: 他分享的这篇文章提到了 @raw 的使用:APIJSON复杂业务深入实践(类似12306订票系统) 不过我改成了值里面的所有 key 必须为当前 JSON 对象的 key,可以更加灵活地支撑各种相关需求。 |
@cloudAndMonkey |
@TommyLemon 谢谢, 链接过期了,重新发一下嘛 😄 |
嗯嗯,我来测一下 |
@cloudAndMonkey |
@TommyLemon |
Description
apijson-router Document表 autosql字段

SQLAuto-智能零代码自动化测试 SQL 语句执行结果的数据库工具,任意增删改查、任意 SQL 模板变量、一键批量生成参数组合、快速构造大量测试数据。
https://github.com/TommyLemon/SQLAuto
目的:
sql模版 实现相关统计查询
The text was updated successfully, but these errors were encountered: