Java项目:基于springboot的在线选课网站—计算机毕业设计
运行环境:
开发工具:IDEA /Eclipse
数据库:MYSQL5.7
应用服务:Tomcat7/Tomcat8
使用框架:springboot+jsp
项目介绍
在学生在线选课系统的实现下,学生在线选课人员能够充分发挥信息化处理的优势,提高日常管理的处理速率。用户一方可以更好的享受信息化处理带来的便利。系统运行能够稳定且高效。并且人机友好程度能够显著提升。
效果图
控制器类
/**
* 功能描述:
*
* @Author
*/
@Controller
public class SelectController {
@Autowired
private IStudentService studentService;
@Autowired
private IStudyService studyService;
@Autowired
private IClzService clzService;
//选课功能
@RequestMapping("/selectClz")
public String selectClz(HttpServletRequest req) {
String sId = (String) req.getSession().getAttribute("userId");
Course c = (Course) req.getSession().getAttribute("course");
Integer cId = c.getId();
System.out.println("==cId=="+cId);
System.out.println("==sId=="+sId);
String msg = null;
int rst = studentService.selectCource(sId, cId);
if (rst==0) {
msg = "选课成功!";
} else if(rst==1){
msg = "已经选过此课!";
} else if(rst==2){
msg="该课程已选满!";
}else{
msg="未知错误!";
}
req.getSession().setAttribute("msg", msg);
return "detail";
}
//删除我的选课
@RequestMapping("/delCourse")
public synchronized String delClz(HttpServletRequest req){
try {
String stuId = (String) req.getSession().getAttribute("userId");
Integer clzId =Integer.parseInt(req.getParameter("id"));
studyService.delCourse(stuId,clzId);
Course c=clzService.getClzById(clzId);
c.setSelected(c.getSelected()-1);
clzService.update(c);
}catch (NumberFormatException e){
e.printStackTrace();
return "404";
}
req.getSession().setAttribute("msg","删除成功!");
return "redirect:/showMyClasses";
}
}
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
二维码