Example #1
0
 /**
  * 扩展查询,用于获取已修读学分
  * @author FuRongxin
  * @date    2016-01-23
  * @version 2.0
  * @param   \Illuminate\Database\Eloquent\Builder $query 查询对象
  * @param   object $user 用户对象
  * @return  \Illuminate\Database\Eloquent\Builder 查询对象
  */
 public function scopeStudiedCredits($query, $user)
 {
     return $query->whereXh($user->xh)->groupBy('pt', 'kcxz')->selectRaw('pt, kcxz, SUM(xf) AS xf');
 }
Example #2
0
 /**
  * 扩展查询,用于查找学生是否是全日制本科新生
  * @author FuRongxin
  * @date    2016-02-22
  * @version 2.0
  * @param   \Illuminate\Database\Eloquent\Builder $query 查询对象
  * @param   object $user 用户对象
  * @return  \Illuminate\Database\Eloquent\Builder 查询对象
  */
 public function scopeIsFresh($query, $user)
 {
     return $query->whereXh($user->xh)->whereXjzt(config('constants.school.student'))->whereRaw('age(CURRENT_DATE, date_trunc(\'month\', rxrq)) < \'1 year\'')->where('xz', '<>', '2');
 }
Example #3
0
 /**
  * 扩展查询,用于获取学生综合成绩对应的补考成绩
  * @author FuRongxin
  * @date    2016-01-26
  * @version 2.0
  * @param   \Illuminate\Database\Eloquent\Builder $query 查询对象
  * @param   object $user 用户对象
  * @param   string $kch 8位课程号
  * @return  \Illuminate\Database\Eloquent\Builder 查询对象
  */
 public function scopeMakeupScore($query, $user, $kch)
 {
     $lstKcxh = Task::whereKch($kch)->distinct('kcxh')->lists('kcxh');
     // 提交状态为3的成绩方可显示
     return $query->whereXh($user->xh)->whereIn('kcxh', $lstKcxh)->whereTjzt(config('constants.score.dconfirmed'));
 }
Example #4
0
 /**
  * 扩展查询,获取已修读课程列表
  * @author FuRongxin
  * @date    2016-03-10
  * @version 2.0
  * @param   \Illuminate\Database\Eloquent\Builder $query 查询对象
  * @param   object $user 用户对象
  * @return  \Illuminate\Database\Eloquent\Builder 查询对象
  */
 public function scopeStudied($query, $user)
 {
     return $query->whereXh($user->xh)->whereNotExists(function ($query) {
         $query->from('xk_xkxx AS a')->whereNd(session('year'))->whereXq(session('term'))->whereRaw('t_a.xh = t_xk_xkxx.xh AND t_a.kcxh = t_xk_xkxx.kcxh');
     });
 }