基于javaweb+mysql的课程信息管理系统(java+springboot+FreeMarker+maven+mysql)

一、项目运行
环境配置:

Jdk1.8 + Tomcat8.0 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:

Springboot + SpringMVC + MyBatis + FreeMarker + JavaScript + JQuery + Ajax + maven等等。

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

		return "redirect:/User/Main";
	}
}
角色控制层:
@Controller
@RequestMapping("/Role")
public class RoleController {
	@Autowired
	private RoleService depotService;
	@Autowired
	private PowerService powerService;
	@RequestMapping("/update")
	public String update(String id,String rolename,String powerContent){
		Role role = new Role();
		role.setRoleid(id);
		role.setRolename(rolename);
		power.setPower(powerContent);
		power.setRoleid(role1.getPowerid());
		powerService.update(power);
		return "redirect:/Role/queryAll";
	}
	@RequestMapping("/delete")
	public String delete(String ID){
		depotService.deleteByPrimaryKey(ID);
		return "redirect:/Role/queryAll";
	}
	@RequestMapping("/queryAll")
	public String queryAll(HttpServletRequest request,Role role){
		List<Role> list = depotService.QueryAll(role);
		request.setAttribute("list", list);
	   if(null != role.getRolename()){
			request.setAttribute("rolename", role.getRolename());
		}
		return "Role";
	}
	@RequestMapping("/add")
	public String  add(String roleid,String rolename,String powerContent){
    }
    @RequestMapping("deletecomment")
    public String deletecomment(String ID){
        coursecommentService.deleteByPrimaryKey(ID);
        return "redirect:/Course/suggeetion";
    }
    @RequestMapping("queryAll")
    public String queryAll(HttpServletRequest request, Course course){
        List<Course> list = courseService.queryAll(course);
        request.setAttribute("list",list);
        return "course";
    }
    @RequestMapping("/receive")
		List<Role> list = depotService.QueryAll(role);
		request.setAttribute("list", list);
	   if(null != role.getRolename()){
			request.setAttribute("rolename", role.getRolename());
		}
		return "Role";
	}
	@RequestMapping("/add")
	public String  add(String roleid,String rolename,String powerContent){
		Power power1 = new Power();
		Role role = new Role();
		String powerid = String.valueOf(Math.random()).substring(2, 8);
		role.setRoleid(String.valueOf(Math.random()).substring(2, 6));
		role.setPowerid(powerid);
		role.setRolename(rolename);
		power1.setPower(powerContent);
		power1.setRoleid(powerid);
		power1.setId(String.valueOf(Math.random()).substring(2, 8));
		powerService.insert(power1);
		depotService.insert(role);
		return "redirect:/Role/queryAll";
	}
	@ResponseBody
	@RequestMapping("/queryOne")
	public String queryOne(String ID){
		JSONObject json = new JSONObject();
		Role depot = new Role();
    public String student(HttpServletRequest request){
        Course course = new Course();
        course.setStatus("1");
        List<Course> courseList = courseService.queryAll(course);
        request.setAttribute("list",courseList);
        return "studentChoose";
    }
    @RequestMapping("/upload")
    public  String upload(){
        return "uploadScore";
    }
    @RequestMapping("/Export")
    public void Export(HttpServletResponse response, User user){
        response.setContentType("application/binary;charset=UTF-8");
        try {
            ServletOutputStream out = response.getOutputStream();
            String fileName1 = "学生信息";
            String fileName2 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date());
            String fileName = fileName1+fileName2;
            response.setHeader("Content-disposition", "attachment; filename=" +new String(fileName.getBytes("gbk"),"iso8859-1") + ".xls");
            String[] titles = { "成绩编号","学生编号", "学生姓名", "课程编号", "课程名称", "成绩" };
	@ResponseBody
	@RequestMapping("/queryOne")
	public String queryOne(String ID){
		User user = new User();
		user.setId(ID);
		List<User> list = userService.QueryAll(user);
		user = list.get(0);
		JSONObject json = new JSONObject();
		String data = json.toJSONString(user);
		return data;
	}
	@RequestMapping("/quit")
	public ModelAndView quit(HttpServletRequest request) throws Exception{
		ModelAndView mav = new ModelAndView();
		HttpSession session1 = request.getSession();
		session1.invalidate();
		request.getSession().setAttribute("info", "quit");
		mav.setViewName("index");
		return mav;
	}
}
排课控制层:
@Controller
        Curelation curelation1 = new Curelation();
        curelation1.setCourseid(course.getId());
        curelation1.setUserid(user.getId());
        List<Curelation> curelationList = curelationService.queryAll(curelation1);
        if(curelationList.size()==0){
            Curelation curelation = new Curelation();
            curelation.setUserid(user.getId());
            curelation.setCourseid(course.getId());
            curelation.setId(String.valueOf(Math.random()).substring(2, 10));
            curelation.setType("2");
            curelationService.insert(curelation);
        }
        return "redirect:/Course/teacher";
		return "redirect:/User/teacher";
	}
	@RequestMapping("/updatePa")
	public String updatePa(String userID,String password){
		User user = new User();
		System.out.println(userID);
		User user1 = userService.selectByPrimaryKey(userID);
		user1.setPassword(password);
		userService.updateByPrimaryKey(user1);
		return "Main";
	}
	@RequestMapping("/delete")
	public String delete(String ID){
		userService.deleteByPrimaryKey(ID);
		return "redirect:/User/queryAll";
	}
	@RequestMapping("/teacher")
	public String QueryAllTeacher(HttpServletRequest request,User user){
		List<User> list = userService.QueryAllTeacher(user);
		request.setAttribute("list", list);
        Coursecomment course = new Coursecomment();
        course.setId(ID);
        System.out.println("===================================="+ID);
        List<Coursecomment> list = coursecommentService.queryAll(course);
        course = list.get(0);
        JSONObject json = new JSONObject();
        return json.toJSONString(course);
    }
    @RequestMapping("addComment")
    public String addComment(HttpServletRequest request, Coursecomment coursecomment){
        User user = (User) request.getSession().getAttribute("user");
        coursecomment.setCreatetime(DateUtil.getStringToday());
        coursecomment.setUserid(user.getName());
        coursecomment.setId(String.valueOf(Math.random()).substring(2,10));
		List<User> list = userService.QueryAllTeacher(user);
		JSONObject json = new JSONObject();
		return json.toJSONString(list);
	}
	@RequestMapping("/student")
	public String QueryAllStudent(HttpServletRequest request,User user){
		List<User> list = userService.QueryAllStudent(user);
		request.setAttribute("list", list);
		if(null != user.getName()){
			request.setAttribute("name", user.getName());
		}
		if(null != user.getMobile()){
			request.setAttribute("mobile", user.getMobile());
		}
	@ResponseBody
	@RequestMapping("/queryOne")
	public String queryOne(String id){
		System.out.println("=================="+id);
		Notice notice = new Notice();
		notice.setId(id);
		List<Notice> noticeList = noticeService.queryAll(notice);
		JSONObject json = new JSONObject();
		return json.toJSONString(noticeList.get(0));
	}
	@RequestMapping("/add1")
	public String  add(HttpServletRequest request,String Content,String biaoti) throws Exception{
		User user = (User) request.getSession().getAttribute("user");
		Notice notice = new Notice();
	@Autowired
	private PowerService powerService;
	@Autowired
	private RoleService roleService;
	@Autowired
	private NoticeService noticeService;
	@RequestMapping("/Main")
	public String res(HttpServletRequest request){
		String time = DateUtil.getStringToday();
		request.getSession().setAttribute("time", time);
		Notice notice = new Notice();
		List<Notice> list = noticeService.queryAll(notice);
		notice = list.get(0);
		User user = userService.selectByPrimaryKey(notice.getUserid());

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值