1.根据id进行查询
/**
* 根据id查询
*/
@Test
void testSelectById(){
User user = userMapper.selectById(1L);
System.out.println(user);
}
2.id批量查询
/**
* 根据多个id查询
*/
@Test
void testSelectByIds(){
List<User> users = userMapper.selectBatchIds(Arrays.asList(1, 2, 3));
users.forEach(System.out::println);
}
3. 简单的条件查询
/**
* 简单的条件查询
*/
@Test
void testSelectByWarper(){
HashMap<String, Object> map = new HashMap<>();
map.put("name", "赵六");
map.put("age", 18);
List<User> users = userMapper.selectByMap(map);
users.forEach(System.out::println);
}