项目简介
该项目是一个简单的教务查询系统,分别授予管理员,教师,学生不同的权限,达到基本的数据查询与修改操作。
管理员主要功能:
课程管理、学生管理、教师管理;
教师主要功能:
查看我教授的课程列表、查看学生成绩列表、给学生打分;
学生主要功能:
查看所有课程列表、选课、查看所修课程等;
环境需要
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.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 5.7版本;
使用技术
IOC容器:Spring
Web框架:SpringMVC ORM框架:Mybatis 安全框架:Shiro
数据源:C3P0 日志:log4j
前端框架:Bootstrap
使用说明
-
使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,下载所需jar包;
-
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
-
将项目中mysql.properties配置文件中的数据库配置改为自己的配置
-
配置tomcat,然后运行项目,输入localhost:8080/xxx 登录
-
管理员账户:admin 密码:123
教师账号:1001 密码:123
学生账号:10001 密码:123
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
}
String fileName = file.getName();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
String encodeFilename = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());
headers.setContentDispositionFormData("attachment", encodeFilename);
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),
headers, HttpStatus.CREATED);
}
return null;
}
//学期述职
@PostMapping("/upload_term_debriefing")
@ResponseBody
public Msg fun9(String year, String term, String teachingTask, String scientificResearch,
String otherWork, String winAward, String summary, HttpSession httpSession) {
Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
DebriefingWithBLOBs debriefingWithBLOBs = new DebriefingWithBLOBs();
debriefingWithBLOBs.setIdTeacher(teacher.getId());
debriefingWithBLOBs.setYear(Long.parseLong(year));
debriefingWithBLOBs.setTerm(term);
debriefingWithBLOBs.setTeachingtask(teachingTask);
debriefingWithBLOBs.setAchievementsinscientificresearch(scientificResearch);
) {
Teacher teacher = (Teacher) request.getSession().getAttribute("teacherInfo");
// LOGGER.info("{}",workloadDTO);
teacherService.saveWorkload(workloadDTO, teacher);
return Msg.success();
}
// 教师业务表
@GetMapping("/business")
public String businessPage() {
return "teacher/table/business";
}
@GetMapping("/businessData")
@ResponseBody
public Msg businessData(
@RequestParam("year") String year,
@RequestParam("trem") String trem
) {
Teacher teacher = (Teacher) request.getSession().getAttribute("teacherInfo");
return teacherService.getBusiness(teacher.getId(), year, trem)
.add("teacher", teacher);
}
@PostMapping("/business")
@ResponseBody
if(!(password.charAt(i)>='A' && password.charAt(i)<='Z')){
if(!(password.charAt(i)>='a' && password.charAt(i)<='z')){
if(!(password.charAt(i)>='0' && password.charAt(i)<='9')){
return false;
}
}
}
}
return true;
}
//退出
//清除Session数据
@RequestMapping("/exit")
public String exit(HttpServletResponse response,HttpSession httpSession) {
// httpSession.setAttribute("XZproject", null);
// 清除Session
Enumeration em = request.getSession().getAttributeNames();
while(em.hasMoreElements()){
request.getSession().removeAttribute(em.nextElement().toString());
}
@ResponseBody
@PostMapping("/specialty")
public Msg postSpecialty(
@RequestBody @Validated({Add.class}) Specialty specialty,
@ModelAttribute("id_institute") long id_institute
) throws MyException {
return Msg.sqlChange((int) specialtyService.postSpecialty(specialty, id_institute));
}
// 班级
@GetMapping("/ClassManagement")
public String Class() {
return "admin/Department/ClassManagement";
// //获取管理员的 学院id
// public static Long getIdInstitute(ModelMap modelMap) {
// Subadmin subadmin = (Subadmin) modelMap.get("admin");
// return subadmin.getIdInstitute();
// }
}
@ResponseBody
@GetMapping("/classes")
public Msg getClasses(
@RequestParam("offset") Integer offset,
@RequestParam(required = false) Long specialtyId,
@RequestParam(required = false) String keyWord,
@ModelAttribute("id_institute") long id_institute) {
long total = classService.getClassesCount(offset, keyWord, specialtyId, id_institute);
return Msg.sqlChange(subjectService.updateSubjectType(type));
}
//课题管理
@GetMapping("/SubjectManagement")
public String Subject() {
return "admin/Subject/SubjectManagement";
}
@ResponseBody
@GetMapping("/subjects")
public Msg getSubjects(
@RequestParam Integer offset,
@RequestParam(required = false) Long sectionId,
@RequestParam(required = false) String keyWord,
@ModelAttribute("id_institute") long id_institute) {
long total = subjectService.selectSubjectsCount(offset, keyWord, sectionId, id_institute);
}
//查询已提交教师出差申请
@GetMapping("/select_work_submitted")
@ResponseBody
public Msg fun4(HttpSession httpSession) {
TeacherWithBLOBs teacher = (TeacherWithBLOBs) httpSession.getAttribute("teacherInfo");
List<WorkapprovalWithBLOBs> list = teacherService.selectWorkSubmitted(teacher.getId());
return Msg.success().add("workinfo", list);
}
//删除申请失败的教师出差
@PostMapping("/delete_work")
@ResponseBody
public Msg deleteWork(Long id) {
teacherService.deleteWorkById(id);
return Msg.success();
}
//加载报告填写页面
}
@RequestMapping("/index")
public String index(Model model, HttpSession httpSession) {
Student student = (Student) request.getSession().getAttribute("student");
Subject project = indexService.indexinfo(student.getId());
String str = null;
Long flag = null;
if (project == null) {
model.addAttribute("projectName", "未选课题");
model.addAttribute("flag", "未选题");
model.addAttribute("teacher", "无");
httpSession.removeAttribute("");
} else {
httpSession.setAttribute("XZproject", project.getProjectname());
model.addAttribute("XZproject", project.getProjectname());
model.addAttribute("projectName", project.getProjectname());
flag = indexService.projectselectedstuflag(student.getId());
if (flag == 0L) {
str = "未选题";
} else if (flag == 1L) {
str = "选题待审核";
} else if (flag == 2L) {
str = "选题未通过";
} else if (flag == 3L) {
public Msg delStudent(
@RequestBody StudentWithBLOBs student,
@ModelAttribute("id_institute") long id_institute
) throws MyException {
return Msg.sqlChange((int) studentService.delStudent(student, id_institute));
}
@ResponseBody
@PostMapping("/student")
public Msg addStudent(
@RequestBody @Validated(Add.class) StudentWithBLOBs student,
@ModelAttribute("id_institute") long id_institute
) throws MyException {
return Msg.sqlChange((int) studentService.addStudent(student, id_institute));
}
@RequestBody @Validated(Update.class) SubjectWithBLOBs subject,
@ModelAttribute("id_institute") long id_institute) throws MyException {
return Msg.sqlChange(subjectService.updateSuject(subject, id_institute));
}
//get学生选题的状态
@GetMapping("/SRS")
@ResponseBody
public Msg getSelectSubjected(
@ModelAttribute("id_institute") long id_institute
) {
System.out.println(subjectService.getSelectSubjected(null, id_institute));
return Msg.success().add("SRS", subjectService.getSelectSubjected(null, id_institute));
}
//get 选某个课题的所有学生
@GetMapping("/studentsBySubject")
@ResponseBody
public Msg getStuentBySubject(
@RequestParam("id") Long id,
@ModelAttribute("id_institute") long id_institute
) {
return subjectService.getStuentBySubject(id, id_institute);
}
@ResponseBody()
public String cancel(Long project_id, Model model, HttpSession httpSession) {
System.out.println(1);
String projectName = topicsService.selectprojectname(project_id);
Student student = (Student) request.getSession().getAttribute("student");
List<Subjectselected> subjectselected = subjectselectedMapper.selectBystudentid(student.getId());
if (subjectselected != null && subjectselected.size() != 0 && subjectselected.get(0).getStuselectFlag() != 3
&& project_id.equals(subjectselected.get(0).getIdProject())) {
topicsService.deleteprojectselectedid(student.getId());
httpSession.removeAttribute("XZproject");
model.addAttribute("XZproject", null);
httpSession.setAttribute("XZproject", null);
studentService.updateselectnumReduce(projectName);
return "200";
@GetMapping("/select_annualassessment_year_info")
@ResponseBody
public Msg fun18(Long year, HttpSession httpSession) {
Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
AnnualAssessmentWithBLOBs assessment = teacherService.selectAnnualAssessmentInfo(teacher.getId(), year);
return Msg.success().add("assessmentInfo", assessment);
}
//查询度专业技术人员考核表年份
@GetMapping("/select_technical_personnel_year")
@ResponseBody
public Msg fun18(HttpSession httpSession) {
Teacher teacher = (Teacher) httpSession.getAttribute("teacherInfo");
List<TechnicalPersonnel> list = teacherService.selectTechnicalPersonnelByYear(teacher.getId());
if (list.isEmpty()) {
return Msg.fail();
} else {
return Msg.success().add("year", list);