src/com/cms/controller/MainController.java

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.cms.controller;


import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.cms.entity.Admin;
import com.cms.entity.Course;
import com.cms.entity.Student;
import com.cms.entity.Teacher;
import com.cms.entity.User;
import com.cms.service.CourseService;
import com.cms.utils.StrUtil;

@Controller
@RequestMapping(value="/main")
public class MainController {
	
	@Autowired
	CourseService courseService;
	
	
	@RequestMapping(value="/index")
	public ModelAndView toIndexPage(HttpSession session) {
		User user = (User) session.getAttribute(StrUtil.USER);
		if (user.getUserType().equals(StrUtil.ADMIN)) {
			user = (Admin) user;
		} else if (user.getUserType().equals(StrUtil.TEACHER)) {
			user = (Teacher) user;
		} else if (user.getUserType().equals(StrUtil.STUDENT)) {
			user = (Student) user;
		}
		ModelAndView mav = new ModelAndView("index");
		mav.addObject("user");
		return mav;
	}
	
	@RequestMapping(value="/student")
	public ModelAndView toStudentListPage(HttpSession session) {
		return new ModelAndView("studentList");
	}
	

	@RequestMapping(value="/teacher")
	public ModelAndView toTeacherListPage() {
		return new ModelAndView("teacherList");
	}
	
	@RequestMapping(value="/course")
	public ModelAndView toCourseListPage(HttpSession session, ModelAndView mav) {
		String userType = ((User) session.getAttribute(StrUtil.USER)).getUserType();
		if (userType.equals(StrUtil.ADMIN)) {
			mav = new ModelAndView("courseList");
		} else if(userType.equals(StrUtil.TEACHER)){
后面还有 37 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。