private void fillCspUserInfo(ResultSet rs, CspUserInfoPo po) throws SQLException { po.setId(rs.getInt("id")); po.setAccept_apps(rs.getString("accept_apps")); po.setMail(rs.getString("mail")); po.setPermission_desc(rs.getString("permission_desc")); po.setPhone(rs.getString("phone")); po.setPhone_feature(rs.getString("phone_feature")); po.setWangwang(rs.getString("wangwang")); po.setWangwang_feature(rs.getString("wangwang_feature")); }
/** * 通过邮件信息获取用户 * * @author xiaodu * @param email * @return TODO */ public CspUserInfoPo findCspUserInfoByMail(String email) { final CspUserInfoPo po = new CspUserInfoPo(); String sql = "select * from csp_user_info where mail = ?"; try { this.query( sql, new Object[] {email}, new SqlCallBack() { @Override public void readerRows(ResultSet rs) throws Exception { fillCspUserInfo(rs, po); } }); } catch (Exception e) { logger.info(e); return null; } return po.getMail() == null ? null : po; }
public boolean updateCspUserInfo(final CspUserInfoPo po) { String sql = "UPDATE csp_user_info SET " + " `phone` = ? , `wangwang` = ? , `phone_feature` = ? ," + " `wangwang_feature` = ? , `permission_desc` = ? , `accept_apps` = ? WHERE `mail` = ? "; try { this.execute( sql, new Object[] { po.getPhone(), po.getWangwang(), po.getPhone_feature(), po.getWangwang_feature(), po.getPermission_desc(), po.getAccept_apps(), po.getMail() }); } catch (Exception e) { logger.info(e); return false; } return true; }
public boolean insertCspUserInfo(CspUserInfoPo po) { String sql = "insert into csp_user_info(phone,wangwang,mail,phone_feature,wangwang_feature,permission_desc,accept_apps) values(?,?,?,?,?,?,?)"; try { this.execute( sql, new Object[] { po.getPhone(), po.getWangwang(), po.getMail(), po.getPhone_feature(), po.getWangwang_feature(), po.getPermission_desc(), po.getAccept_apps() }); } catch (SQLException e) { logger.info(e); return false; } return true; }