sConn->createCommand($Sql." where ".$where ." group by eg.zl_exam_group_id ")->queryAll(); $result['totalCount']=count($dataCount); $result['pageTotal']=ceil(count($dataCount)/$pagelimit); $offset=($page-1)*$pagelimit; $Sql="select eg.zl_exam_group_id,zl_grade,zl_exam_name,zl_exam_date,e.zl_tpl_data,zl_is_display from zl_exam_group eg left join `zl_exam` e on eg.zl_exam_group_id=e.zl_exam_group_id "; $data=$this->sConn->createCommand($Sql." where ".$where." group by eg.zl_exam_group_id order by zl_create_time desc limit {$offset},{$pagelimit} ")->queryAll(); $result['data']=$data; return $result; } // public function getExamByExamGroupId($examGroupId){ if(!$examGroupId) return false; $sql="SELECT eg.zl_exam_group_id,eg.zl_exam_name,eg.zl_exam_type,eg.zl_grade,eg.zl_exam_date,e.zl_class_id,e.zl_exam_id,e.zl_tpl_data,e.zl_subject_ids,zl_grade FROM `zl_exam_group` eg join zl_exam e on e.zl_exam_group_id=eg.zl_exam_group_id where eg.zl_exam_group_id='".$examGroupId."';"; $data=$this->sConn->createCommand($sql)->queryAll(); return $data; } /*修改状态*/ public function updateByCondition($data,$condition){ $result=0; if(!$data || !$condition || !is_array($data) || !is_array($condition)){ return false; } $set=array(); $where=array(); foreach($data as $key=>$val){ $set[]="`".$key."` = '".$val."'"; } foreach ($condition as $key=>$val){ $where[]='`'.$key.'` = '.$val; } if($where && $set){ $Sql=" Update `zl_exam_group` "; $Sql.=" set ".implode(', ',$set); $Sql.=" where ".implode(' And ',$where); $result=$this->sConn->createCommand($Sql)->execute(); } return $result; } public function getExamGroupByExamGroupId($examGroupId){ if(!$examGroupId) return false; $sql="select * from zl_exam_group where zl_exam_group_id='".$examGroupId."'"; return $this->sConn->createCommand($sql)->queryRow(); } }