调用方法
java
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
public Page<User> queryListByPage(User user)
{
Page<User> page = new Page<>(1, 12);
return userMapper.queryListByPage(page, user);
}
mapper接口
java
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
Page<User> queryListByPage(Page<User> page, @Param("condition") User user);
mapper.xml
java
<select id="queryListByPage" parameterType="user" resultType="user">
select * from user
<where>
<if test="condition.name != null">
name = #{condition.name}
order by create_time desc
</select>