Mybatis Plus中的selectCount的使用

常用的方法一般是在mapper.xml中写一个

写一个select块来调用查询。

在mybatis plus中有集成好的selectCount的方法。

Integer selectCount(@Param("ew") Wrapper queryWrapper);

使用方式如下:

@Override
public int selectCount(String userCode) {
   // int sCount =sysLawCaseProjectUserMapper.selectCountt(userCode);
    QueryWrapper query = new QueryWrapper<>();
    query.eq("user_code",userCode);
     //直接通过以上的两句代码实现条件查询计数,之后调用集成好的selectCount就ok了。
   int sCount = sysLawCaseProjectUserMapper.selectCount(query);
    return sCount;
}

 以这个例子为例,其他的方法也存在很多可以这样使用的。

Mybatis Plus中的selectCount的使用_第1张图片

 

 例如以上。 只是部分例子。详细参考官方文档。

坚持!  慢慢的会更好。

你可能感兴趣的:(java,java)