abel533 / Mybatis-Spring

这是一个集成了Mybatis分页插件和通用Mapper的示例项目
943 stars 610 forks source link

pagehelper + tk.mapper #32

Closed KsAlone closed 6 years ago

KsAlone commented 6 years ago

pagehelper 和 tk.mapper一起使用时,我想分页,然后根据实体类里面的某些参数进行条件查询(有的条件是相等,有些条件是like),所以我使用了example查询,但是报错【There is no getter for property named 'distinct' in 'class tk.mybatis.mapper.entity.Example$Criteria'】

KsAlone commented 6 years ago

我的代码 Example example = new Example(CmsTarget.class); Example.Criteria criteria = example.createCriteria(); criteria.andEqualTo(cmsTarget); criteria.andLike("cmsTargetName", "%" + cmsTarget.getCmsTargetName() + "%"); PageHelper.startPage(1, 10); Page list = (Page) cmsTargetMapper.selectByExample(criteria); PageInfo pageInfo = new PageInfo(list);