Browse Source

校本教师表替换

24753255@qq.com 7 tháng trước cách đây
mục cha
commit
5168f3d219

+ 2 - 2
protected/controllers/ClassesController.php

@@ -7769,7 +7769,7 @@ public function actionResetpwd()
                 $class_data = $this->sConn->createCommand($sql)->queryAll();
                 if($class_data){
                     $teacher_ids = _array_column($class_data, 'teacher_id');
-                    $sql = "select teacher_id,phone_number from teacher where teacher_id in (".implode(',',$teacher_ids).") and phone_number = '{$class_master_phone}'";
+                    $sql = "select teacher_id,phone_number from xb_teacher where teacher_id in (".implode(',',$teacher_ids).") and phone_number = '{$class_master_phone}'";
                     $teacherInfo = $this->conn->createCommand($sql)->queryRow();
                     if($teacherInfo){
                         $teacher_id = $teacherInfo['teacher_id'];
@@ -8112,7 +8112,7 @@ public function actionResetpwd()
                     if(!$teacher_ids){
                         Yii::app()->jump->error('第'.$hang_no.'行'.'年级主任与学科不对应 '.$class_teacher_subject.' '.$class_teacher_name);
                     }else{
-                        $sql = "select teacher_id,phone_number from teacher where teacher_id in (".implode(',',$teacher_ids).") and phone_number = '{$class_teacher_phone}'";
+                        $sql = "select teacher_id,phone_number from xb_teacher where teacher_id in (".implode(',',$teacher_ids).") and phone_number = '{$class_teacher_phone}'";
                         $teacherInfo = $this->conn->createCommand($sql)->queryRow();
                         if($teacherInfo){
                             $teacher_id = $teacherInfo['teacher_id'];

+ 4 - 4
protected/controllers/TeacherController.php

@@ -191,7 +191,7 @@ class TeacherController extends Controller
 //                    $this->conn->createCommand("delete from teacher where teacher_id='".$businessTeacher->teacher_id."'")->execute();
 //                }
                 $teacherId=getUniqueId($this->schoolId);
-                $insertSql="insert into teacher(`teacher_id`,`phone_number`,`password`,`school_id`,`add_time`,`status`) values ('".$teacherId."','".$phone_number."','".$password."','".$this->schoolId."','".$time."','".$status."')";
+                $insertSql="insert into xb_teacher(`teacher_id`,`phone_number`,`password`,`school_id`,`add_time`,`status`) values ('".$teacherId."','".$phone_number."','".$password."','".$this->schoolId."','".$time."','".$status."')";
                 $this->conn->createCommand($insertSql)->execute();
                 $businessRs=true;
 
@@ -403,7 +403,7 @@ class TeacherController extends Controller
             $transaction_conn	=	$this->conn->beginTransaction();
             try{
 
-                $updateSql="update teacher set ";
+                $updateSql="update xb_teacher set ";
                 $setArr=array();
                 foreach ($data as $key => $val){
                     $setArr[]="`".$key."`='".$val."'";
@@ -884,7 +884,7 @@ class TeacherController extends Controller
         if( $updateTeacherData || $busTeacherData) {
             $schInsertSql='';
             if($busTeacherData && $schoolTeacherData){
-                $busInsertSql = 'INSERT INTO teacher (`teacher_id`, `phone_number`,`password`,`school_id`,`add_time`) VALUES ';
+                $busInsertSql = 'INSERT INTO xb_teacher (`teacher_id`, `phone_number`,`password`,`school_id`,`add_time`) VALUES ';
 
                 $schInsertSql = 'INSERT INTO teacher (`teacher_id`, `teacher_name`,`teacher_age`,`teacher_sex`,`add_time`,`coach_id`,`posts`,`title`,`subjects`,`grade`) VALUES ';
 
@@ -1105,7 +1105,7 @@ class TeacherController extends Controller
                 }
             }
 
-            $sql = "select teacher_id,phone_number from teacher where teacher_id in (".implode(',',$teacher_ids).")";
+            $sql = "select teacher_id,phone_number from xb_teacher where teacher_id in (".implode(',',$teacher_ids).")";
             $teacherInfo = $this->conn->createCommand($sql)->queryAll();
             if($teacherInfo){
                 foreach($teacherInfo as $val){

+ 4 - 4
protected/models/BusinessTeacher.php

@@ -14,13 +14,13 @@ class BusinessTeacher extends BusinessActiveRecord{
 	}
 
 	public function tableName(){
-		return "teacher";
+		return "xb_teacher";
 	}
 
 	public function getTeacherInfo($schoolId,$sub = false){
 		if(empty($schoolId)) return false;
 
-		$sql = 'SELECT teacher_id,phone_number FROM teacher WHERE school_id='.$schoolId;
+		$sql = 'SELECT teacher_id,phone_number FROM xb_teacher WHERE school_id='.$schoolId;
 		$res =  $this->getDbConnection()->createCommand($sql)->queryAll();
 
 		$info = array();
@@ -36,7 +36,7 @@ class BusinessTeacher extends BusinessActiveRecord{
 	public function getAddTeacherInfo($phoneArr){
 		if(empty($phoneArr)) return false;
 
-		$sql = 'SELECT teacher_id,phone_number FROM teacher WHERE phone_number in( '.implode(',',$phoneArr).')';
+		$sql = 'SELECT teacher_id,phone_number FROM xb_teacher WHERE phone_number in( '.implode(',',$phoneArr).')';
 		$res =  $this->getDbConnection()->createCommand($sql)->queryAll();
 
 		$info = array();
@@ -53,7 +53,7 @@ class BusinessTeacher extends BusinessActiveRecord{
 
 	public function getTeacherIdByNumber($phone,$schoolId){
 	    if(!$phone || !is_numeric($phone)) return null;
-	    $sql="select teacher_id,phone_number from  teacher where phone_number like '%".$phone."%' and school_id='".$schoolId."'";
+	    $sql="select teacher_id,phone_number from  xb_teacher where phone_number like '%".$phone."%' and school_id='".$schoolId."'";
 
         $res =  $this->getDbConnection()->createCommand($sql)->queryAll();
         $info = array();

+ 7 - 7
protected/models/SchoolManager.php

@@ -194,7 +194,7 @@ class SchoolManager extends Model{
 		$account = array();
 
 		if($teacherId){
-			$account = $this->conn->createCommand("select * from teacher where teacher_id = '{$teacherId}'")->queryRow();
+			$account = $this->conn->createCommand("select * from xb_teacher where teacher_id = '{$teacherId}'")->queryRow();
 		}
 
 		return $account;
@@ -206,7 +206,7 @@ class SchoolManager extends Model{
 
 		$teachersIds = "'".implode("','", $teachersIds)."'";
 
-		return $this->conn->createCommand("select * from teacher where teacher_id in({$teachersIds})")->queryAll();
+		return $this->conn->createCommand("select * from xb_teacher where teacher_id in({$teachersIds})")->queryAll();
 	}
 
 	public function countTeachersAccountsPages($pageSize){
@@ -1703,7 +1703,7 @@ select t.*,tr.class_id from teacher as t LEFT JOIN teacher_class_relation tr on
 		if(!$teacherId)
 			return false;
 
-		$rs = $this->conn->createCommand("select exists(select * from teacher where teacher_id = '{$teacherId}')")->queryRow();
+		$rs = $this->conn->createCommand("select exists(select * from xb_teacher where teacher_id = '{$teacherId}')")->queryRow();
 		$rs = current($rs);
 
 		return $rs ? true : false;
@@ -1729,7 +1729,7 @@ select t.*,tr.class_id from teacher as t LEFT JOIN teacher_class_relation tr on
 				$trans1 = $this->sConn->beginTransaction();
 				$trans2 = $this->conn->beginTransaction();
 
-				$this->conn->createCommand("update teacher set status = '2' where teacher_id = '{$teacherId}'")->execute();
+				$this->conn->createCommand("update xb_teacher set status = '2' where teacher_id = '{$teacherId}'")->execute();
 				$this->sConn->createCommand("update teacher set status = '2' where teacher_id = '{$teacherId}'")->execute();
 				$this->kickTeacher($teacherId);
 
@@ -1778,7 +1778,7 @@ select t.*,tr.class_id from teacher as t LEFT JOIN teacher_class_relation tr on
 				$trans2 = $this->conn->beginTransaction();
 
 				if($teacherAccountExists){
-					$this->conn->createCommand("delete from teacher where teacher_id = '{$teacherId}'")->execute();
+					$this->conn->createCommand("delete from xb_teacher where teacher_id = '{$teacherId}'")->execute();
 				}
 				$this->sConn->createCommand("delete from teacher where teacher_id = '{$teacherId}'")->execute();
 				$this->sConn->createCommand("delete from teacher_class_relation where teacher_id = '{$teacherId}'")->execute();
@@ -2792,7 +2792,7 @@ select t.*,tr.class_id from teacher as t LEFT JOIN teacher_class_relation tr on
 
 	public function teacherPhoneNumberExists($phoneNumber){
 		if($phoneNumber){
-			$count = $this->conn->createCommand("select exists(select * from teacher where phone_number = '{$phoneNumber}')")->queryRow();
+			$count = $this->conn->createCommand("select exists(select * from xb_teacher where phone_number = '{$phoneNumber}')")->queryRow();
 			$count = current($count);
 			return $count ? true : false;
 		}
@@ -7877,7 +7877,7 @@ select t.*,tr.class_id from teacher as t LEFT JOIN teacher_class_relation tr on
                     $report_id = $v['report_id'];
                     $semester_id = $v['semester_id'];
                     //获取教师登陆账号
-                    $sql = "select phone_number from teacher where teacher_id = '{$teacher_id}'";
+                    $sql = "select phone_number from xb_teacher where teacher_id = '{$teacher_id}'";
                     $teacher_data = $this->conn->createCommand($sql)->queryRow();
                     if($teacher_data){
                         $rs['rs'][$k]['phone_number'] = $teacher_data['phone_number'];