腾讯 APIJSON 插件 apijson-mongodb 开源,支持文档数据库 MongoDB
腾讯 APIJSON 是一种专为 API 而生的 JSON 网络传输协议 以及 基于这套协议实现的 ORM 库。
为各种增删改查提供了完全自动化的万能 API,零代码实时满足千变万化的各种新增和变更需求。
能大幅降低开发和沟通成本,简化开发流程,缩短开发周期。适合中小型前后端分离的项目。
自 2016 年开源 7 年来发展迅速,目前 16K+ Star 位居 400W Java 开源项目前 100。
国内 腾讯、华为、阿里巴巴、字节跳动、美团、拼多多、百度、京东、网易、快手、圆通 等 和
国外 Google, Apple, Microsoft, Amazon, Tesla, Meta(FB), Paypal 等数百个知名大厂员工 Star,
也有 腾讯、华为、字节跳动、Microsoft、Zoom、知乎 等 工程师/专家/架构师 提了 PR/Issue,
还被 腾讯、华为、百度、SHEIN、快手、中兴、传音、圆通、美图 等各大知名厂商用于各类项目。
apijson-mongodb ![]()
腾讯 APIJSON 的 MongoDB 数据库插件,可通过 Maven, Gradle 等远程依赖。
添加依赖
1. 在 pom.xml 中添加 JitPack 仓库
<repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> </repositories>
2. 在 pom.xml 中添加 apijson-mongodb 依赖
<dependency> <groupId>com.github.APIJSON</groupId> <artifactId>apijson-mongodb</artifactId> <version>LATEST</version> </dependency>
使用
在你项目继承 AbstractSQLExecutor 的子类重写方法 getValue
Override getValue in your SQLExecutor extends AbstractSQLExecutor
@Override
protected Object getValue(SQLConfig<Long> config, ResultSet rs, ResultSetMetaData rsmd, int tablePosition, JSONObject table, int columnIndex, String lable, Map<String, JSONObject> childMap) throws Exception {
Object v = super.getValue(config, rs, rsmd, tablePosition, table, columnIndex, lable, childMap);
return MongoUtil.getValue(v);
}
有问题可以去 Tencent/APIJSON 提 issue



