siquan-wen / springboot-demo-crud Goto Github PK
View Code? Open in Web Editor NEWSpringBoot2.X整合MyBatis-Plus实现图书管理系统的增删改查
SpringBoot2.X整合MyBatis-Plus实现图书管理系统的增删改查
@GetMapping("{currentPage}/{pageSize}")
public Result getPage(@PathVariable int currentPage,@PathVariable int pageSize,Book book){
IPage<Book> page = bookService.getPage(currentPage, pageSize,book);
//如果当前页码值大于总页码数,那么重新执行查询操作,使用最大页码值作为当前页码值。
if (currentPage > page.getPages()){
page = bookService.getPage((int)page.getPages(),pageSize);
}
return new Result(true,bookService.getPage(currentPage,pageSize,book));
}
如果是按条件查询,删除字段后当前页码大于总页码,返回的page还是错误的,应该把 if 语句中的 page 返回,要不然条件语句就是摆设。
@GetMapping("{currentPage}/{pageSize}")
public Result getPage(@PathVariable int currentPage,@PathVariable int pageSize,Book book){
IPage<Book> page = bookService.getPage(currentPage, pageSize,book);
if (currentPage > page.getPages()){
page = bookService.getPage((int)page.getPages(),pageSize,book); //删除后返回的page把条件带上(增加了book条件)
}
return new Result(true,page); //这里返回处理过的page
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.