当前使用版本(必填,否则不予处理)
版本:mybatis-plus-boot-starter,version: 3.4.2
该问题是如何引起的?(确定最新版也有问题再提!!!)
- 问题:由于分页Page 对象使用时需要指定泛型并且每次使用都需要new,因此对Page对象做工具类封装,出现泛型指定问题
- 建议:能否将泛型修改为 在new时传入具体对象的Class对象
重现步骤(如果有就写完整)
封装实例:
(该方法就无法指定T 的具体对象了)
public static
报错信息
Comment From: nishimoguima
public static
Comment From: a852203465
我知道可以这么写, 但是“clazz”是没法传给Page 对象的,因为你们的设计是Page
@.***
发件人: 唐绎 发送时间: 2021-05-15 20:14 收件人: baomidou/mybatis-plus 抄送: a852203465; Author 主题: Re: [baomidou/mybatis-plus] 分页泛型指定问题 (#3502) public static Page basicPage(Long page, Long size,Class clazz) { page = (page == null || page < 0) ? 1 : page; size = (size == null || size <= 0) ? 20 : size; Page pageHelper = new Page(page, size, Boolean.TRUE); return pageHelper; } 你好,可以尝试这样写哦 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Comment From: nishimoguima