params['season_product']==2){ if($type==1){ $realType=4; }elseif($type==2){ $realType=5; }elseif($type==3){ $realType=6; } } $sql="select rpc_id from review_product_class rpc "; $sql.="left join review_paper_product_set rpps on rpps.rprs_id=rpc.rprs_id "; $sql.=" where subject_id='{$subjectId}' and class_id='{$classId}' and rpps.category ='{$realType}'"; $res =$this->getCommandBuilder()->createSqlCommand($sql)->queryRow(); if($res){ return $res['rpc_id']; }else{ return null; } } //读取学生生成 public function getStudentCreate($studentIds,$subjectId,$type,$semesterId,$isCreate=1){ $__sql = "select student_id,is_download,type,product_type,pdf_path,pdf_page_size,pdf_sheet_size,plan_id,pdf_time from student_product sp"; $__sql.=" left join review_product_class rpc on rpc.rpc_id=sp.plan_id"; $__sql.=" left join review_paper_product_set rpps on rpps.rprs_id=rpc.rprs_id"; $__sql.= " where sp.semester_id ='{$semesterId}' and student_id in(".implode(',',$studentIds).") and `type` ='{$type}' and rpps.subject_id='{$subjectId}' "; if($isCreate==1){ $__sql = $__sql.' and is_pdf_created = 1 '; } $res =$this->getCommandBuilder()->createSqlCommand($__sql)->queryAll(); return $res; } //读取学生下载 public function getStudentCreateDown($studentIds,$subjectId,$type,$semesterId){ $__sql = "select student_id,is_download,type,product_type,pdf_path,plan_id,pdf_time from student_product sp"; $__sql.=" left join review_product_class rpc on rpc.rpc_id=sp.plan_id"; $__sql.=" left join review_paper_product_set rpps on rpps.rprs_id=rpc.rprs_id"; $__sql.= " where sp.semester_id ='{$semesterId}' and student_id in(".implode(',',$studentIds).") and `type` ='{$type}' and rpps.subject_id='{$subjectId}'"; $sql = $__sql.' and is_pdf_created = 1 and is_download=1 '; $res =$this->getCommandBuilder()->createSqlCommand($sql)->queryAll(); return $res; } }