基于SSM实现的评教系统

简介: 基于SSM实现的评教系统

项目编号:BS-GX-014


数据库:mysql


开发工具:IDEA / ECLIPSE


开发技术:SSM 框架


本系统基于SSM框架实现。主要包含三个角色,管理员,老师,学生。管理员主要管理学生,老师,课程。学生可以进行选课,选完课后可以对任课老师评价。老师可以查看自己的评价信息。


部分展示功能如下:


  管理员角色:

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

学生角色:

image.png

image.png

image.png

image.png

老师角色:

image.png

image.png

image.png

本项目功能完整,运行无误,适合做毕业设计使用,如有需要,请联系作者。

部分核心代码:

package one.controller;
import java.util.List;  
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import one.domain.Admin;
import one.domain.Curriculum;
import one.domain.Evaluate;
import one.domain.PageBean;
import one.domain.Student;
import one.domain.Teacher;
import one.service.AdminService;
import one.service.CurriculumService;
import one.service.ManyTableService;
import one.service.StudentService;
import one.service.TeacherService;
import one.vo.Details;
import one.vo.ManyTable;
import one.vo.Tea_Curri;
@Controller
public class AdminController {
  @Resource(name="manyTableServiceImpl")
  private ManyTableService mts;
  @Resource(name="studentServiceImpl")
  private StudentService stus;
  @Resource(name="teacherServiceImpl")
  private TeacherService teas;
  @Resource(name="adminServiceImpl")
  private AdminService adms;
  @Resource(name="curriculumServiceImpl")
  private CurriculumService curs;
  @RequestMapping("/seetea")
  public String seetea(Model model) throws Exception{
    List<Tea_Curri> listtea_curri = mts.gettea_curri();
    model.addAttribute("listtea_curri", listtea_curri);
    return "admin/seetea.jsp";  
  }
  @RequestMapping("/seedetails")
  public String seedetails(int cid,Model model) throws Exception{
    List<Details> listdetails = mts.getdetails(cid);
    int sum=0;
    int flag=0;
    for(Details det:listdetails){
      if(det.getEscore()==null){
        continue;
      }
      sum+=det.getEscore();
      flag++;
    }
    if(flag==0){
      return  "pjnotfinish.jsp";
    }
    double avg=sum/flag;
    int b=(int) (avg/10);
    String grade;
    switch(b){
    case 10:grade="非常优秀";break;
    case 9:grade="优秀";break;
    case 8:grade="良好";break;
    case 7:grade="中等";break;
    case 6:grade="及格";break;
    default:grade="不合格";
    }
    model.addAttribute("grade", grade);
    model.addAttribute("avg", avg);
    model.addAttribute("listdetails", listdetails);
    return "admin/details.jsp";
  }
  @RequestMapping("/viewstu")
  public String viewstu(Model model,int currPage) throws Exception{
    int pageSize=5;
    int count = stus.getcount();
    int totalPage=(int) Math.ceil((count*1.0/pageSize));
    if(currPage<=0){
      currPage=1;
    }
    if(currPage>=totalPage){
      currPage=totalPage;
    }
    PageBean<Student> pb = stus.getfenyestu(currPage, pageSize);
//    List<Student> listallstu = stus.getallstu();
    List<Student> liststu = pb.getList();
    model.addAttribute("pb", pb);
    model.addAttribute("liststu", liststu);
    return "admin/viewstu.jsp";
  }
  @RequestMapping("/viewtea")
  public String viewtea(Model model,int currPage) throws Exception{
    int pageSize=5;
    int count = teas.getcount();
    int totalPage=(int) Math.ceil((count*1.0/pageSize));
    if(currPage<=0){
      currPage=1;
    }
    if(currPage>=totalPage){
      currPage=totalPage;
    }
    PageBean<Teacher> pb = teas.getfenyetea(currPage, pageSize);
//    List<Teacher> listalltea = teas.getalltea();
    List<Teacher> listtea = pb.getList();
    model.addAttribute("pb", pb);
    model.addAttribute("listtea",listtea);
    return "admin/viewtea.jsp";
  }
  @RequestMapping("/addstu")
  public String viewtea(Student stu,Model model) throws Exception{
    Student getstu = stus.getstu(stu.getSid());
    if(getstu==null){
      stus.insertstu(stu);
      model.addAttribute("succ", "添加成功");
    }else{
      model.addAttribute("err", "已存在该编号的学生");
    }
    return "admin/addstu.jsp";
  }
  @RequestMapping("/addtea")
  public String viewtea(Teacher tea,Model model) throws Exception{
    Teacher gettea = teas.gettea(tea.getTid());
    if(gettea==null){
      teas.inserttea(tea);
      model.addAttribute("succ", "添加成功");
    }else{
      model.addAttribute("err", "已存在该编号的教师");
    }
    return "admin/addtea.jsp";
  }
  //点击查看课程
  @RequestMapping("viewcurri")
  public String viewcurri(Model model,int currPage) throws Exception{
    int pageSize=10;
    int count = curs.getcount();
    int totalPage=(int) Math.ceil((count*1.0/pageSize));
    if(currPage<=0){
      currPage=1;
    }
    if(currPage>=totalPage){
      currPage=totalPage;
    }
    PageBean<Curriculum> pb = curs.getfenyecur(currPage, pageSize);
    List<Curriculum> listcur = pb.getList();
    model.addAttribute("pb", pb);
    model.addAttribute("listcur",listcur);
    return "admin/viewcurri.jsp";
  }
  //修改密码,点击提交
    @RequestMapping("/admuppwd")
    public String uppwd(String oldpwd,String newpwd,HttpServletRequest request,Model model)throws Exception{
      HttpSession session = request.getSession();
      Admin adm=(Admin) session.getAttribute("adm");
      if(adm.getApassword().equals(oldpwd)){
        adm.setApassword(newpwd);
        adms.uppwd(adm);
      }else{
        model.addAttribute("pwderr","你的原始密码有误");
        return "admin/updatepwd.jsp";
      }
      return "admin/uppwdsuccess.jsp";
    }
  //点击添加课程功能
    @RequestMapping("addcurri")
    public String addcurri(Model model) throws Exception{
      List<Teacher> listalltea = teas.getalltea();
      model.addAttribute("listtea",listalltea);
      return "admin/addcurri.jsp";
    }
  //填写课程信息后,点击提交
    @RequestMapping("submitcurri")
    public String submitcurri(Curriculum cur,Model model) throws Exception{
      Curriculum curri = curs.getbyid(cur.getCid());
      if(curri==null){
        curs.addcur(cur);
        model.addAttribute("succ", "添加成功");
      }else{
        model.addAttribute("err", "该编号的课程已存在");
      }
      List<Teacher> listalltea = teas.getalltea();
      model.addAttribute("listtea",listalltea);
      return "admin/addcurri.jsp";
    }
    //点击学生选课
    @RequestMapping("stuselectcur")
    public String stuselectcur(Model model,int currPage)throws Exception{
      int pageSize=10;
      int count = stus.getcount();
      int totalPage=(int) Math.ceil((count*1.0/pageSize));
      if(currPage<=0){
        currPage=1;
      }
      if(currPage>=totalPage){
        currPage=totalPage;
      }
      PageBean<Student> pb = stus.getfenyestu(currPage, pageSize);
//      List<Student> listallstu = stus.getallstu();
      List<Student> liststu = pb.getList();
      model.addAttribute("pb", pb);
      model.addAttribute("liststu", liststu);
      return "admin/stuselectcur.jsp";
    }
    //点击教师任课
    @RequestMapping("teaselectcur")
    public String teaselectcur(Model model,int currPage)throws Exception{
      int pageSize=10;
      int count = teas.getcount();
      int totalPage=(int) Math.ceil((count*1.0/pageSize));
      if(currPage<=0){
        currPage=1;
      }
      if(currPage>=totalPage){
        currPage=totalPage;
      }
      PageBean<Teacher> pb = teas.getfenyetea(currPage, pageSize);
      List<Teacher> listalltea = pb.getList();
      model.addAttribute("pb", pb);
      model.addAttribute("listtea",listalltea);
      return "admin/teaselectcur.jsp";
    }
    //点击选课详情
    @RequestMapping("selectcurdetails")
    public String selectcurdetails(Model model,String ssid,String sname)throws Exception{
      List<ManyTable> liststu_curbystuid = mts.getstu_curbystuid(ssid);
      if(liststu_curbystuid.size()==0){
        model.addAttribute("sname", sname);
        return "admin/noselectcur.jsp";
      }
      model.addAttribute("liststu_curbystuid", liststu_curbystuid);
      model.addAttribute("sname", sname);
      return "admin/stucurdetails.jsp";
    }
    //点击教师任课详情
    @RequestMapping("teacurdetails")
    public String teacurdetails(Model model,String tid,String tname)throws Exception{
      List<Curriculum> listcurbytid = curs.getcurbytid(tid);
      if(listcurbytid.size()==0){
        model.addAttribute("tname", tname);
        return "admin/teanocur.jsp";
      }
      model.addAttribute("listcurbytid", listcurbytid);
      model.addAttribute("tname", tname);
      model.addAttribute("tid", tid);
      return "admin/teacurdetails.jsp";
    }
    //修改学生信息
    @RequestMapping("updatestu")
    public String updatestu(Student stu,Model model)throws Exception{
      stus.updatestu(stu);
      List<Student> listallstu = stus.getallstu();
      model.addAttribute("liststu", listallstu);
      return "/viewstu?currPage=1";
    }
    //修改教师信息
    @RequestMapping("updatetea")
    public String updatetea(Teacher tea,Model model)throws Exception{
      teas.updatetea(tea);
      List<Teacher> listalltea = teas.getalltea();
      model.addAttribute("listtea",listalltea);
      return "/viewtea?currPage=1";
    }
    //删除学生
    @RequestMapping("/delstu")
    public String  delstu(HttpServletRequest request)throws Exception{
      String sid = request.getParameter("sid");
      stus.delstu(sid);
      return "/viewstu?currPage=1";
    }
    //删除老师
    @RequestMapping("/deltea")
    public String deltea(String tid)throws Exception{
      teas.deltea(tid);
      return "/viewtea?currPage=1";
    }
    //删除课程
    @RequestMapping("/deletecurriculumbyid")
    public String deletecurriculumbyid(int cid)throws Exception{
      curs.deletecur(cid);
      return "/viewcurri?currPage=1"; 
    }
    //点击修改课程
    @RequestMapping("/updatecurr")
    public String updatecurr(Model model)throws Exception{
      List<Teacher> listalltea = teas.getalltea();
      model.addAttribute("listtea",listalltea);
      return "admin/updatecurr.jsp";
    }
    //课程里点击确认修改
    @RequestMapping("/querenxiugai")
    public String querenxiugai(Model model,Curriculum curr){
      curs.querenxiugai(curr);
      return "viewcurri?currPage=1";
    }
    //按姓名查询学生
    @RequestMapping("/nameselect")
    public String nameselect(String name,Model model)throws Exception{
      List<Student> liststu = stus.findbyname(name);
      if(liststu.size()==0){
        return "admin/NewFile1.jsp";
      }
      model.addAttribute("liststu", liststu);
      return "admin/NewFile2.jsp";  
    }
    //按姓名查询老师
        @RequestMapping("/tnameselect")
        public String tnameselect(String name,Model model)throws Exception{
          List<Teacher> listtea = teas.findteabyname(name);
          if(listtea.size()==0){
            return "admin/NewFile3.jsp";
          }
          model.addAttribute("listtea", listtea);
          return "admin/NewFile4.jsp";  
        }
}
package one.controller;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import one.domain.Curriculum;
import one.domain.Evaluate;
import one.domain.Student;
import one.domain.Studentandcurriculum;
import one.service.CurriculumService;
import one.service.EvaluateService;
import one.service.ManyTableService;
import one.service.StudentService;
import one.vo.ManyTable;
@Controller
public class StudentController {
  @Resource(name="studentServiceImpl")
  private StudentService stus;
  @Resource(name="curriculumServiceImpl")
  private CurriculumService curs;
  @Resource(name="evaluateServiceImpl")
  private EvaluateService evaService;
  //修改密码,点击提交
  @RequestMapping("/stuuppwd")
  public String uppwd(String oldpwd,String newpwd,HttpServletRequest request,Model model)throws Exception{
    HttpSession session = request.getSession();
    Student stu=(Student) session.getAttribute("stu");
    if(stu.getSpassword().equals(oldpwd)){
      stu.setSpassword(newpwd);
      stus.uppwd(stu);
    }else{
      model.addAttribute("pwderr","你的原始密码有误");
      return "student/updatepwd.jsp";
    }
    return "student/uppwdsuccess.jsp";
  }
  //学生点击进行评教
  @RequestMapping("/aa")
  public String allpj(HttpServletRequest request,Model model) throws Exception{
    HttpSession session = request.getSession();
    Student stu = (Student) session.getAttribute("stu");
    List<ManyTable> listpj =  mts.getall(stu.getSid());
    if(listpj.size()==0){
      return "student/nocurr.jsp";
    }else{
    model.addAttribute("listpj", listpj);
    return "student/allpingjiao.jsp"; 
    }
  }
  @Resource(name="manyTableServiceImpl")
  private ManyTableService mts;
  @Resource(name="evaluateServiceImpl")
  private EvaluateService evas;
  //学生提交评教
  @RequestMapping("/subpj")
  public String subpj(HttpServletRequest request,int eid,String advise,Model model)throws Exception{
    int  a = Integer.parseInt(request.getParameter("1"));
    int  b = Integer.parseInt(request.getParameter("2"));
    int  c = Integer.parseInt(request.getParameter("3"));
    int  d = Integer.parseInt(request.getParameter("4"));
    int  e = Integer.parseInt(request.getParameter("5"));
    int  f = Integer.parseInt(request.getParameter("6"));
    int  g = Integer.parseInt(request.getParameter("7"));
    int  h = Integer.parseInt(request.getParameter("8"));
    int  i = Integer.parseInt(request.getParameter("9"));
    int  j = Integer.parseInt(request.getParameter("10"));
    int sum=a+b+c+d+e+f+g+h+i+j;
    if(advise==""){
      advise=null;
    }
    Date date=new Date();
    Evaluate eva=new Evaluate();
    eva.setEid(eid);
    eva.setEscore(sum);
    eva.setEcomment(advise);
    eva.setEdate(date);
    evas.uppj(eva);
    HttpSession session = request.getSession();
    Student stu = (Student) session.getAttribute("stu");
    List<ManyTable> listpj =  mts.getall(stu.getSid());
    model.addAttribute("listpj", listpj);
    return "student/allpingjiao.jsp";
  }
  //点击添加选课
  @RequestMapping("addmycur")
  public String addmycur(Model model)throws Exception{
    List<Curriculum> listallcur = curs.getallcur();
    model.addAttribute("listallcur", listallcur);
    return "student/addmycur.jsp";
  }
  @RequestMapping("stuaddcur")
  public String stuaddcur(HttpSession session,Model model,int scid ) throws Exception{
    Student stu = (Student) session.getAttribute("stu");
    Studentandcurriculum stucur=new Studentandcurriculum();
    stucur.setScid(scid);
    System.out.println(stu.getSid());
    stucur.setSsid(stu.getSid());
    Studentandcurriculum myselect = stus.findmyselect(stucur);
    if(myselect==null){
      stus.stuaddcur(stucur);
      Evaluate eva=new Evaluate();
      eva.setEsid(stucur.getSsid());
      eva.setEcid(stucur.getScid());
      evaService.addstuselect(eva);
      model.addAttribute("succ", "添加选课成功!");
    }else{
      model.addAttribute("err", "你已经选了该课程!");
    }
    List<Curriculum> listallcur = curs.getallcur();
    model.addAttribute("listallcur", listallcur);
    return "student/addmycur.jsp";
  }
}
相关文章
|
4月前
|
Java 数据库连接 Maven
手把手教你如何搭建SSM框架、图书商城系统案例
这篇文章是关于如何搭建SSM框架以及实现一个图书商城系统的详细教程,包括了项目的配置文件整合、依赖管理、项目结构和运行效果展示,并提供了GitHub源码链接。
手把手教你如何搭建SSM框架、图书商城系统案例
|
3月前
|
Java 应用服务中间件 数据库连接
ssm项目整合,简单的用户管理系统
文章介绍了一个使用SSM框架(Spring、SpringMVC、MyBatis)构建的简单用户管理系统的整合过程,包括项目搭建、数据库配置、各层代码实现以及视图展示。
ssm项目整合,简单的用户管理系统
|
3月前
|
XML Java 数据库连接
如何搭建SSM框架、图书商城系统
这是一份详尽的《Spring + SpringMVC + Mybatis 整合指南》,作者耗时良久整理出约五万字的内容,现已经全部笔记公开。此文档详细地介绍了如何搭建与整合SSM框架,具体步骤包括创建Maven项目、添加web骨架、配置pom文件以及整合Spring、SpringMVC和Mybatis等。无论是对初学者还是有一定基础的开发者来说,都是很好的学习资源。此外,作者还提供了项目源码的GitHub链接,方便读者实践。虽然当前主流推荐学习SpringBoot,但了解SSM框架仍然是不可或缺的基础。
45 0
|
4月前
|
SQL Java 应用服务中间件
使用SSM搭建图书商城管理系统(完整过程介绍、售后服务哈哈哈)
这篇文章是关于如何使用SSM框架搭建图书商城管理系统的教程,包括完整过程介绍、常见问题解答和售后服务,提供了项目地址、运行环境配置、效果图展示以及运行代码的步骤。
使用SSM搭建图书商城管理系统(完整过程介绍、售后服务哈哈哈)
|
5月前
|
存储 关系型数据库 测试技术
基于ssm+vue的校园驿站管理系统+(源码+部署说明+演示视频+源码介绍)(2)
基于ssm+vue的校园驿站管理系统+(源码+部署说明+演示视频+源码介绍)
78 1
|
6月前
|
前端开发
杨校老师之基于SSM开发的校园点餐配送系统
杨校老师之基于SSM开发的校园点餐配送系统
65 0
杨校老师之基于SSM开发的校园点餐配送系统
|
5月前
|
安全 数据挖掘 测试技术
基于SSM+Vue的家居商城系统(源码+部署说明+演示视频)(2)
基于SSM+Vue的家居商城系统(源码+部署说明+演示视频)
80 0
|
5月前
|
Java 关系型数据库 MySQL
基于SSM+Vue的家居商城系统(源码+部署说明+演示视频)(1)
基于SSM+Vue的家居商城系统(源码+部署说明+演示视频)
76 0
|
5月前
|
Java 关系型数据库 测试技术
基于ssm+vue的校园驿站管理系统+(源码+部署说明+演示视频+源码介绍)(1)
基于ssm+vue的校园驿站管理系统+(源码+部署说明+演示视频+源码介绍)
66 0
|
6月前
|
前端开发 Java 关系型数据库
杨校老师项目之基于SSM企业物流快递配送管理系统
杨校老师项目之基于SSM企业物流快递配送管理系统
56 0