addCondition("student_id IN (". implode(',', $studentIds) .")"); $result = getAttributes($this->findAll($criteria)); } return $result; } public function getStudentNames($studentIds) { $result = array(); $students = $this->getStudents($studentIds); if ($students) { foreach ($students AS $student) { $id_str = ''; if($student['id_number']){ $id_str = substr($student['id_number'],-4,4); } $result[$student['student_id']] = $student['realname'].$id_str; } } return $result; } //分页获取学生数据 public function getStudentsByPages(){ $result = array(); $sql = "select count(0) as count from student_info"; $connect = $this->getDbConnection(); $countArr = $connect->createCommand($sql)->queryRow(); if($countArr && $countArr['count']){ $count = $countArr['count']; $limit = 10000; $page = ceil($count/$limit); $_sql = "select * from student_info"; for($a = 1;$a <= $page;$a++){ $offset = ($a - 1)*$limit; $_sqls = $_sql." limit {$offset},{$limit}"; $data = $connect->createCommand($_sqls)->queryAll(); foreach($data as $k=>$v){ $result['school_student_info'][$v['student_id']] = $v; $result['school_student_names'][$v['student_id']] = $v['realname']; } unset($data); } } return $result; } public function getStudentLevelList($grade,$classId,$studentName,$semesterId, $page=1,$pageLimit=15) { $offset=($page-1)*$pageLimit; $pages=array(); $condition = ''; $condition.= "and c.semester_id = '$semesterId'"; if($grade){ $condition .= "and c.grade = $grade"; } if($classId){ $condition .= " and r.class_id ='{$classId}'"; } if($studentName){ $condition.= " and i.realname like '%$studentName%'"; } $totalQuery=$this->getDbConnection()->createCommand("select COUNT(DISTINCT r.student_id) as `count` from student_class_relation r INNER JOIN class c on r.class_id=c.class_id INNER JOIN student_info i on i.student_id=r.student_id WHERE r.`status`=0 ".$condition)->queryRow(); $pages['total']=$totalQuery['count']; $pages['totalPage']=ceil($totalQuery['count']/$pageLimit); $pages['page']=$page; $data = $this->getDbConnection()->createCommand(" select r.student_id,c.class_id,c.class_name,c.grade,i.realname,i.english_level_one,i.english_level_artificial from student_class_relation r INNER JOIN class c on r.class_id=c.class_id INNER JOIN student_info i on i.student_id=r.student_id WHERE r.`status`=0 {$condition} group by r.student_id limit {$offset},{$pageLimit} ")->queryAll(); $return['pages']=$pages; $return['dataList']=$data; return $return; } }