可视化工具地址
https://gitee.com/muxuezhiying/TDengineGUI.git
taos //登录数据库
SELECT * FROM sensor.t1;//查询数据(库.表)
单独集成
<dependency>
<groupId>com.taosdata.jdbc</groupId>
<artifactId>taos-jdbcdriver</artifactId>
<version>2.0.36</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.0.6</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.18</version>
</dependency>
spring:
datasource:
driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
url: jdbc:TAOS-RS://xxx:6041/sensor?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8
username: root
password: taosdata
druid:
initial-size: 5
min-idle: 5
max-active: 5
max-wait: 30000
validation-query: select server_status();
使用:
<select id="selectList" parameterType="KitHistoryReq" resultMap="equipmentMap">
select time, pressure, temperature, level
FROM ${name}
<where>
<if test="startDate!=null"> and time >= #{startDate} </if>
<if test="endDate!=null"> and time <= #{endDate} </if>
</where>
order by time desc
</select>
多数据源中
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>3.5.0</version>
</dependency>
spring:
# 配置数据源信息
datasource:
dynamic:
# 设置默认的数据源或者数据源组,默认值即为master
primary: master
# 严格匹配数据源,默认false.true未匹配到指定数据源时抛异常,false使用默认数据源
strict: false
datasource:
master:
url: jdbc:mysql://xxx:3306/edgex_server?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: root
edgexData:
driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
url: jdbc:TAOS-RS://xxx:6041?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8
username: root
password: taosdata
分页可以直接使用
PageHelper.startPage(1,1);
@DS("edgexData")
@Mapper
public interface SysEdgexDataMapper {
List<Map> queryList(SysDataCenterVo sysDataCenterVo);
}
<select id="queryList" parameterType="SysDataCenterVo" resultType="java.util.Map">
select *
from ${dataName}.${tableName}
<where>
<if test="startTime!=null"> and time >= #{startTime} </if>
<if test="endTime!=null"> and time <= #{endTime} </if>
</where>
</select>