mybatis 按照條件查詢
阿新 • • 發佈:2018-03-18
hashmap err post gets new app ets inf col
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 按照條件查詢