tableName().' as tcr left join class as c on c.class_id = tcr.class_id where tcr.semester_id="'.$sid.'" and tcr.teacher_id = "'.$tid.'"'; $list = $this->findAllBySql($sql); $str = ''; if (empty($list)) { $str = '暂无'; } else { foreach ($list as $vv) { $str.=$vv->class_name.','; } $str = rtrim($str,','); } return $str; } public function getTeacher($sql){ $info = $this->getDbConnection()->createCommand($sql)->queryRow(); return $info; } }