@Test public void testInsert0() { UserDO user = new UserDO().setUsername(UUID.randomUUID().toString()) .setPassword("nicai").setCreateTime(new Date()); userDao.insert0(user); System.out.println(user); }
public int insert0(UserDO entity) { SimpleJdbcInsert insertOp = new SimpleJdbcInsert(template); insertOp.setTableName("users"); insertOp.setColumnNames(Arrays.asList("username", "password", "create_time")); insertOp.setGeneratedKeyName("id"); Map<String, Object> params = new HashMap<>(); params.put("username", entity.getUsername()); params.put("password", entity.getPassword()); params.put("create_time", entity.getCreateTime()); Number id = insertOp.executeAndReturnKey(params); entity.setId(id.intValue()); return 1; }
UserDao { public int insert0(UserDO entity) { SimpleJdbcInsert insertOp = new SimpleJdbcInsert(template); insertOp.setTableName("users"); insertOp.setColumnNames(Arrays.asList("username", "password", "create_time")); insertOp.setGeneratedKeyName("id"); Map<String, Object> params = new HashMap<>(); params.put("username", entity.getUsername()); params.put("password", entity.getPassword()); params.put("create_time", entity.getCreateTime()); Number id = insertOp.executeAndReturnKey(params); entity.setId(id.intValue()); return 1; } }
UserDao { public int insert0(UserDO entity) { SimpleJdbcInsert insertOp = new SimpleJdbcInsert(template); insertOp.setTableName("users"); insertOp.setColumnNames(Arrays.asList("username", "password", "create_time")); insertOp.setGeneratedKeyName("id"); Map<String, Object> params = new HashMap<>(); params.put("username", entity.getUsername()); params.put("password", entity.getPassword()); params.put("create_time", entity.getCreateTime()); Number id = insertOp.executeAndReturnKey(params); entity.setId(id.intValue()); return 1; }  }
UserDao { public int insert0(UserDO entity) { SimpleJdbcInsert insertOp = new SimpleJdbcInsert(template); insertOp.setTableName("users"); insertOp.setColumnNames(Arrays.asList("username", "password", "create_time")); insertOp.setGeneratedKeyName("id"); Map<String, Object> params = new HashMap<>(); params.put("username", entity.getUsername()); params.put("password", entity.getPassword()); params.put("create_time", entity.getCreateTime()); Number id = insertOp.executeAndReturnKey(params); entity.setId(id.intValue()); return 1; }  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 insert0(UserDO entity) { SimpleJdbcInsert insertOp = new SimpleJdbcInsert(template); insertOp.setTableName("users"); insertOp.setColumnNames(Arrays.asList("username", "password", "create_time")); insertOp.setGeneratedKeyName("id"); Map<String, Object> params = new HashMap<>(); params.put("username", entity.getUsername()); params.put("password", entity.getPassword()); params.put("create_time", entity.getCreateTime()); Number id = insertOp.executeAndReturnKey(params); entity.setId(id.intValue()); return 1; }  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);  }