Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
85bbf1a4
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看板
提交
85bbf1a4
编写于
11月 16, 2020
作者:
Z
zyyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change and test
上级
4e461ac2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
6 deletion
+31
-6
tests/examples/JDBC/mybatisplus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/config/MybatisPlusConfig.java
...ata/example/mybatisplusdemo/config/MybatisPlusConfig.java
+2
-2
tests/examples/JDBC/mybatisplus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/mapper/TemperatureMapper.java
...ata/example/mybatisplusdemo/mapper/TemperatureMapper.java
+2
-1
tests/examples/JDBC/mybatisplus-demo/src/main/resources/application.yml
.../JDBC/mybatisplus-demo/src/main/resources/application.yml
+4
-0
tests/examples/JDBC/mybatisplus-demo/src/test/java/com/taosdata/example/mybatisplusdemo/mapper/TemperatureMapperTest.java
...example/mybatisplusdemo/mapper/TemperatureMapperTest.java
+23
-3
未找到文件。
tests/examples/JDBC/mybatisplus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/config/MybatisPlusConfig.java
浏览文件 @
85bbf1a4
...
...
@@ -25,8 +25,8 @@ public class MybatisPlusConfig {
public
PaginationInterceptor
paginationInterceptor
()
{
// return new PaginationInterceptor();
PaginationInterceptor
paginationInterceptor
=
new
PaginationInterceptor
();
//TODO: mybatis-plus do not support TDengine, use
my
sql Dialect
paginationInterceptor
.
setDialectType
(
"
my
sql"
);
//TODO: mybatis-plus do not support TDengine, use
postgre
sql Dialect
paginationInterceptor
.
setDialectType
(
"
postgre
sql"
);
return
paginationInterceptor
;
}
...
...
tests/examples/JDBC/mybatisplus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/mapper/TemperatureMapper.java
浏览文件 @
85bbf1a4
...
...
@@ -17,6 +17,7 @@ public interface TemperatureMapper extends BaseMapper<Temperature> {
@Update
(
"drop table if exists temperature"
)
void
dropSuperTable
();
@Insert
(
"insert into t${tbIndex}(ts, temperature) values(
ts, temperature
)"
)
@Insert
(
"insert into t${tbIndex}(ts, temperature) values(
#{ts}, #{temperature}
)"
)
int
insertOne
(
Temperature
one
);
}
tests/examples/JDBC/mybatisplus-demo/src/main/resources/application.yml
浏览文件 @
85bbf1a4
...
...
@@ -20,6 +20,10 @@ spring:
locale
:
en_US.UTF-8
timezone
:
UTC-8
mybatis-plus
:
configuration
:
map-underscore-to-camel-case
:
false
logging
:
level
:
com
:
...
...
tests/examples/JDBC/mybatisplus-demo/src/test/java/com/taosdata/example/mybatisplusdemo/mapper/TemperatureMapperTest.java
浏览文件 @
85bbf1a4
...
...
@@ -33,7 +33,7 @@ public class TemperatureMapperTest {
mapper
.
createSuperTable
();
// create table t_X using temperature
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
mapper
.
createTable
(
"t
_
"
+
i
,
locations
[
random
.
nextInt
(
locations
.
length
)],
i
);
mapper
.
createTable
(
"t"
+
i
,
locations
[
random
.
nextInt
(
locations
.
length
)],
i
);
}
// insert into table
int
affectRows
=
0
;
...
...
@@ -60,12 +60,18 @@ public class TemperatureMapperTest {
@Autowired
private
TemperatureMapper
mapper
;
/***
* test SelectList
* **/
@Test
public
void
testSelectList
()
{
List
<
Temperature
>
temperatureList
=
mapper
.
selectList
(
null
);
temperatureList
.
forEach
(
System
.
out
::
println
);
}
/***
* test InsertOne which is a custom metheod
* ***/
@Test
public
void
testInsert
()
{
Temperature
one
=
new
Temperature
();
...
...
@@ -76,16 +82,21 @@ public class TemperatureMapperTest {
Assert
.
assertEquals
(
1
,
affectRows
);
}
/***
* test SelectOne
* **/
@Test
public
void
testSelectOne
()
{
QueryWrapper
<
Temperature
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"location"
,
"beijing"
);
Temperature
one
=
mapper
.
selectOne
(
wrapper
);
System
.
out
.
println
(
one
);
Assert
.
assertEquals
(
12.22f
,
one
.
getTemperature
(),
0.00f
);
Assert
.
assertEquals
(
"beijing"
,
one
.
getLocation
());
Assert
.
assertNotNull
(
one
);
}
/***
* test select By map
* ***/
@Test
public
void
testSelectByMap
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
...
@@ -94,18 +105,27 @@ public class TemperatureMapperTest {
Assert
.
assertEquals
(
1
,
temperatures
.
size
());
}
/***
* test selectObjs
* **/
@Test
public
void
testSelectObjs
()
{
List
<
Object
>
ts
=
mapper
.
selectObjs
(
null
);
System
.
out
.
println
(
ts
);
}
/**
* test selectC ount
* **/
@Test
public
void
testSelectCount
()
{
int
count
=
mapper
.
selectCount
(
null
);
Assert
.
assertEquals
(
5
,
count
);
}
/****
* 分页
*/
@Test
public
void
testSelectPage
()
{
IPage
page
=
new
Page
(
1
,
2
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录