@Test public void testUpdateUser() { User user = userDao.getUserbyID(1); assertNotSame(null, user); logger.debug("old user is "+user); String oldImei = user.getImei(); String newImei = "46022222222222"; assertNotSame(oldImei, newImei); user.setImei(newImei); logger.debug("change user is "+user); logger.debug("update row:"+ userDao.updateUser(user)); user = userDao.getUserbyID(1); assertEquals(newImei, user.getImei()); user.setImei(oldImei); userDao.updateUser(user); logger.debug("recover"+user); }
@Override public int updateUser(User user) { return this.jdbcTemplate .update("update t_user set imei= ?, imsi=?, phone_name=? where user_id=?", user.getImei(), user.getImsi(), user.getPhoneName(), user.getUserId()); }
UserDaoJDBC implements UserDao { @Override public int updateUser(User user) { return this.jdbcTemplate .update("update t_user set imei= ?, imsi=?, phone_name=? where user_id=?", user.getImei(), user.getImsi(), user.getPhoneName(), user.getUserId()); } }
UserDaoJDBC implements UserDao { @Override public int updateUser(User user) { return this.jdbcTemplate .update("update t_user set imei= ?, imsi=?, phone_name=? where user_id=?", user.getImei(), user.getImsi(), user.getPhoneName(), user.getUserId()); } @Autowired  UserDaoJDBC(DataSource datasource); }
UserDaoJDBC implements UserDao { @Override public int updateUser(User user) { return this.jdbcTemplate .update("update t_user set imei= ?, imsi=?, phone_name=? where user_id=?", user.getImei(), user.getImsi(), user.getPhoneName(), user.getUserId()); } @Autowired  UserDaoJDBC(DataSource datasource); @Override int getUserCount(); @Override User getUserbyID(int id); @Override List<User> getUsers(); @Override User addUser(final User user); @Override int updateUser(User user); }
UserDaoJDBC implements UserDao { @Override public int updateUser(User user) { return this.jdbcTemplate .update("update t_user set imei= ?, imsi=?, phone_name=? where user_id=?", user.getImei(), user.getImsi(), user.getPhoneName(), user.getUserId()); } @Autowired  UserDaoJDBC(DataSource datasource); @Override int getUserCount(); @Override User getUserbyID(int id); @Override List<User> getUsers(); @Override User addUser(final User user); @Override int updateUser(User user);  }