作者主页:源码空间站2022
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
该项目分为学生、教师两个角色,主要功能如下:
1. 学生模块
1) 我的课程:学生可在此页面自由选课
2) 我的作业:可查看选择的课程已发布的作业及完成情况,并可选择完成作业或查看详情
2. 教师模块
1) 学生管理:
I. 查询学生:可根据学生信息搜索学生,可进行修改删除操作,可进行全选批量删除和导出excel表格,可根据查询到的数据进行分页,输入页码进行跳转操作
II. 添加学生:可进行单个添加学生或excel表格导入学生
2) 教师管理:
I. 查询教师:可根据教师信息搜索教师,可进行修改删除操作,可进行全选批量删除和导出excel表格,可根据查询到的数据进行分页,输入页码进行跳转操作
II. 添加教师:可进行单个添加学生或excel表格导入教师
3) 班级管理:
I. 查询班级:可查看所有班级,进行删除修改等操作
II. 添加班级:可进行添加班级操作
4) 课程管理:
I. 查询课程:可查看所有课程,进行修改删除操作
II. 添加班级:可进行添加课程操作
5) 作业管理:
I. 查看作业完成情况:可查看每门科目项目学生作业的完成情况,可根据起止时间和课程名称进行搜索。
II. 添加作业:选择一门课程搜索题库,在题库中选择题目后进行作业发布操作
III. 编辑题库:可对题库进行增删改操作
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
6.是否Maven项目:是
1. 后端:SpringBoot+Mybatis+Thymeleaf模板引擎
2. 前端:HTML+CSS+JavaScript+BootStrap
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/ 登录
@Controller
@RequestMapping(value = "teacher")
public class ClazzManagementController {
@Autowired
ClazzManagementService clazzManagementService;
@RequestMapping(value = "show_clazz_bypage",method = RequestMethod.GET)
public String showClazzByPage(Model model, Page page){
if (page.getPageNum()==0)
page.setPageNum(1);
PageHelper.startPage(page.getPageNum(),12);
List clazzs=clazzManagementService.selectAllClazz();
PageInfo pageInfo=new PageInfo(clazzs);
model.addAttribute("clazzs",clazzs);
model.addAttribute("pageInfo",pageInfo);
return "teacher/show_clazz";
}
@RequestMapping(value = "add_clazz",method = RequestMethod.GET)
public String addStudent(Model model){
return "teacher/add_clazz";
}
@RequestMapping(value = "add_clazz",method = RequestMethod.POST)
public String addStudent(Clazz clazz, Model model){
int result=clazzManagementService.insertClazz(clazz);
if (result==0){
model.addAttribute("msg","添加失败");
return "teacher/add_clazz";
}
model.addAttribute("msg","添加成功");
return "teacher/add_clazz";
}
@RequestMapping(value = "update_clazz/{id}",method = RequestMethod.GET)
public String updateStudent(@PathVariable(name = "id")int id, Model model){
model.addAttribute("clazz",clazzManagementService.selectClazzById(id));
return "teacher/update_clazz";
}
@RequestMapping(value = "update_clazz",method = RequestMethod.POST)
public String updateStudent(Clazz clazz,Model model){
clazzManagementService.updateClazz(clazz);
return "redirect:/teacher/show_clazz_bypage";
}
@RequestMapping(value = "delete_clazz/{id}/{pageNum}",method = RequestMethod.GET)
public String deleteStudent(@PathVariable(name = "id")int id,@PathVariable(name = "pageNum")int pageNum, RedirectAttributes model){
int result=clazzManagementService.deleteClazz(id);
if (result == 0){
model.addAttribute("msg","删除失败");
return "redirect:/teacher/show_clazz_bypage"+"?pageNum="+pageNum;
}
model.addAttribute("msg","删除成功");
return "redirect:/teacher/show_clazz_bypage"+"?pageNum="+pageNum;
}
@RequestMapping(value = "delete_clazz",method = RequestMethod.POST)
public String deleteAllStudent(HttpServletRequest request, HttpServletResponse response){
String[] check = request.getParameterValues("check");
for (String s:check
) {
int id =Integer.parseInt(s);
clazzManagementService.deleteClazz(id);
}
return "redirect:/teacher/show_clazz_bypage";
}
}
@Controller
@RequestMapping(value = "teacher")
public class HomeworkManagementController {
@Autowired
HomeworkManagementService homeworkManagementService;
@RequestMapping(value = "release_homework",method = RequestMethod.GET)
public String releaseHomework(Model model){
List courses=homeworkManagementService.selectAllCourse();
model.addAttribute("courses",courses);
return "/teacher/release_homework";
}
@RequestMapping(value = "release_homework",method = RequestMethod.POST)
public String findAllHomeworkByCourseId(Integer courseId,Model model){
List exercises=homeworkManagementService.selectHomeworkByCourseId(courseId);
List courses=homeworkManagementService.selectAllCourse();
model.addAttribute("courses",courses);
model.addAttribute("exercises",exercises);
model.addAttribute("courseId",courseId);
return "/teacher/release_homework";
}
@RequestMapping(value = "add_homework_check",method = RequestMethod.GET)
public String getCheck(HttpServletRequest request){
String [] check = request.getParameterValues("check");
request.getSession().setAttribute("check",check);
return "redirect:/teacher/homework_release";
}
@RequestMapping(value = "homework_release",method = RequestMethod.POST)
public String homeworkRelease(HttpServletResponse response, HttpServletRequest request,String homeworkName,Integer courseId,Model model){
List courses=homeworkManagementService.selectAllCourse();
model.addAttribute("courses",courses);
String[] check = (String[]) request.getSession().getAttribute("check");
request.getSession().removeAttribute("check");
int result= homeworkManagementService.homeworkRelease(check,homeworkName,courseId);
if (result==0) {
model.addAttribute("msg", "发布失败");
return "/teacher/release_homework";
}
model.addAttribute("msg", "发布成功");
return "/teacher/release_homework";
}
@RequestMapping(value = "show_homework",method = RequestMethod.GET)
public String showHomework(Model model){
List courses=homeworkManagementService.selectAllCourse();
List homeworkReleases=homeworkManagementService.selectAllHomeworkRelease();
model.addAttribute("hmreleases",homeworkReleases);
model.addAttribute("courses",courses);
return "/teacher/show_homework";
}
@RequestMapping(value = "show_homework_bycourseid",method = RequestMethod.POST)
public String showHomeworkByCourseId(Model model,Integer courseId,String startTime,String endTime){
if (courseId==0&&startTime.equals("")&&endTime.equals(""))
return "redirect:/teacher/show_homework";
List homeworkReleases=homeworkManagementService.selectAllHomeworkReleaseByCourseId(courseId,startTime,endTime);
List courses=homeworkManagementService.selectAllCourse();
model.addAttribute("hmreleases",homeworkReleases);
model.addAttribute("courses",courses);
return "/teacher/show_homework";
}
@RequestMapping(value = "edit_homework_bypage",method = RequestMethod.GET)
public String selectAllCourse(Model model, Page page, @Nullable Integer courseId, HttpSession session){
if (courseId!=null&&courseId==0){
if (session.getAttribute("courseId")!=null)
session.removeAttribute("courseId");
return "redirect:/teacher/edit_homework_bypage";
}
if (page.getPageNum()==0)
page.setPageNum(1);
Integer cid=null;
if (session.getAttribute("courseId")!=null)
cid=(Integer) session.getAttribute("courseId");
if (courseId==null && cid==null){
PageHelper.startPage(page.getPageNum(),8);
List exercises=homeworkManagementService.selectAllHomework();
List courses=homeworkManagementService.selectAllCourse();
PageInfo pageInfo=new PageInfo(exercises);
model.addAttribute("pageInfo",pageInfo);
model.addAttribute("courses",courses);
model.addAttribute("exercises",exercises);
return "/teacher/edit_homework";
}
if (session.getAttribute("courseId")==null)
session.setAttribute("courseId",courseId);
if (courseId!=null&&!courseId.equals(session.getAttribute("courseId"))){
session.removeAttribute("courseId");
session.setAttribute("courseId",courseId);
}
PageHelper.startPage(page.getPageNum(),8);
List exercises=homeworkManagementService.selectHomeworkByCourseId((Integer) session.getAttribute("courseId"));
List courses=homeworkManagementService.selectAllCourse();
PageInfo pageInfo=new PageInfo(exercises);
model.addAttribute("pageInfo",pageInfo);
model.addAttribute("courses",courses);
model.addAttribute("exercises",exercises);
return "/teacher/edit_homework";
}
@RequestMapping(value = "add_homework",method = RequestMethod.GET)
public String showaddHomework(Model model){
List courses=homeworkManagementService.selectAllCourse();
model.addAttribute("courses",courses);
return "teacher/add_homework";
}
@RequestMapping(value = "add_homework",method = RequestMethod.POST)
public String addHomework(Model model,Homework homework){
int result=homeworkManagementService.insertHomework(homework);
List courses=homeworkManagementService.selectAllCourse();
model.addAttribute("courses",courses);
if (result==0){
model.addAttribute("msg","添加失败");
}else {
model.addAttribute("msg","添加成功");
}
return "teacher/add_homework";
}
@RequestMapping(value = "update_homework",method = RequestMethod.GET)
public String toUpdateHomework(Model model,Integer id){
Homework homework=homeworkManagementService.selectHomeworkById(id);
List courses=homeworkManagementService.selectAllCourse();
model.addAttribute("courses",courses);
model.addAttribute("homework",homework);
return "teacher/update_homework";
}
@RequestMapping(value = "update_homework",method = RequestMethod.POST)
public String updateHomework(Model model,Homework homework){
int result=homeworkManagementService.updateHomework(homework);
List courses=homeworkManagementService.selectAllCourse();
model.addAttribute("courses",courses);
if (result==0){
model.addAttribute("msg","修改失败");
}else {
model.addAttribute("msg","修改成功");
}
return "teacher/update_homework";
}
@RequestMapping(value = "delete_homework/{id}/{pageNum}",method = RequestMethod.GET)
public String deleteStudent(@PathVariable(name = "id")int id,@PathVariable(name = "pageNum")int pageNum,RedirectAttributes model){
int result=homeworkManagementService.deleteHomework(id);
if (result == 0){
model.addAttribute("msg","删除失败");
}else {
model.addAttribute("msg", "删除成功");
}
return "redirect:/teacher/edit_homework_bypage"+"?pageNum="+pageNum;
}
@RequestMapping(value = "detail_homework/{courseId}/{homeworkReleaseId}",method = RequestMethod.GET)
public String showDetailStudent(Model model,@PathVariable(name = "courseId")Integer courseId,@PathVariable(name = "homeworkReleaseId")Integer homeworkReleaseId){
List studentCourses=homeworkManagementService.selectStudentByCourseId(courseId);
List studentAnswers=homeworkManagementService.selectAnswerByStudentId(studentCourses,homeworkReleaseId);
model.addAttribute("studentAnswers",studentAnswers);
return "/teacher/detail_homework";
}
}
如果也想学习本系统,下面领取。回复:078springboot