@Test public void testInsert() { UserDO user = new UserDO().setUsername(UUID.randomUUID().toString()) .setPassword("nicai").setCreateTime(new Date()); userDao.insert(user); System.out.println(user); }
public int insert(UserDO entity) { KeyHolder keyHolder = new GeneratedKeyHolder(); int updateCounts = template.update(INSERT_PREPARED_STATEMENT_CREATOR_FACTORY.newPreparedStatementCreator( Arrays.asList(entity.getUsername(), entity.getPassword(), entity.getCreateTime()) ), keyHolder); if (keyHolder.getKey() != null) { entity.setId(keyHolder.getKey().intValue()); } return updateCounts; }
UserDao { public int insert(UserDO entity) { KeyHolder keyHolder = new GeneratedKeyHolder(); int updateCounts = template.update(INSERT_PREPARED_STATEMENT_CREATOR_FACTORY.newPreparedStatementCreator( Arrays.asList(entity.getUsername(), entity.getPassword(), entity.getCreateTime()) ), keyHolder); if (keyHolder.getKey() != null) { entity.setId(keyHolder.getKey().intValue()); } return updateCounts; } }
UserDao { public int insert(UserDO entity) { KeyHolder keyHolder = new GeneratedKeyHolder(); int updateCounts = template.update(INSERT_PREPARED_STATEMENT_CREATOR_FACTORY.newPreparedStatementCreator( Arrays.asList(entity.getUsername(), entity.getPassword(), entity.getCreateTime()) ), keyHolder); if (keyHolder.getKey() != null) { entity.setId(keyHolder.getKey().intValue()); } return updateCounts; }  }
UserDao { public int insert(UserDO entity) { KeyHolder keyHolder = new GeneratedKeyHolder(); int updateCounts = template.update(INSERT_PREPARED_STATEMENT_CREATOR_FACTORY.newPreparedStatementCreator( Arrays.asList(entity.getUsername(), entity.getPassword(), entity.getCreateTime()) ), keyHolder); if (keyHolder.getKey() != null) { entity.setId(keyHolder.getKey().intValue()); } return updateCounts; }  int insert(UserDO entity); int insert0(UserDO entity); int updateById(UserDO entity); int deleteById(Integer id); UserDO selectById(Integer id); UserDO selectByUsername(String username); List<UserDO> selectByIds(List<Integer> ids); }
UserDao { public int insert(UserDO entity) { KeyHolder keyHolder = new GeneratedKeyHolder(); int updateCounts = template.update(INSERT_PREPARED_STATEMENT_CREATOR_FACTORY.newPreparedStatementCreator( Arrays.asList(entity.getUsername(), entity.getPassword(), entity.getCreateTime()) ), keyHolder); if (keyHolder.getKey() != null) { entity.setId(keyHolder.getKey().intValue()); } return updateCounts; }  int insert(UserDO entity); int insert0(UserDO entity); int updateById(UserDO entity); int deleteById(Integer id); UserDO selectById(Integer id); UserDO selectByUsername(String username); List<UserDO> selectByIds(List<Integer> ids);  }