此方法从数据库返回一些记录。
def wall_record(ref_id,followers_record,pid,sd_pid)
@Wp_rec=Wallpost.select('Wp.id as Pid,Wp.*,Wi.id as Iid,Wi.imagename,Wv.videourl,U.firstname,U.username')
@Wp_rec=@Wp_rec.where('Wp.id > ? ', pid) if pid.present? # pid->PostId
@Wp_rec=@Wp_rec.where('Wp.id < ? ', sd_pid) if sd_pid.present? # sd_pid -> Scroll down
@Wp_rec=@Wp_rec.where('Wp.posted_by IN (?) ', followers_record) if followers_record.present?
@Wp_rec=@Wp_rec.joins('Wp INNER JOIN `epoker_wallimages` as Wi on Wi.wallpost_id = Wp.id')
@Wp_rec=@Wp_rec.joins('INNER JOIN `epoker_users` as U on U.id = Wp.user_id')
@Wp_rec=@Wp_rec.joins('INNER JOIN `epoker_wallvideos` as Wv on Wv.wallpost_id = Wp.id')
@Wp_rec=@Wp_rec.order('Wp.id DESC') if followers_record.present?
@Wp_rec=@Wp_rec.limit(5) #if followers_record.present?
end
现在我想添加mysql查询->where((Wp.posted_by != 100000 AND post_status = 1) OR (Wp.posted_by = 10000 AND post_status in (1,2)))
请问我该怎么做?