Example #1
0
 @Override
 public int updateUser(User user) {
   String sql =
       "UPDATE ypj_user SET type=?,wxuid=?,nickname=?,headimgurl=?,updatetime=now() WHERE id=?";
   Object[] params = {
     user.getType(), user.getWxuid(), user.getNickname(), user.getHeadimgurl(), user.getId()
   };
   return jdbcTemplate.update(sql, params);
 }
Example #2
0
 @Override
 public User findUserByWxuid(long wxuid) {
   String sql = "SELECT * FROM ypj_user WHERE wxuid=?";
   Object[] params = {wxuid};
   List<User> list = jdbcTemplate.query(sql, params, userRowMapper);
   if (list.size() > 0) {
     return list.get(0);
   }
   User user = new User();
   user.setWxuid(wxuid);
   return user;
 }
Example #3
0
 @Override
 public User mapRow(ResultSet rs, int index) throws SQLException {
   User u = new User();
   u.setId(rs.getLong("id"));
   u.setType(rs.getInt("type"));
   u.setUsername(rs.getString("username"));
   u.setPassword(rs.getString("password"));
   u.setWxuid(rs.getLong("wxuid"));
   u.setNickname(rs.getString("nickname"));
   u.setHeadimgurl(rs.getString("headimgurl"));
   u.setCreatetime(rs.getTimestamp("createtime"));
   u.setUpdatetime(rs.getTimestamp("updatetime"));
   return u;
 }