提交 6d673ecd 编写于 作者: Z zyyang

change

上级 3ae555de
......@@ -51,7 +51,10 @@
<artifactId>mysql-connector-java</artifactId>
<version>5.1.47</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
......
package com.taosdata.example.mybatisplusdemo.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.taosdata.example.mybatisplusdemo.domain.Weather;
import com.taosdata.example.mybatisplusdemo.mapper.WeatherMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/weathers")
public class WeatherController {
@Autowired
private WeatherMapper mapper;
@GetMapping
public List<Weather> findAll() {
Integer total = mapper.selectCount(null);
final int pageSize = 3;
Page<Weather> page = new Page<>(1, pageSize);
Page<Weather> currentPage = mapper.selectPage(page, null);
System.out.println("total : " + currentPage.getTotal());
System.out.println("pages : " + currentPage.getPages());
System.out.println("countId : " + currentPage.getCountId());
System.out.println("maxLimit: " + currentPage.getMaxLimit());
return currentPage.getRecords();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册