예제 #1
0
 @Test
 public void testUpdateByPrimaryKey() {
   User record = userMapper.selectByPrimaryKey(104L);
   record.setFirstName("firstName-updated");
   record.setLastName("lastName-updated");
   int updateByPrimaryKey = userMapper.updateByPrimaryKey(record);
   assertEquals(1, updateByPrimaryKey);
 }
예제 #2
0
  @Test
  public void testSelectByPrimaryKey() {
    User selectByPrimaryKey = userMapper.selectByPrimaryKey(Long.valueOf(102));
    assertNotNull(selectByPrimaryKey);

    assertEquals("first_name_102", selectByPrimaryKey.getFirstName());
    assertEquals("last_name_102", selectByPrimaryKey.getLastName());
  }
 public User getUserById(int id) {
   return userMapper.selectByPrimaryKey(id);
 }