SFAMapper
@Mapper
public interface SFAMapper extends BaseMapper<SFA>{
IPage<SFA> pageRepaying(IPage<SFA> page,@Param("id") long id);
}
SFAMapper.xml中
<select id="pageRepaying" resultMap="BaseResultMap">
select * from SFA where id=#{id} group by id order by create_time
</select>
mybatisplus自定义sql手写分页时,注意:
1.mapper中返回值使用Ipage或page接收
2.mapper中Ipage或page作为参数绑定,参数绑定必须在第一个参数,否则不会分页查询
3.mybatisplus会做代理查询sql中不用加limit分页函数,mybatis会查2次,一次查总条数,一次添加上limit按分页查数据