赞
踩
1.maven
- <dependency>
- <groupId>com.github.pagehelper</groupId>
- <artifactId>pagehelper</artifactId>
- <version>4.1.3</version>
- </dependency>
2.在启动类里进行配置
- @Bean
- PageHelper pageHelper(){
- //分页插件
- PageHelper pageHelper = new PageHelper();
- Properties properties = new Properties();
- properties.setProperty("reasonable", "true");
- properties.setProperty("supportMethodsArguments", "true");
- properties.setProperty("returnPageInfo", "check");
- properties.setProperty("params", "count=countSql");
- pageHelper.setProperties(properties);
-
- //添加插件
- new SqlSessionFactoryBean().setPlugins(new Interceptor[]{pageHelper});
- return pageHelper;
- }
3.好了后就可以直接使用了
- @ApiOperation("条件查询库存")
- @PostMapping("/conditionQueryStock")
- public R conditionQueryStock(@RequestBody ConditionProStock conditionProStock) {
- PageHelper.startPage(conditionProStock.getCurrent(),conditionProStock.getSize());
-
- List<ProStock> proStocks = proStockService.conditionQueryStock(conditionProStock);
- PageInfo<ProStock> proStockPageInfo = new PageInfo<>(proStocks);
- return R.addSuccess(proStockPageInfo);
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。