コード例 #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());
  }
コード例 #3
0
 public User getUserById(int id) {
   return userMapper.selectByPrimaryKey(id);
 }