Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
5349141d
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看板
提交
5349141d
编写于
11月 16, 2020
作者:
Z
zyyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change
上级
ae95667b
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
53 addition
and
67 deletion
+53
-67
tests/examples/JDBC/mybatisplus-demo/pom.xml
tests/examples/JDBC/mybatisplus-demo/pom.xml
+1
-18
tests/examples/JDBC/mybatisplus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/config/MybatisPlusConfig.java
...ata/example/mybatisplusdemo/config/MybatisPlusConfig.java
+14
-11
tests/examples/JDBC/mybatisplus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/controller/WeatherController.java
...example/mybatisplusdemo/controller/WeatherController.java
+8
-4
tests/examples/JDBC/mybatisplus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/mapper/WeatherMapper.java
...aosdata/example/mybatisplusdemo/mapper/WeatherMapper.java
+1
-0
tests/examples/JDBC/mybatisplus-demo/src/main/resources/application-dev.yml
...C/mybatisplus-demo/src/main/resources/application-dev.yml
+0
-8
tests/examples/JDBC/mybatisplus-demo/src/main/resources/application-prod.yml
.../mybatisplus-demo/src/main/resources/application-prod.yml
+0
-22
tests/examples/JDBC/mybatisplus-demo/src/main/resources/application.yml
.../JDBC/mybatisplus-demo/src/main/resources/application.yml
+21
-2
tests/examples/JDBC/mybatisplus-demo/src/test/java/com/taosdata/example/mybatisplusdemo/mapper/WeatherMapperTest.java
...ata/example/mybatisplusdemo/mapper/WeatherMapperTest.java
+8
-2
未找到文件。
tests/examples/JDBC/mybatisplus-demo/pom.xml
浏览文件 @
5349141d
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
<dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
3.
4.1
</version>
<version>
3.
1.2
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.h2database
</groupId>
<groupId>
com.h2database
</groupId>
...
@@ -97,22 +97,5 @@
...
@@ -97,22 +97,5 @@
</plugins>
</plugins>
</build>
</build>
<profiles>
<profile>
<id>
dev
</id>
<properties>
<spring.profiles.active>
dev
</spring.profiles.active>
</properties>
</profile>
<profile>
<id>
prod
</id>
<properties>
<spring.profiles.active>
prod
</spring.profiles.active>
</properties>
<activation>
<activeByDefault>
true
</activeByDefault>
</activation>
</profile>
</profiles>
</project>
</project>
tests/examples/JDBC/mybatisplus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/config/MybatisPlusConfig.java
浏览文件 @
5349141d
package
com.taosdata.example.mybatisplusdemo.config
;
package
com.taosdata.example.mybatisplusdemo.config
;
import
com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer
;
import
com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
@Configuration
public
class
MybatisPlusConfig
{
public
class
MybatisPlusConfig
{
@Bean
// @Bean
public
MybatisPlusInterceptor
mybatisPlusInterceptor
()
{
// public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor
interceptor
=
new
MybatisPlusInterceptor
();
// MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor
.
addInnerInterceptor
(
new
PaginationInnerInterceptor
());
// interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
return
interceptor
;
// return interceptor;
}
// }
// @Bean
// public ConfigurationCustomizer configurationCustomizer() {
// return configuration -> configuration.setUseDeprecatedExecutor(false);
// }
@Bean
@Bean
public
ConfigurationCustomizer
configurationCustomize
r
()
{
public
PaginationInterceptor
paginationIntercepto
r
()
{
return
configuration
->
configuration
.
setUseDeprecatedExecutor
(
false
);
return
new
PaginationInterceptor
(
);
}
}
}
}
tests/examples/JDBC/mybatisplus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/controller/WeatherController.java
浏览文件 @
5349141d
package
com.taosdata.example.mybatisplusdemo.controller
;
package
com.taosdata.example.mybatisplusdemo.controller
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.taosdata.example.mybatisplusdemo.domain.Weather
;
import
com.taosdata.example.mybatisplusdemo.domain.Weather
;
import
com.taosdata.example.mybatisplusdemo.mapper.WeatherMapper
;
import
com.taosdata.example.mybatisplusdemo.mapper.WeatherMapper
;
...
@@ -21,12 +22,15 @@ public class WeatherController {
...
@@ -21,12 +22,15 @@ public class WeatherController {
public
List
<
Weather
>
findAll
()
{
public
List
<
Weather
>
findAll
()
{
Integer
total
=
mapper
.
selectCount
(
null
);
Integer
total
=
mapper
.
selectCount
(
null
);
final
int
pageSize
=
3
;
final
int
pageSize
=
3
;
Page
<
Weather
>
page
=
new
Page
<>(
1
,
pageSize
);
IPage
<
Weather
>
page
=
new
Page
<>(
1
,
pageSize
);
Page
<
Weather
>
currentPage
=
mapper
.
selectPage
(
page
,
null
);
IPage
<
Weather
>
currentPage
=
mapper
.
selectPage
(
page
,
null
);
System
.
out
.
println
(
"total : "
+
currentPage
.
getTotal
());
System
.
out
.
println
(
"total : "
+
currentPage
.
getTotal
());
System
.
out
.
println
(
"pages : "
+
currentPage
.
getPages
());
System
.
out
.
println
(
"pages : "
+
currentPage
.
getPages
());
System
.
out
.
println
(
"countId : "
+
currentPage
.
getCountId
());
System
.
out
.
println
(
"maxLimit: "
+
currentPage
.
getMaxLimit
());
// System.out.println("countId : " + currentPage.getCountId());
// System.out.println("maxLimit: " + currentPage.getMaxLimit());
return
currentPage
.
getRecords
();
return
currentPage
.
getRecords
();
}
}
...
...
tests/examples/JDBC/mybatisplus-demo/src/main/java/com/taosdata/example/mybatisplusdemo/mapper/WeatherMapper.java
浏览文件 @
5349141d
...
@@ -2,6 +2,7 @@ package com.taosdata.example.mybatisplusdemo.mapper;
...
@@ -2,6 +2,7 @@ package com.taosdata.example.mybatisplusdemo.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.taosdata.example.mybatisplusdemo.domain.Weather
;
import
com.taosdata.example.mybatisplusdemo.domain.Weather
;
public
interface
WeatherMapper
extends
BaseMapper
<
Weather
>
{
public
interface
WeatherMapper
extends
BaseMapper
<
Weather
>
{
...
...
tests/examples/JDBC/mybatisplus-demo/src/main/resources/application-dev.yml
已删除
100644 → 0
浏览文件 @
ae95667b
spring
:
datasource
:
driver-class-name
:
org.h2.Driver
schema
:
classpath:db/schema-taos.sql
data
:
classpath:db/data-taos.sql
url
:
jdbc:h2:mem:test
user
:
root
password
:
test
\ No newline at end of file
tests/examples/JDBC/mybatisplus-demo/src/main/resources/application-prod.yml
已删除
100644 → 0
浏览文件 @
ae95667b
spring
:
datasource
:
# driver-class-name: com.taosdata.jdbc.TSDBDriver
# url: jdbc:TAOS://localhost:6030/mp_test
# user: root
# password: taosdata
# charset: UTF-8
# locale: en_US.UTF-8
# timezone: UTC-8
driver-class-name
:
com.mysql.jdbc.Driver
url
:
jdbc:mysql://master:3306/test?useSSL=false
username
:
root
password
:
123456
logging
:
level
:
com
:
taosdata
:
example
:
mybatisplusdemo
:
mapper
:
debug
tests/examples/JDBC/mybatisplus-demo/src/main/resources/application.yml
浏览文件 @
5349141d
spring
:
spring
:
profiles
:
datasource
:
active
:
"
@spring.profiles.active@"
# driver-class-name: com.taosdata.jdbc.TSDBDriver
\ No newline at end of file
# url: jdbc:TAOS://localhost:6030/mp_test
# user: root
# password: taosdata
# charset: UTF-8
# locale: en_US.UTF-8
# timezone: UTC-8
driver-class-name
:
com.mysql.jdbc.Driver
url
:
jdbc:mysql://master:3306/test?useSSL=false
username
:
root
password
:
123456
logging
:
level
:
com
:
taosdata
:
example
:
mybatisplusdemo
:
mapper
:
debug
tests/examples/JDBC/mybatisplus-demo/src/test/java/com/taosdata/example/mybatisplusdemo/mapper/WeatherMapperTest.java
浏览文件 @
5349141d
package
com.taosdata.example.mybatisplusdemo.mapper
;
package
com.taosdata.example.mybatisplusdemo.mapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.taosdata.example.mybatisplusdemo.domain.Weather
;
import
com.taosdata.example.mybatisplusdemo.domain.Weather
;
import
org.junit.Assert
;
import
org.junit.Assert
;
...
@@ -77,8 +78,13 @@ public class WeatherMapperTest {
...
@@ -77,8 +78,13 @@ public class WeatherMapperTest {
@Test
@Test
public
void
testSelectPage
()
{
public
void
testSelectPage
()
{
Page
<
Weather
>
page
=
new
Page
<>(
1
,
2
);
// Page<Weather> page = new Page<>(1, 2);
Page
<
Weather
>
weatherPage
=
mapper
.
selectPage
(
page
,
null
);
IPage
page
=
new
Page
(
1
,
2
);
IPage
<
Weather
>
weatherPage
=
mapper
.
selectPage
(
page
,
null
);
// Page<Weather> weatherPage = mapper.selectPage(page, null);
System
.
out
.
println
(
"total : "
+
weatherPage
.
getTotal
());
System
.
out
.
println
(
"total : "
+
weatherPage
.
getTotal
());
System
.
out
.
println
(
"pages : "
+
weatherPage
.
getPages
());
System
.
out
.
println
(
"pages : "
+
weatherPage
.
getPages
());
for
(
Weather
weather
:
weatherPage
.
getRecords
())
{
for
(
Weather
weather
:
weatherPage
.
getRecords
())
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录