Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
7ffbb655
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7ffbb655
编写于
3月 05, 2021
作者:
Z
zyyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modified the springboot demo
上级
83ba94b6
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
27 addition
and
19 deletion
+27
-19
tests/examples/JDBC/springbootdemo/pom.xml
tests/examples/JDBC/springbootdemo/pom.xml
+2
-0
tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/SpringbootdemoApplication.java
...ata/example/springbootdemo/SpringbootdemoApplication.java
+1
-1
tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/controller/WeatherController.java
.../example/springbootdemo/controller/WeatherController.java
+1
-1
tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.java
...om/taosdata/example/springbootdemo/dao/WeatherMapper.java
+1
-1
tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.xml
...com/taosdata/example/springbootdemo/dao/WeatherMapper.xml
+9
-3
tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/domain/Weather.java
...a/com/taosdata/example/springbootdemo/domain/Weather.java
+4
-4
tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/service/WeatherService.java
...osdata/example/springbootdemo/service/WeatherService.java
+1
-1
tests/examples/JDBC/springbootdemo/src/main/resources/application.properties
.../springbootdemo/src/main/resources/application.properties
+8
-8
未找到文件。
tests/examples/JDBC/springbootdemo/pom.xml
浏览文件 @
7ffbb655
...
...
@@ -64,6 +64,8 @@
<groupId>
com.taosdata.jdbc
</groupId>
<artifactId>
taos-jdbcdriver
</artifactId>
<version>
2.0.20
</version>
<!-- <scope>system</scope>-->
<!-- <systemPath>${project.basedir}/src/main/resources/taos-jdbcdriver-2.0.20-dist.jar</systemPath>-->
</dependency>
<dependency>
...
...
tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/SpringbootdemoApplication.java
浏览文件 @
7ffbb655
...
...
@@ -10,4 +10,4 @@ public class SpringbootdemoApplication {
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
SpringbootdemoApplication
.
class
,
args
);
}
}
}
\ No newline at end of file
tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/controller/WeatherController.java
浏览文件 @
7ffbb655
...
...
@@ -60,7 +60,7 @@ public class WeatherController {
}
@GetMapping
(
"/avg"
)
public
Map
avg
()
{
public
List
<
Weather
>
avg
()
{
return
weatherService
.
avg
();
}
...
...
tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.java
浏览文件 @
7ffbb655
...
...
@@ -24,6 +24,6 @@ public interface WeatherMapper {
List
<
String
>
getSubTables
();
Map
avg
();
List
<
Weather
>
avg
();
}
tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/dao/WeatherMapper.xml
浏览文件 @
7ffbb655
...
...
@@ -5,7 +5,7 @@
<resultMap
id=
"BaseResultMap"
type=
"com.taosdata.example.springbootdemo.domain.Weather"
>
<id
column=
"ts"
jdbcType=
"TIMESTAMP"
property=
"ts"
/>
<result
column=
"temperature"
jdbcType=
"
INTEGER
"
property=
"temperature"
/>
<result
column=
"temperature"
jdbcType=
"
FLOAT
"
property=
"temperature"
/>
<result
column=
"humidity"
jdbcType=
"FLOAT"
property=
"humidity"
/>
</resultMap>
...
...
@@ -18,7 +18,7 @@
</update>
<update
id=
"createSuperTable"
>
create table if not exists test.weather(ts timestamp, temperature float, humidity
in
t) tags(location nchar(64), groupId int)
create table if not exists test.weather(ts timestamp, temperature float, humidity
floa
t) tags(location nchar(64), groupId int)
</update>
<update
id=
"createTable"
parameterType=
"com.taosdata.example.springbootdemo.domain.Weather"
>
...
...
@@ -47,7 +47,13 @@
select count(*) from test.weather
</select>
<select
id=
"avg"
resultType=
"map"
>
<resultMap
id=
"avgResultSet"
type=
"com.taosdata.example.springbootdemo.domain.Weather"
>
<id
column=
"ts"
jdbcType=
"TIMESTAMP"
property=
"ts"
/>
<result
column=
"avg(temperature)"
jdbcType=
"FLOAT"
property=
"temperature"
/>
<result
column=
"avg(humidity)"
jdbcType=
"FLOAT"
property=
"humidity"
/>
</resultMap>
<select
id=
"avg"
resultMap=
"avgResultSet"
>
select avg(temperature), avg(humidity)from test.weather interval(1m)
</select>
...
...
tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/domain/Weather.java
浏览文件 @
7ffbb655
...
...
@@ -9,14 +9,14 @@ public class Weather {
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss.SSS"
,
timezone
=
"GMT+8"
)
private
Timestamp
ts
;
private
float
temperature
;
private
in
t
humidity
;
private
floa
t
humidity
;
private
String
location
;
private
int
groupId
;
public
Weather
()
{
}
public
Weather
(
Timestamp
ts
,
float
temperature
,
in
t
humidity
)
{
public
Weather
(
Timestamp
ts
,
float
temperature
,
floa
t
humidity
)
{
this
.
ts
=
ts
;
this
.
temperature
=
temperature
;
this
.
humidity
=
humidity
;
...
...
@@ -38,11 +38,11 @@ public class Weather {
this
.
temperature
=
temperature
;
}
public
in
t
getHumidity
()
{
public
floa
t
getHumidity
()
{
return
humidity
;
}
public
void
setHumidity
(
in
t
humidity
)
{
public
void
setHumidity
(
floa
t
humidity
)
{
this
.
humidity
=
humidity
;
}
...
...
tests/examples/JDBC/springbootdemo/src/main/java/com/taosdata/example/springbootdemo/service/WeatherService.java
浏览文件 @
7ffbb655
...
...
@@ -55,7 +55,7 @@ public class WeatherService {
return
weatherMapper
.
getSubTables
();
}
public
Map
avg
()
{
public
List
<
Weather
>
avg
()
{
return
weatherMapper
.
avg
();
}
}
tests/examples/JDBC/springbootdemo/src/main/resources/application.properties
浏览文件 @
7ffbb655
# datasource config - JDBC-JNI
spring.datasource.driver-class-name
=
com.taosdata.jdbc.TSDBDriver
spring.datasource.url
=
jdbc:TAOS://127.0.0.1:6030/test?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8
spring.datasource.username
=
root
spring.datasource.password
=
taosdata
# datasource config - JDBC-RESTful
#spring.datasource.driver-class-name=com.taosdata.jdbc.rs.RestfulDriver
#spring.datasource.url=jdbc:TAOS-RS://master:6041/test?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8
#spring.datasource.driver-class-name=com.taosdata.jdbc.TSDBDriver
#spring.datasource.url=jdbc:TAOS://127.0.0.1:6030/test?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8
#spring.datasource.username=root
#spring.datasource.password=taosdata
# datasource config - JDBC-RESTful
spring.datasource.driver-class-name
=
com.taosdata.jdbc.rs.RestfulDriver
spring.datasource.url
=
jdbc:TAOS-RS://master:6041/test?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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录