您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
这篇“mybatis-plus返回查询总记录数的方法是什么”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“mybatis-plus返回查询总记录数的方法是什么”文章吧。
mp框架提供了selectCount方法,来查询总记录数;
需求:
查找薪水大于3500 名字里有“小”的 员工的个数
sql实现:
select count(*) from t_employee where salary>3500 and name like ‘%小%'
代码实现:
@Test
public void selectCountByQueryWrapper11(){
QueryWrapper<Employee> queryWrapper=new QueryWrapper();
// QueryWrapper<Employee> queryWrapper2=Wrappers.<Employee>query();
queryWrapper.gt("salary",3500).like("name","小");
Integer count = employeeMapper.selectCount(queryWrapper);
System.out.println(count);
}package com.integration.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@MapperScan("com.integration.mapper")
public class MybatisPlusConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor page = new PaginationInterceptor();
return page;
}
}以上就是关于“mybatis-plus返回查询总记录数的方法是什么”这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注亿速云行业资讯频道。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。