|
| 1 | +# apijson-iotdb [](https://jitpack.io/#APIJSON/apijson-iotdb) |
| 2 | +腾讯 [APIJSON](https://github.com/Tencent/APIJSON) 7.0.3+ 的 IoTDB 数据库插件,可通过 Maven, Gradle 等远程依赖。<br /> |
| 3 | +An IoTDB plugin for Tencent [APIJSON](https://github.com/Tencent/APIJSON) 7.0.3+ |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | +## 添加依赖 |
| 9 | +## Add Dependency |
| 10 | + |
| 11 | +### Maven |
| 12 | +#### 1. 在 pom.xml 中添加 JitPack 仓库 |
| 13 | +#### 1. Add the JitPack repository to pom.xml |
| 14 | +```xml |
| 15 | + <repositories> |
| 16 | + <repository> |
| 17 | + <id>jitpack.io</id> |
| 18 | + <url>https://jitpack.io</url> |
| 19 | + </repository> |
| 20 | + </repositories> |
| 21 | +``` |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +<br /> |
| 26 | + |
| 27 | +#### 2. 在 pom.xml 中添加 apijson-iotdb 依赖 |
| 28 | +#### 2. Add the apijson-iotdb dependency to pom.xml |
| 29 | +```xml |
| 30 | + <dependency> |
| 31 | + <groupId>com.github.APIJSON</groupId> |
| 32 | + <artifactId>apijson-iotdb</artifactId> |
| 33 | + <version>LATEST</version> |
| 34 | + </dependency> |
| 35 | +``` |
| 36 | + |
| 37 | +<br /> |
| 38 | + |
| 39 | +https://github.com/APIJSON/APIJSON-Demo/blob/master/APIJSON-Java-Server/APIJSONBoot-MultiDataSource/pom.xml |
| 40 | + |
| 41 | +<br /> |
| 42 | +<br /> |
| 43 | + |
| 44 | +### Gradle |
| 45 | +#### 1. 在项目根目录 build.gradle 中最后添加 JitPack 仓库 |
| 46 | +#### 1. Add the JitPack repository in your root build.gradle at the end of repositories |
| 47 | +```gradle |
| 48 | + allprojects { |
| 49 | + repositories { |
| 50 | + maven { url 'https://jitpack.io' } |
| 51 | + } |
| 52 | + } |
| 53 | +``` |
| 54 | +<br /> |
| 55 | + |
| 56 | +#### 2. 在项目某个 module 目录(例如 `app`) build.gradle 中添加 apijson-iotdb 依赖 |
| 57 | +#### 2. Add the apijson-iotdb dependency in one of your modules(such as `app`) |
| 58 | +```gradle |
| 59 | + dependencies { |
| 60 | + implementation 'com.github.APIJSON:apijson-iotdb:latest' |
| 61 | + } |
| 62 | +``` |
| 63 | + |
| 64 | +<br /> |
| 65 | +<br /> |
| 66 | +<br /> |
| 67 | + |
| 68 | +## 使用 |
| 69 | +## Usage |
| 70 | + |
| 71 | +在你项目继承 AbstractSQLExecutor 的子类重写方法 execute <br/> |
| 72 | +Override execute in your SQLExecutor extends AbstractSQLExecutor |
| 73 | + |
| 74 | +```java |
| 75 | + @Override |
| 76 | + public JSONObject execute(@NotNull SQLConfig<Long> config, boolean unknownType) throws Exception { |
| 77 | + if (config.isIoTDB()) { |
| 78 | + return InfluxdbUtil.execute(config, null, unknownType); |
| 79 | + } |
| 80 | + |
| 81 | + return super.execute(config, unknownType); |
| 82 | + } |
| 83 | +``` |
| 84 | + |
| 85 | +<br/> |
| 86 | +在你项目继承 AbstractSQLConfig 的子类重写方法 execute <br/> |
| 87 | +Override execute in your SQLConfig extends AbstractSQLConfig |
| 88 | + |
| 89 | +```java |
| 90 | + @Override |
| 91 | + public String getTablePath() { |
| 92 | + return IoTDBUtil.getTablePath(super.getTablePath(), isIoTDB()); |
| 93 | + } |
| 94 | +``` |
| 95 | + |
| 96 | +#### 见 [IoTDBUtil](/src/main/java/apijson/iotdb/IoTDBUtil.java) 的注释及 [APIJSONBoot-MultiDataSource](https://github.com/APIJSON/APIJSON-Demo/blob/master/APIJSON-Java-Server/APIJSONBoot-MultiDataSource) 的 [DemoSQLExecutor](https://github.com/APIJSON/APIJSON-Demo/blob/master/APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/java/apijson/demo/DemoSQLExecutor.java) <br /> |
| 97 | + |
| 98 | +#### See document in [IoTDBUtil](/src/main/java/apijson/iotdb/IoTDBUtil.java) and [DemoSQLExecutor](https://github.com/APIJSON/APIJSON-Demo/blob/master/APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/java/apijson/demo/DemoSQLExecutor.java) in [APIJSONBoot-MultiDataSource](https://github.com/APIJSON/APIJSON-Demo/blob/master/APIJSON-Java-Server/APIJSONBoot-MultiDataSource) |
| 99 | + |
| 100 | +<br /> |
| 101 | +<br /> |
| 102 | +<br /> |
| 103 | + |
| 104 | +有问题可以去 Tencent/APIJSON 提 issue <br /> |
| 105 | +https://github.com/Tencent/APIJSON/issues/36 |
| 106 | + |
| 107 | +<br /><br /> |
| 108 | + |
| 109 | +#### 点右上角 ⭐Star 支持一下,谢谢 ^_^ |
| 110 | +#### Please ⭐Star this project ^_^ |
| 111 | +https://github.com/APIJSON/apijson-iotdb |
0 commit comments