1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- /**
- * 黑名单管理模型类
- * @author li
- * @date 2020-04-09 19:30:00
- * @company 上海风车教育有限公司.
- */
- // class Exam extends CActiveRecord{
- class Blacklist extends MyActiveRecord{
-
- public static function model($className = __CLASS__){
- return parent::model($className);
- }
- public function tableName(){
- return 'blacklist';
- }
- public function getExamList($arr,$page=1,$pageLimit){
- $sql="select exam_id,name,type,subject_id,class_name,class_type,grade,exam_create_time,exam_date from blacklist ";
- $countSql="select count(*) as count from blacklist ";
- if($arr){
- $countSql.=" where ".implode(' and ',$arr);
- $sql.=" where ".implode(' and ',$arr);
- }
- $countData=$this->getCommandBuilder()->createSqlCommand($countSql)->queryRow();
- $result=array(
- 'total'=>$countData['count'],
- 'pageTotal'=>ceil($countData['count']/$pageLimit),
- 'page'=>$page
- );
- $offset=($page-1)*$pageLimit;
- $sql.=" order by exam_group_id asc,class_id asc limit ".$offset.",".$pageLimit;
- $data=$countData=$this->getCommandBuilder()->createSqlCommand($sql)->queryAll();
- $result['dataList']=$data;
- return $result;
- }
- }
|