码迷,mamicode.com
首页 > 其他好文 > 详细

mybatis 按照条件查询

时间:2018-03-18 16:17:34      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:post   get   set   private   gets   bsp   return   autowire   font   

mybatis 按照条件查询

@Autowired
private StudentMapper studentMapper;

@Override
public Map getStudentList(int page, int rows,long studentId) {

    // 设置分页信息
    PageHelper.startPage(page, rows);
    // 执行查询
    StudentExample example = new StudentExample();
    Criteria criteria = example.createCriteria();
    //根据学生 id 查询
    criteria.andStudentIdEqualTo(studentId);
//执行查询 List
<Student> list = studentMapper.selectByExample(example);
// 取分页信息 PageInfo<TbContent> info = new PageInfo<>(list); Map map= new HashMap(); map.setRows(list); map.setTotal(info.getTotal()); return map; }

 

mybatis 按照条件查询

标签:post   get   set   private   gets   bsp   return   autowire   font   

原文地址:https://www.cnblogs.com/fangwu/p/8595368.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!