多个查询和条件查询

多个查询:

1
2
List<User> users = userMapper.selectBatchIds (Arrays.asList (1, 2, 3));
users.forEach (System.out::println);

条件查询:

1
2
3
4
5
HashMap<String, Object> map = new HashMap<> ();
map.put ("version",1);
for (User user : userMapper.selectByMap (map)) {
System.out.println (user);
}

使用map传递你想要使用的条件进行查询

分页查询:

1
2
3
4
@Bean
public PaginationInterceptor getPaginationInterceptor () {
return new PaginationInterceptor ();
}

测试代码:

1
2
3
4
Page<User> Page = new Page<> (2,4);
userMapper.selectPage (Page,null);
System.out.println (Page.getTotal ());
Page.getRecords ().forEach (System.out::println);