12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- /**
- * @author: CeeFee
- * @description: 考试
- */
- class ZlStudentExamRelation extends Model
- {
- function __construct(){
- parent::__construct();
- }
- public function getCountStudentByExamGroupId($exmGroupId,$examId=0){
- if(!$exmGroupId) return 0;
- $sql="select count(0) as count from `zl_student_exam_relation` where zl_exam_group_id = '".$exmGroupId."'";
- if($examId){
- $sql.=" and zl_exam_id='".$examId."'";
- }
- $sql.=" and zl_is_del=0";
- $data=$this->sConn->createCommand($sql)->queryRow();
- if($data){
- return $data['count'];
- }
- return 0;
- }
- public function getStudentByExamId($examId=0){
- if(!$examId) return 0;
- $sql="select ser.zl_student_id,ser.zl_exam_group_id,ser.zl_class_id,ser.zl_student_card,ser.zl_school_student_card,sers.zl_subject_id from `zl_student_exam_relation` ser ";
- $sql.="left join zl_student_exam_rs sers on ser.zl_exam_id=sers.zl_exam_id and ser.zl_student_id=sers.zl_student_id ";
- $sql.=" where ser.zl_exam_id = '".$examId."' ";
- // $sql="select zl_student_id,zl_exam_group_id,zl_class_id,zl_student_card,zl_school_student_card from `zl_student_exam_relation` where zl_exam_id = '".$examId."'";
- $sql.=" and zl_is_del=0 group by ser.zl_student_id";
-
- $data=$this->sConn->createCommand($sql)->queryAll();
- return $data;
- }
- //删除学生
- public function delAllStudentByExamId($examId){
- if(!$examId) return false;
- $sql="update zl_student_exam_relation set zl_is_del=1 where zl_exam_id='".$examId."'";
- return $this->sConn->createCommand($sql)->execute();
- }
- //删除学生
- public function delAllStudentByExamGroupId($examGroupId){
- if(!$examGroupId) return false;
- $sql="update zl_student_exam_relation set zl_is_del=1 where zl_exam_group_id='".$examGroupId."'";
- return $this->sConn->createCommand($sql)->execute();
- }
- }
|