赞
踩
作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
由SpringMVC+MyBatis为主要框架,mysql8.0配置主从复制实现读写分离。前端主要由bootstrap完成,背景用particles.js插件。数据库交互查询用到pagehelper分页。在添加修改相关功能时通过ajax来验证其主键是否存在可用。代码层次清晰,输入框约束较高,已配置登录拦截。
项目主要分为管理员、教师、学生三种角色;
管理员角色包含以下功能:
管理员登录,学生管理,教师管理,课程管理等功能。
教师角色包含以下功能:
登录界面,查看课程,建立课程计划,管理教学课程,成绩查询结课等功能。
学生角色包含以下功能:
登录界面,选课,确认选课,查看选课结果,退选界面,查看已修课程,管理个人信息等功能。
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. 后端:Spring+SpringMVC+Mybatis
2. 前端:JavaScript、jQuery、bootstrap4、particles.js、ajax
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中applicationContext.xml配置文件中的数据库配置改为自己的配置;注:因为此处为读写分离的,需要配置2处;
4. 运行项目,输入localhost:8080/ 登录
管理员账号/密码:admin/admin
教师账号/密码: 0002/123456
学生账号/密码:201507021227/123456
- package net.fuzui.StudentInfo.handler;
-
- import net.fuzui.StudentInfo.pojo.Student;
- import net.fuzui.StudentInfo.pojo.Teacher;
- import net.fuzui.StudentInfo.service.AdminService;
- import net.fuzui.StudentInfo.service.CoursePlanService;
- import net.fuzui.StudentInfo.service.CourseService;
- import net.fuzui.StudentInfo.service.SelectCourseService;
- import net.fuzui.StudentInfo.service.StudentService;
- import net.fuzui.StudentInfo.service.TeacherService;
- import net.fuzui.StudentInfo.service.impl.AdminServiceImpl;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.http.HttpRequest;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.Model;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.SessionAttributes;
- import org.springframework.web.servlet.ModelAndView;
- import org.springframework.web.servlet.view.RedirectView;
-
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
-
- import java.util.ArrayList;
- import java.util.List;
-
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpSession;
-
- @Controller
- @RequestMapping("/AdminHandler")
- //@SessionAttributes("studentList")
- //@SessionAttributes("teacherList")
- public class AdminHandler {
-
-
- @Autowired
- StudentService studentService;
- @Autowired
- TeacherService teacherService;
- @Autowired
- CoursePlanService coursePlanService;
- @Autowired
- CourseService courseService;
- @Autowired
- SelectCourseService selectCourseService;
-
-
- /**
- * JavaScript学的不好,目前只能通过这种方式把三级联动下拉列表的val改变为以下值传给数据库。
- *
- */
- String[] arr_belongcoll = {"计算机学院","建筑学院","外国语学院","人文学院"};
- String[][] arr_belongpro = {
- {"网络工程","软件工程","物联网","信息管理"},
- {"土木工程","测绘工程","工程造价", "城市规划"},
- {"英语", "日语", "俄语", "西班牙语"},
- {"汉语言", "历史", "新闻", "网络新媒体"}
- };
- String[][][] arr_belongcla = {
- {
- {"网络B151","网络B152","网络B161","网络B162","网络B171","网络B172"},
- {"软件B151","软件B152","软件B161","软件B162","软件B171","软件B172"},
- {"物联B151","物联B152","物联B161","物联B162","物联B171","物联B172"},
- {"信管B151","信管B152","信管B161","信管B162","信管B171","信管B172"}
-
- },
- {
- {"土木B151","土木B152","土木B161","土木B162","土木B171","土木B172"},
- {"测绘B151","测绘B152","测绘B161","测绘B162","测绘B171","测绘B172"},
- {"造价B151","造价B152","造价B161","造价B162","造价B171","造价B172"},
- {"规划B151","规划B152","规划B161","规划B162","规划B171","规划B172"}
-
- },
- {
- {"英语B151","英语B152","英语B161","英语B162","英语B171","英语B172"},
- {"日语B151","日语B152","日语B161","日语B162","日语B171","日语B172"},
- {"俄语B151","俄语B152","俄语B161","俄语B162","俄语B171","俄语B172"},
- {"牙语B151","牙语B152","牙语B161","牙语B162","牙语B171","牙语B172"}
-
- },
- {
- {"汉语B151","汉语B152","汉语B161","汉语B162","汉语B171","汉语B172"},
- {"历史B151","历史B152","历史B161","历史B162","历史B171","历史B172"},
- {"新闻B151","新闻B152","新闻B161","新闻B162","新闻B171","新闻B172"},
- {"网媒B151","网媒B152","网媒B161","网媒B162","网媒B171","网媒B172"}
-
- }
- };
-
- // 添加
- @RequestMapping("/addStudent")
- public String addStudent(Student student, Model model) {
-
-
-
-
- int col = Integer.parseInt(student.getCollege());
- int pro = Integer.parseInt(student.getProfession());
- int cla = Integer.parseInt(student.getClassr());
- //总感觉前端js写的有问题。
- student.setCollege(arr_belongcoll[pro]);
- student.setProfession(arr_belongpro[pro][col]);
- student.setClassr(arr_belongcla[pro][col][cla]);
-
-
-
- if (studentService.insertStudent(student) != 0) {
- model.addAttribute("student", student);
- return "success";
- // return "admin/addStudent";
- } else {
- return "fail";
- }
-
- }
- //查询全部学生方法
- public void queryStu(HttpServletRequest request) {
- List<Student> studentList = new ArrayList<Student>();
- studentList = studentService.selectStudentBySql(1,10);
-
-
- request.setAttribute("slist", studentList);
- }
-
- public void pageIn(Model model,List list) {
- PageInfo page = new PageInfo(list, 5);
- model.addAttribute("pageInfo", page);
- }
-
- // 查询
- @RequestMapping(value = "/query/{pn}", method = RequestMethod.GET)
- public String redirect(@RequestParam("serc") String serc, @RequestParam("condition") String condition,HttpServletRequest request,
- @PathVariable(value = "pn") String pn,Model model) {
-
- int no = Integer.parseInt(pn);
- // System.out.println("-----"+no+"----");
- List<Student> studentList = new ArrayList<Student>();
- PageHelper.startPage(no, 5);
- request.setAttribute("serc", serc);
- request.setAttribute("condition", condition);
- //查询全部
- if (serc.equals("all")) {
-
-
-
-
- System.out.println("------------------------------------------------------------------------------------------------");
- // studentList = studentService.selectStudentBySql(1,10);
- // //model.addAttribute("studentList", studentList);
- // request.setAttribute("slist", studentList);
- // System.out.println("00000"+request.getAttribute("slist"));
- // System.out.println(studentList);
- studentList = studentService.selectStudentBySql(1,10);
- pageIn(model, studentList);
- request.setAttribute("slist", studentList);
- return "admin/queryStudent";
-
- //根据学号查询
- } else if (serc.equals("sid")) {
-
- studentList = studentService.getByStudentSid(1,10,condition);
- pageIn(model, studentList);
- request.setAttribute("slist", studentList);
- System.out.println("sid");
-
- return "admin/queryStudent";
-
- //根据学院查询
- } else if (serc.equals("col")) {
-
-
- studentList = studentService.getByStudentCol(1,10,condition);
- pageIn(model, studentList);
- request.setAttribute("slist", studentList);
- System.out.println(studentList);
- System.out.println("col");
- return "admin/queryStudent";
-
- //根据专业查询
- } else if (serc.equals("pro")) {
- studentList = studentService.getByStudentPro(1,10,condition);
- pageIn(model, studentList);
- request.setAttribute("slist", studentList);
- System.out.println(studentList);
- System.out.println("pro");
- return "admin/queryStudent";
-
- //根据班级查询
- } else if (serc.equals("cla")) {
- studentList = studentService.getByStudentCla(1,10,condition);
- pageIn(model, studentList);
- //model.addAttribute("studentList", studentList);
- request.setAttribute("slist", studentList);
- // System.out.println(studentList);
- // System.out.println("cla");
- return "admin/queryStudent";
-
- } else {
-
- // studentList = studentService.selectStudentBySql(1,10);
- // model.addAttribute("studentList", studentList);
- // request.setAttribute("slist", studentList);
- // System.out.println("00000"+request.getAttribute("slist"));
- // System.out.println(studentList);
- studentList = studentService.selectStudentBySql(1,10);
- pageIn(model, studentList);
- request.setAttribute("slist", studentList);
- return "admin/queryStudent";
-
- }
-
- }
-
- // 删除学生
- @RequestMapping(value = "/delete/{sid}", method = RequestMethod.GET)
- public String deleteStudent(@PathVariable(value = "sid") String sid, Model model) {
-
-
- if (studentService.deleteStudent(sid) != 0) {
- System.out.println("success");
-
- return "success";
- } else {
- System.out.println("fail");
- return "fail";
- }
-
- }
-
- // 跳转页面
- @RequestMapping(value = "/finalPage", method = RequestMethod.GET)
- public String finalPage(HttpServletRequest request) {
- queryStu(request);
- return "admin/queryStudent";
- }
-
- // 修改定位
- @RequestMapping(value = "/moditystu/{sid}", method = RequestMethod.GET)
- public String editPre(@PathVariable("sid") String sid, HttpServletRequest request) {
-
- List<Student> studentList = new ArrayList<Student>();
- studentList = studentService.getByStudentSid(1,10,sid);
-
- request.setAttribute("studentList", studentList);
- System.out.println("-----进入修改");
- return "admin/modiStudent";
- }
-
-
-
- // 修改
- @RequestMapping(value = "/moditystud/{sid}", method = RequestMethod.GET)
- public String update(@PathVariable("sid") String sid, Student student, HttpServletRequest request) {
-
- int col = Integer.parseInt(student.getCollege());
- int pro = Integer.parseInt(student.getProfession());
- int cla = Integer.parseInt(student.getClassr());
- //总感觉前端js写的有问题。
- student.setCollege(arr_belongcoll[pro]);
- student.setProfession(arr_belongpro[pro][col]);
- student.setClassr(arr_belongcla[pro][col][cla]);
-
- if (studentService.modifyStudent(student) != 0) {
- System.out.println("----修改成功--------------------------------------------------------------------------------------------------------");
- return "success";
- } else {
- System.out.println("----修改失败----------------------------------------------------------------");
- return "fail";
- }
- }
-
-
-
-
- // 跳转页面
- @RequestMapping("/managestu/{pn}")
- public String manageStudent(HttpServletRequest request,
- @PathVariable(value = "pn") String pn,Model model) {
- int no = Integer.parseInt(pn);
-
- PageHelper.startPage(no, 5);
- List<Student> studentList = new ArrayList<Student>();
- studentList = studentService.selectStudentBySql(1,100);
- pageIn(model, studentList);
- request.setAttribute("slist", studentList);
- return "admin/queryStudent";
- }
-
- // 跳转页面
- @RequestMapping("/managetea/{pn}")
- public String manageTeacher(HttpServletRequest request,
- @PathVariable(value = "pn") String pn,Model model) {
- int no = Integer.parseInt(pn);
- PageHelper.startPage(no, 5);
- List<Teacher> teacherList = new ArrayList<Teacher>();
- teacherList = teacherService.selectTeacherBySql(1,10);
- pageIn(model, teacherList);
- request.setAttribute("teacherList", teacherList);
- return "admin/queryTeacher";
- }
-
-
- // 跳转页面
- @RequestMapping("/addstu")
- public String adStudent() {
- return "admin/addStudent";
- }
-
- // 跳转页面
- @RequestMapping("/addtea")
- public String adTeacher() {
- return "admin/addTeacher";
- }
-
- // 跳转页面
- @RequestMapping("/addcou")
- public String adCourse() {
- return "admin/addCourse";
- }
-
- // 添加
- @RequestMapping("/addTeacher")
- public String addTeacher(Teacher teacher, Model model, HttpSession httpSession) {
-
- if (teacherService.insertTeacher(teacher) != 0) {
- model.addAttribute("teacher", teacher);
-
- //---------------------------------待优化-----同样不能实时刷新--------------------------------------------
- return "success";
- //return new ModelAndView(new RedirectView("/StudentInfo/TeacherHandler/finalPage"));
- // return "techer/teacherFace";
- } else {
- return "fail";
- //return new ModelAndView(new RedirectView("fail"));
- }
-
- }
-
-
- /**
- * 教师相关
- */
-
- //查询全部教师方法
- public void queryTea(HttpServletRequest request) {
- List<Teacher> teacherList = new ArrayList<Teacher>();
- teacherList = teacherService.selectTeacherBySql(1,10);
- request.setAttribute("teacherList", teacherList);
- }
-
- // 查询
- @RequestMapping(value = "/queryTea/{pn}", method = RequestMethod.GET)
- public String redirectTea(@RequestParam("serc") String serc, @RequestParam("condition") String condition,HttpServletRequest request,
- @PathVariable(value = "pn") String pn,Model model) {
- int no = Integer.parseInt(pn);
- PageHelper.startPage(no, 5);
- List<Teacher> teacherList = new ArrayList<Teacher>();
- request.setAttribute("serc", serc);
- request.setAttribute("condition", condition);
-
- if (serc.equals("all")) {
-
- teacherList = teacherService.selectTeacherBySql(1,10);
- pageIn(model, teacherList);
- request.setAttribute("teacherList", teacherList);
- return "admin/queryTeacher";
-
- } else if (serc.equals("tid")) {
-
- teacherList = teacherService.getByTeacherTid(1,10,condition);
- pageIn(model, teacherList);
- request.setAttribute("teacherList", teacherList);
- System.out.println("tid");
-
- return "admin/queryTeacher";
-
- } else {
-
- teacherList = teacherService.selectTeacherBySql(1,10);
- pageIn(model, teacherList);
- request.setAttribute("teacherList", teacherList);
- return "admin/queryTeacher";
-
- }
-
- }
-
-
-
- //删除教师
- @RequestMapping(value = "/deleteTea/{tid}", method = RequestMethod.GET)
- public String deleteTeacher(@PathVariable(value = "tid") String tid, Model model) {
-
-
- if (teacherService.deleteTeacher(tid) != 0) {
- System.out.println("success");
- //------------------------代优化,现状:删除后需要手动刷新界面或者重新查询,不能实时刷新。---------------------------------------------------
- return "success";
- } else {
- System.out.println("fail");
- return "fail";
-
- }
-
- }
-
- @RequestMapping(value = "/finalPageTea", method = RequestMethod.GET)
- public String finalPageTea(HttpServletRequest request) {
- queryTea(request);
- return "admin/queryTeacher";
- }
-
- //修改定位,可优化
- @RequestMapping(value = "/modityTea/{tid}", method = RequestMethod.GET)
- public String editPreTea(@PathVariable("tid") String tid, HttpServletRequest request) {
-
- List<Teacher> teacherList = new ArrayList<Teacher>();
- teacherList = teacherService.getByTeacherTid(1,10,tid);
- //model.addAttribute("teacherList", teacherList);
- request.setAttribute("teacherList", teacherList);
-
- return "admin/modiTeacher";
- }
-
- // 修改
- @RequestMapping(value = "/modityTeac/{tid}", method = RequestMethod.GET)
- public String update(@PathVariable("tid") String tid, Teacher teacher, HttpServletRequest request) {
-
- if (teacherService.modifyTeacher(teacher) != 0) {
- return "success";
- } else {
- return "fail";
- }
- }
-
-
- }
- package net.fuzui.StudentInfo.handler;
-
- import java.io.IOException;
- import java.io.PrintWriter;
- import java.io.UnsupportedEncodingException;
-
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
-
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RequestParam;
-
- import net.fuzui.StudentInfo.service.CoursePlanService;
- import net.fuzui.StudentInfo.service.CourseService;
- import net.fuzui.StudentInfo.service.StudentService;
- import net.fuzui.StudentInfo.service.TeacherService;
-
- @Controller
- @RequestMapping("/AjaxHandler")
- public class AjaxHandler {
- @Autowired
- CourseService courseService;
- @Autowired
- StudentService studentService;
- @Autowired
- TeacherService teacherService;
- @Autowired
- CoursePlanService coursePlanService;
-
- /**
- * ajax验证课程编号是否存在
- * @param cid
- * @param response
- * @param request
- * @throws IOException
- */
- @RequestMapping(value="/existCid",method = RequestMethod.POST)
- public void existCid(@RequestParam("cid") String cid,HttpServletResponse response,HttpServletRequest request) throws IOException{
- System.out.println("课程编号="+cid);
-
- response.setContentType("text/html;charset=UTF-8");
- response.setHeader("Cache-Control", "no-cache");
- System.out.println(cid+"----------");
- PrintWriter out=null;
-
- out=response.getWriter();
- if(courseService.getByCouCid(cid) != null && cid !=null && !"".equals(cid)){
- out.println("课程编号已存在");
- }else if(cid !=null && !"".equals(cid)){
- out.println("此课程编号可以使用");
- }else {
- out.println("课程编号不能为空");
- }
- out.flush();
- out.close();
-
- }
-
- @RequestMapping(value="/existSid",method = RequestMethod.POST)
- public void existSid(@RequestParam("sid") String sid,HttpServletResponse response,HttpServletRequest request) throws IOException{
- System.out.println("学号="+sid);
-
- response.setContentType("text/html;charset=UTF-8");
- response.setHeader("Cache-Control", "no-cache");
- PrintWriter out=null;
-
- out=response.getWriter();
- if(studentService.getByStuSid(sid) != null && sid.length() ==12){
- out.println("学号已存在");
- }else if(sid.length() ==12){
- out.println("学号可以使用");
- }else {
- out.println("学号必须是12位");
- }
- out.flush();
- out.close();
-
- }
- //ajax验证教师id
- @RequestMapping(value="/existTid",method = RequestMethod.POST)
- public void existTid(@RequestParam("tid") String tid,HttpServletResponse response,HttpServletRequest request) throws IOException{
-
- response.setContentType("text/html;charset=UTF-8");
- response.setHeader("Cache-Control", "no-cache");
- PrintWriter out=null;
-
- out=response.getWriter();
- if(teacherService.getByTeaTid(tid) != null && tid.length() <=5){
- out.println("教师编号已存在");
- }else if(tid.length() <=12){
- out.println("教师编号可以使用");
- }else {
- out.println("教师编号必须小于等于5位");
- }
- out.flush();
- out.close();
-
- }
-
-
- @RequestMapping(value="/existTime",method = RequestMethod.POST)
- public void existTime(@RequestParam("coursetime") String coursetime,@RequestParam("courseweek") String courseweek,
- @RequestParam("classroom") String classroom,HttpServletResponse response,HttpServletRequest request) throws IOException{
-
- response.setContentType("text/html;charset=UTF-8");
- response.setHeader("Cache-Control", "no-cache");
- PrintWriter out=null;
- System.out.println("--------------------------");
- System.out.println(coursetime+"---"+courseweek+"---"+classroom);
- out=response.getWriter();
- if(coursePlanService.ajaxGetCoursePlan(coursetime,courseweek,classroom) != null){
- out.println("此功能排重正在开发中.....");
- }else {
- out.println("此功能排重正在开发中.....");
- }
- out.flush();
- out.close();
-
- }
-
- }
- package net.fuzui.StudentInfo.handler;
-
- import java.util.ArrayList;
- import java.util.List;
-
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpSession;
-
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.Model;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.SessionAttributes;
-
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
-
- import net.fuzui.StudentInfo.pojo.Course;
- import net.fuzui.StudentInfo.pojo.Teacher;
- import net.fuzui.StudentInfo.service.CourseService;
-
- @Controller
- @RequestMapping("/CourseHandler")
- @SessionAttributes("courseList")
- public class CourseHandler {
- @Autowired
- CourseService courseService;
-
- // 添加课程
- @RequestMapping("/addCourse")
- public String addCourse(Course course, Model model) {
-
-
- if (courseService.insertCourse(course) != 0) {
- model.addAttribute("course", course);
- return "success";
- } else {
- return "fail";
- }
- }
-
- public void pageIn(Model model,List list) {
- PageInfo page = new PageInfo(list, 5);
- model.addAttribute("pageInfo", page);
- }
-
- public void queryCou(HttpServletRequest request) {
- List<Course> courseList = new ArrayList<Course>();
- courseList = courseService.selectCourseBySql(1,10);
- request.setAttribute("courseList", courseList);
- }
-
- // 查询课程
- @RequestMapping(value = "/query/{pn}", method = RequestMethod.GET)
- public String redirect(@RequestParam("serc") String serc, @RequestParam("condition") String condition,
- HttpServletRequest request,@PathVariable(value = "pn") String pn,Model model) {
-
- int no = Integer.parseInt(pn);
- List<Course> courseList = new ArrayList<Course>();
- PageHelper.startPage(no, 5);
- request.setAttribute("serc", serc);
- request.setAttribute("condition", condition);
-
-
- if (serc.equals("all")) {
-
-
- courseList = courseService.selectCourseBySql(1,10);
- pageIn(model, courseList);
- request.setAttribute("courseList", courseList);
- System.out.println(courseList);
- return "admin/queryCourse";
-
- } else if (serc.equals("sid")) {
-
- courseList = courseService.getByCourseCid(1,10,condition);
- pageIn(model, courseList);
- request.setAttribute("courseList", courseList);
- System.out.println("sid");
-
- return "admin/queryCourse";
-
- } else if (serc.equals("nam")) {
- courseList = courseService.getByCourseCname(1,10,condition);
- pageIn(model, courseList);
- request.setAttribute("courseList", courseList);
- System.out.println(courseList);
- System.out.println("cla");
- return "admin/queryCourse";
-
- } else if (serc.equals("col")) {
- courseList = courseService.getByCourseCol(1,10,condition);
- pageIn(model, courseList);
- request.setAttribute("courseList", courseList);
- System.out.println(courseList);
- System.out.println("col");
- return "admin/queryCourse";
-
- } else if (serc.equals("type")) {
- courseList = courseService.getByCourseType(1,10,condition);
- pageIn(model, courseList);
- request.setAttribute("courseList", courseList);
- System.out.println(courseList);
- System.out.println("pro");
- return "admin/queryCourse";
-
- } else {
-
- courseList = courseService.selectCourseBySql(1,10);
- pageIn(model, courseList);
- request.setAttribute("courseList", courseList);
- return "admin/queryCourse";
-
- }
-
- }
-
- //删除学生
- @RequestMapping(value = "/delete/{cid}", method = RequestMethod.GET)
- public String deleteStudent(@PathVariable(value = "cid") String cid, HttpServletRequest request) {
-
-
- if (courseService.deleteCourse(cid) != 0) {
- System.out.println("success");
- queryCou(request);
- return "success";
- } else {
- System.out.println("fail");
- return "fail";
- }
-
- }
-
- //跳转到queryCourse页面
- @RequestMapping(value = "/finalPage", method = RequestMethod.GET)
- public String finalPage(HttpSession httpSession,HttpServletRequest request) {
- Object admin = request.getSession().getAttribute("courseList");
- System.out.println(admin+"111111111111111111111111111111111111111111111111111111111111111111111111111");
- return "admin/queryCourse";
- }
-
- /**
- * 修改课程定位
- * @param cid
- * @param model
- * @return
- */
- @RequestMapping(value = "/moditystu/{cid}", method = RequestMethod.GET)
- public String editPre(@PathVariable("cid") String cid, HttpServletRequest request) {
-
-
- List<Course> courseList = new ArrayList<Course>();
- courseList = courseService.getByCourseCid(1,10,cid);
- request.setAttribute("courseList", courseList);
-
- return "admin/modiCourse";
- }
-
- //修改课程信息
- @RequestMapping(value = "/moditystud/{cid}", method = RequestMethod.GET)
- public String update(@PathVariable("cid") String cid, Course course, Model model) {
-
- if (courseService.modifyCourse(course) != 0) {
- return "success";
- } else {
- return "fail";
- }
- }
-
-
- //跳转到queryCourse页面
- @RequestMapping("/managecou/{pn}")
- public String manageCourse(HttpServletRequest request,@PathVariable(value = "pn") String pn,Model model) {
- int no = Integer.parseInt(pn);
- List<Course> courseList = new ArrayList<Course>();
- PageHelper.startPage(no, 5);
- courseList = courseService.selectCourseBySql(1,10);
- pageIn(model, courseList);
- request.setAttribute("courseList", courseList);
- return "admin/queryCourse";
- }
- }
-
如果也想学习本系统,下面领取。关注并回复:099ssm
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。