mybatisplus----CRUD操作之查询操作
@Test
//根据id查询单个结果
void testSelect1() {
User user = userMapper.selectById(1L);
System.out.println(user);
}
@Test
//根据多个id查询多个结果
void testSelect2() {
List<User> users = userMapper.selectBatchIds(Arrays.asList(1L, 2L, 3L));
users.forEach(System.out::println);
}
@Test
//map条件查询
void testSelect3() {
HashMap<String, Object> map = new HashMap<String,Object>();
map.put("name", "瓜瓜");
map.put("age",3);
List<User> users = userMapper.selectByMap(map);
users.forEach(System.out::println);
}
迎风少年