调用方法
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>