@Override public boolean save(String type, Long open_id, Long uid) { if (StringKit.isNotBlank(type) && null != open_id && null != uid) { try { Long count = AR.find( "select count(1) from t_openid where open_id = ? and type = ? and uid = ?", open_id, type, uid) .first(Long.class); if (count == 0) { AR.update( "insert into t_openid(type, open_id, uid, create_time) values(?, ?, ?, ?)", type, open_id, uid, DateKit.getCurrentUnixTime()) .executeUpdate(); } return true; } catch (Exception e) { e.printStackTrace(); } } return false; }
@Override public Openid getOpenid(String type, Long open_id) { if (null == open_id || StringKit.isBlank(type)) { return null; } return AR.find("select * from t_openid where open_id = ? and type = ?", open_id, type) .first(Openid.class); }