# springboot-tdengine-demo
**Repository Path**: Jing_jun_yang/springboot-tdengine-demo
## Basic Information
- **Project Name**: springboot-tdengine-demo
- **Description**: springboot-tdengine-demo
- **Primary Language**: Java
- **License**: Not specified
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 9
- **Created**: 2023-01-31
- **Last Updated**: 2023-01-31
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# 项目简介
* springboot-tdengine-demo-mongodb: springboot集成mongodb示例
* springboot-tdengine-demo-multi-datasource: springboot + MyBatis多数据源示例MySql+TDengine
* springboot-tdengine-demo-multi-datasource-mybatis-plus: springboot + MyBatis示例-plus + dynamic-datasource多数据源示例MySql+TDengine
* springboot-tdengine-demo-mybatis: springboot集成TDengine + MyBatis示例
* springboot-tdengine-demo-mybatis-plus: springboot集成TDengine + MyBatis-Plus示例
## TDengine SpringBoot + Mybatis Demo
### 配置 application.properties
```properties
# datasource config - JDBC-RESTful
spring.datasource.driver-class-name=com.taosdata.jdbc.rs.RestfulDriver
spring.datasource.url=jdbc:TAOS-RS://你的IP地址:6041/demo?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8
spring.datasource.username=root
spring.datasource.password=taosdata
spring.datasource.druid.initial-size=5
spring.datasource.druid.min-idle=5
spring.datasource.druid.max-active=5
spring.datasource.druid.max-wait=30000
spring.datasource.druid.validation-query=select server_status();
#mybatis
#mybatis.mapper-locations=classpath:mapper/*.xml
logging.level.com.taosdata.example.springbootdemo.dao=debug
server.port=8081
```
### 主要功能
* 创建数据库和表
```xml
create database if not exists test;
create table if not exists test.weather(ts timestamp, temperature int, humidity float);
```
* 插入单条记录
```xml
insert into test.weather (ts, temperature, humidity) values (now, #{temperature,jdbcType=INTEGER}, #{humidity,jdbcType=FLOAT})
```
* 插入多条记录
```xml
insert into test.weather (ts, temperature, humidity) values
(now + #{index}a, #{weather.temperature}, #{weather.humidity})
```
* 分页查询
```xml
ts, temperature, humidity
```