0
点赞
收藏
分享

微信扫一扫

开箱即用之MyBatisPlus XML 自定义分页

慕容冲_a4b8 2024-01-18 阅读 11

调用方法

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接口

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

Page<User> queryListByPage(Page<User> page, @Param("condition") User user);

mapper.xml

<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>
举报

相关推荐

0 条评论