1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- class BusinessStudentTargetUniversity extends BusinessActiveRecord
- {
- public static function model($className = __CLASS__){
- return parent::model($className);
- }
- public function tableName(){
- return "student_target_university";
- }
- public function getStudentTargetList($schoolId,$gradeName,$className,$studentName,$page=1,$pageLimit=15)
- {
- $offset=($page-1)*$pageLimit;
- $pages=array();
- $condition = '';
- if($gradeName){
- $condition .= " and grade_name like '%$gradeName%'";
- }
- if($className){
- $condition .= " and class_name like '%$className%'";
- }
- if($studentName){
- $condition.= " and student_name like '%$studentName%'";
- }
- $totalQuery=$this->getDbConnection()->createCommand("select count(*) as count from student_target_university where status=1 and school_id={$schoolId}".$condition)->queryRow();
- $pages['total']=$totalQuery['count'];
- $pages['totalPage']=ceil($totalQuery['count']/$pageLimit);
- $pages['page']=$page;
- $data = $this->getDbConnection()->createCommand("
- select *
- from student_target_university
- where school_id={$schoolId} and status=1 {$condition}
- order by create_time desc
- limit {$offset},{$pageLimit}
-
- ")->queryAll();
- $return['pages']=$pages;
- $return['dataList']=$data;
- return $return;
- }
- }
|