示例#1
0
 @Override
 public Long insert(User user) {
   return jdbcTemplate.queryForObject(
       "INSERT INTO users (role, username, password)" + " VALUES (?,?,?) returning id",
       new Object[] {user.getRole().name(), user.getUsername(), user.getPassword()},
       new IdMapper());
 }
示例#2
0
 @Override
 public void update(User user) {
   jdbcTemplate.update(
       "UPDATE users " + "SET role=?, username=?, password=?" + " WHERE id=?",
       user.getRole().name(),
       user.getUsername(),
       user.getPassword(),
       user.getId());
 }