最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

mybatis-plus返回查詢總記錄數(shù)方式

 更新時間:2022年01月15日 11:49:29   作者:java1234_小鋒  
這篇文章主要介紹了mybatis-plus返回查詢總記錄數(shù)方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教

mybatis-plus返回查詢總記錄數(shù)

mp框架提供了selectCount方法,來查詢總記錄數(shù);

需求:

查找薪水大于3500 名字里有“小”的 員工的個數(shù)

sql實現(xiàn):

select count(*) from t_employee where salary>3500 and name like ‘%小%'

代碼實現(xiàn):

@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);
}

mybatis-plus分頁查詢,總條數(shù)為零的解決

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;
? ? }
}

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

喜德县| 寿阳县| 西峡县| 禄劝| 襄垣县| 莎车县| 前郭尔| 环江| 威信县| 故城县| 拜城县| 勐海县| 英德市| 海安县| 渝中区| 渝中区| 思茅市| 福贡县| 策勒县| 梁河县| 洛隆县| 南阳市| 伊吾县| 咸丰县| 乾安县| 娄烦县| 肃宁县| 镇赉县| 曲松县| 高密市| 赤峰市| 文水县| 天全县| 黄山市| 开鲁县| 施甸县| 禹州市| 北票市| 辽阳县| 胶州市| 鸡泽县|