首页 > 其他 > 详细

mybatis 按照条件查询

时间:2018-03-18 16:06:01      阅读:215      评论:0      收藏:0      [点我收藏+]

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 按照条件查询

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!