@Mapper
public interface UserMapper {
int insert(User record);
User selectByPrimaryKey(Integer id);}
第五步:测试
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApplicationTests {
@Autowired
UserMapper userMapper;
User user;
@Test
public void insert(){
user = new User();
user.setUsername("uname");
user.setPassword("123456");
int row = userMapper.insert(user);
System.out.println("此次成功插入了"+row+"条数据!!");}
@Test
public void selectByPrimaryKey(){
User user = userMapper.selectByPrimaryKey(1);
System.out.println(user);}}