db251; } public static function model($className = __CLASS__) { return parent::model($className); } public function tableName() { return "order_student"; } public function getOrderIDByClassId($class_id='',$student_id='') { $criteria = new CDbCriteria(); if($class_id!="-1") { $criteria->addCondition('clazz_id=:clazz_id'); $criteria->params[':clazz_id'] = $class_id; } if($student_id!="-1") { $criteria->addCondition('student_id=:student_id'); $criteria->params[':student_id'] = $student_id; } $data = $this->findAll($criteria); if($data) { return $data; } return false; } public function getOrderIDInClassId($class_ids=array(),$student_id='') { $criteria = new CDbCriteria(); if($class_ids) { $criteria->addInCondition('clazz_id ',$class_ids); // $criteria->params[':clazz_id'] = implode(",", $class_ids); } if($student_id!=-1) { $criteria->addCondition('student_id=:student_id'); $criteria->params[':student_id'] = $student_id; } $data = $this->findAll($criteria); if($data) { return $data; } return false; } public function getPageList($school_id){ $data = array(); $criteria = new CDbCriteria(); $criteria->addCondition('order_id=:order_id'); $criteria->params[':school_id'] = $school_id; $total = $this->count($criteria); $pager = new CPagination($total); $criteria->order = 'id desc'; $pager->pageSize = 12; $pager->applyLimit($criteria); $data['result'] = $this->findAll($criteria); $data['page'] = $pager; $data['page_total'] = $total; return $data; } }