| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 | <?php/** * Created by PhpStorm. * User: wuzhenke * Date: 2019/1/25 * Time: 17:54 */namespace App\Repositories\Jobfair;use App\Models\Jobfair\JobfairPersonSigned;use App\Models\MemberInfo;use Prettus\Repository\Eloquent\BaseRepository;use Illuminate\Support\Facades\DB;class JobfairPersonSignedRepository extends BaseRepository{    public function model()    {        return JobfairPersonSigned::class;    }    public function getSignedInterview($where)    {        return $this->model->with(['resumes'])->whereHas('resumes')->where($where)->orderBy("created_at", 'desc')->paginate(10);    }    public function createInfo($data)    {        return $this->model->create($data);    }    public function getJobfairVisitorNum($where)    {        return $this->model->where($where)->count();    }    public function getStatisticsPersonList($where, $whereIn, $groupBy)    {        $res = $this->model->selectRaw('uid, sex,idcard,jobfairid')->where($where);        if ($whereIn) {            foreach ($whereIn as $k => $v) {                $res->whereIn($k, $v);            }        }        if ($groupBy) {            foreach ($groupBy as $k => $v) {                $res->groupBy($v);            }        }        return $res->orderBy('sex', 'asc')->get();    }    public function getStatisticsPersonEducations($type, $where, $whereIn, $groupBy, $fields, $order_by = '')    {        $s_join_field = $type;        $m_join_field = $type;        if ($type == 'uid') {            $m_join_field = 'uid';        } elseif ($type == 'idcard') {            $m_join_field = 'id_card';        }        $rst = DB::table(JobfairPersonSigned::getTableName().' as s')->select(DB::raw($fields))            ->leftjoin(MemberInfo::getTableName().' as m', 'm.'.$m_join_field, '=', 's.'.$s_join_field)            ->where($where);        if ($whereIn) {            foreach ($whereIn as $k => $v) {                $rst->whereIn($k, $v);            }        }        if ($groupBy) {            foreach ($groupBy as $k => $v) {                $rst->groupBy($v);            }        }        if ($order_by) {            $rst->orderByRaw($order_by);        }        return $rst->get();    }    //获取猜你喜欢    public function likeResumes($where,$jobfair_id)    {        return $this->model->whereHas('resumes',function($query) use ($where){            $query->where($where);        })->where('jobfairid',$jobfair_id)->get();    }}
 |