您的位置:首页 > 其它

mybatis 的逆向工程单表用法

2018-03-15 23:20 225 查看
Tbcategory   tb=new Tbcategory ();
   Criteria   criteria= tb.createCriteria()
criteria.andparentidEqualto(parentid);
List<tb>   tbs=criteria.selectbyexample(criteria);
select  * from  tb  where parentid =parentid;
              TbItemExample example = new TbItemExample();
//在查询之前,必须先设置分页
PageHelper.startPage(page, rows);
//执行查询,自动分页查询,自动生成limit,count

List<TbItem> list = tbItemMapper.selectByExample(example);
                //select  * from tb  limit 1,10
//创建PageINfo对象,封装分页数据       有参构造
PageInfo<TbItem> pageInfo = new PageInfo<TbItem>(list);
//创建分页返回值包装类对象
PageBeanResult result=new PageBeanResult();
result.setTotal(pageInfo.getTotal());
result.setRows(list);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mybatis