package com.example.demo.controller;
import com.example.demo.mapper.*;
import com.example.demo.model.*;
import com.example.demo.service.CourseService;
import com.example.demo.service.GradeService;
import lombok.extern.flogger.Flogger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.awt.image.FilteredImageSource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Controller
@RequestMapping("/home")
public class HomeController {
@Resource
public MethodMapper methodMapper;
@Resource
public CoursesMapper coursesMapper;
@Resource
public StudentsMapper StudentsMapper;
@Resource
public CourseService courseService;
@Resource
public StudentsMapper studentsMapper;
@Resource
public TeachersMapper teachersMapper;
@Resource
public TeachcourseMapper teachcourseMapper;
@Resource
public GradeService gradeService;
@GetMapping("")
public String Home(HttpSession session, Model model) {
Account account = (Account) session.getAttribute("account");
if (account == null) {
return "redirect:/";
}
String type = account.getType();
int typeCode = Integer.parseInt(type);
model.addAttribute("typeCode", typeCode);
//学生
String studentId = account.getAccountid();
List<Stucourse> stucourseList = methodMapper.SelectByStudentId(studentId);
List<Grade> gradeList = new ArrayList<>();
Grade grade;
for (Stucourse s : stucourseList) {
if (s.getGrade().equals("0")) {
continue;
}
grade = new Grade();
Courses courses = coursesMapper.selectByPrimaryKey(s.getCourseid());
grade.setCourseId(courses.getCourseid());
grade.setCourseName(courses.getCoursename());
Teachcourse teachcourse = methodMapper.selectTeachCourse(s.getCourseid());
Teachers teachers = teachersMapper.selectByPrimaryKey(teachcourse.getTeacherid());
grade.setTeacherName(teachers.getName());
grade.setGrade(s.getGrade());
gradeList.add(grade);
}
model.addAttribute("gradeList", gradeList);
//教师
String teacherId = account.getAccountid();
List<Teachcourse> teachcourseList = methodMapper.selectTeachCourseList(teacherId);
Teachers teachers = teachersMapper.selectByPrimaryKey(teacherId);
List<TeacherCourseList> teacherCourseListArrayList = new ArrayList<>();
for (Teachcourse teachcourse : teachcourseList) {
TeacherCourseList teacherCourseList = new TeacherCourseList();
Courses courses = coursesMapper.selectByPrimaryKey(teachcourse.getCourseid());
teacherCourseList.setCourseid(teachcourse.getCourseid());
teacherCourseList.setCourseName(courses.getCoursename());
teacherCourseList.setTeacherid(teachcourse.getTeacherid());
teacherCourseList.setTeacherName(teachers.getName());
teacherCourseList.setCourseroom(teachcourse.getCourseroom());
teacherCourseList.setCoursedate(teachcourse.getCoursedate());
List<Stucourse> stucourseList1 = methodMapper.selectStuCourseById(teachcourse.getCourseid());
teacherCourseList.setSum(String.valueOf(stucourseList1.size()));
teacherCourseList.setTerm(teachcourse.getTerm());
teacherCourseListArrayList.add(teacherCourseList);
}
model.addAttribute("teacherCourseListArrayList", teacherCourseListArrayList);
return "home";
}
//学生
@GetMapping("/studentInfo")
public String studentInfo(HttpSession session, Model model) {
Account account = (Account) session.getAttribute("account");
if (account == null) {
return "redirect:/";
}
Students students = StudentsMapper.selectByPrimaryKey(account.getAccountid());
model.addAttribute(students);
return "studentInfo";
}
@PostMapping("/studentInfo")
public String studentInfo(HttpSession session, Model model, String password, String political) {
Account account = (Account) session.getAttribute("account");
String studentId = account.getAccountid();
Students students = StudentsMapper.selectByPrimaryKey(studentId);
if (password.equals("") && political.equals("")) {
methodMapper.updateStudentInfo(studentId, students.getPassword(), students.getPolitical());
}
if (political.equals("") && !password.equals("")) {
methodMapper.updateAccountPassword(studentId, password);
methodMapper.updateStudentInfo(studentId, password, students.getPolitical());
}
if (!political.equals("") && password.equals("")) {
methodMapper.updateStudentInfo(studentId, students.getPassword(), political);
}
if (!political.equals("") && !password.equals("")) {
methodMapper.updateAccountPassword(studentId, password);
methodMapper.updateStudentInfo(studentId, password, political);
}
model.addAttribute(students);
return "redirect:/home/studentInfo";
}
//教师
@GetMapping("/couresManagement")
public String couresManagement(HttpSession session, Model model) {
Account account = (Account) session.getAttribute("account");
String teacherId = account.getAccountid();
List<Teachcourse> teachcourseList = methodMapper.selectTeachCourseList(teacherId);
Teachers teachers = teachersMapper.selectByPrimaryKey(teacherId);
List<TeacherCourseList> teacherCourseListArrayList = new ArrayList<>();
for (Teachcourse teachcourse : teachcourseList) {
TeacherCourseList teacherCourseList = new TeacherCourseList();
Courses courses = coursesMapper.selectByPrimaryKey(teachcourse.getCourseid());
teacherCourseList.setCourseid(teachcourse.getCourseid());
teacherCourseList.setCourseName(courses.getCoursename());
teacherCourseList.setTeacherid(teachcourse.getTeacherid());
teacherCourseList.setTeacherName(teachers.getName());
teacherCourseList.setCourseroom(teachcourse.getCourseroom());
teacherCourseList.setCoursedate(teachcourse.getCoursedate());
List<Stucourse> stucourseList1 = methodMapper.selectStuCourseById(teachcourse.getCourseid());
teacherCourseList.setSum(String.valueOf(stucourseList1.size()));
teacherCourseList.setTerm(teachcourse.getTerm());
teacherCourseListArrayList.add(teacherCourseList);
}
model.addAttribute("teacherCourseListArrayList", teacherCourseListArrayList);
return "couresManagement";
}
@PostMapping("/couresManagement")
public String couresManagement(HttpSession session, String term, Model model) {
Account account = (Account) session.getAttribute("account");
String teacherId = account.getAccountid();
List<Teachcourse> teachcourseList = methodMapper.selectTeachCourseList(teacherId);
Teachers teachers = teachersMapper.selectByPrimaryKey(teacherId);
List<TeacherCourseList> teacherCourseListArrayList = new ArrayList<>();
for (Teachcourse teachcourse : teachcourseList) {
if (teachcourse.getTerm().equals(term)) {
TeacherCourseList teacherCourseList = new TeacherCourseList();
Courses courses = coursesMapper.selectByPrimaryKey(teachcourse.getCourseid());
teacherCourseList.setCourseid(teachcourse.getCourseid());
teacherCourseList.setCourseName(courses.getCour
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于Springboot+Mybatis+Mysql 实现的成绩管理系统 基于Springboot+Mybatis+Mysql 实现的成绩管理系统 基于Springboot+Mybatis+Mysql 实现的成绩管理系统 基于Springboot+Mybatis+Mysql 实现的成绩管理系统 基于Springboot+Mybatis+Mysql 实现的成绩管理系统 基于Springboot+Mybatis+Mysql 实现的成绩管理系统 基于Springboot+Mybatis+Mysql 实现的成绩管理系统 基于Springboot+Mybatis+Mysql 实现的成绩管理系统 基于Springboot+Mybatis+Mysql 实现的成绩管理系统 基于Springboot+Mybatis+Mysql 实现的成绩管理系统 基于Springboot+Mybatis+Mysql 实现的成绩管理系统 基于Springboot+Mybatis+Mysql 实现的成绩管理系统 基于Springboot+Mybatis+Mysql 实现的成绩管理系统 基于Springboot+Mybati
资源推荐
资源详情
资源评论
收起资源包目录
基于Springboot+Mybatis+Mysql 实现的成绩管理系统.zip (489个子文件)
AUTHORS 6KB
mvnw.cmd 6KB
bootstrap.css 194KB
bootstrap.min.css 157KB
editormd.css 80KB
editormd.min.css 74KB
bootstrap-grid.css 66KB
editormd.preview.css 58KB
bootstrap-grid.min.css 50KB
editormd.preview.min.css 44KB
ambiance.css 26KB
bootstrap-theme.css 26KB
bootstrap-theme.min.css 23KB
codemirror.css 9KB
codemirror.min.css 5KB
solarized.css 5KB
mdn-like.css 5KB
bootstrap-reboot.css 5KB
bootstrap-reboot.min.css 4KB
merge.css 3KB
lint.css 3KB
xq-dark.css 3KB
lesser-dark.css 3KB
pastel-on-dark.css 2KB
xq-light.css 2KB
tomorrow-night-eighties.css 2KB
zenburn.css 2KB
erlang-dark.css 2KB
editormd.logo.css 2KB
twilight.css 2KB
mbo.css 2KB
midnight.css 2KB
vibrant-ink.css 2KB
base16-dark.css 2KB
base16-light.css 2KB
tern.css 2KB
3024-night.css 2KB
paraiso-dark.css 2KB
paraiso-light.css 2KB
tomorrow-night-bright.css 2KB
3024-day.css 2KB
blackboard.css 2KB
the-matrix.css 2KB
OneCommunity.css 2KB
colorforth.css 2KB
night.css 2KB
rubyblue.css 2KB
monokai.css 2KB
dashboard.css 2KB
editormd.logo.min.css 2KB
cobalt.css 2KB
login.css 2KB
simplescrollbars.css 1KB
eclipse.css 1KB
neo.css 1KB
elegant.css 872B
neat.css 782B
show-hint.css 723B
dialog.css 542B
tiki.css 471B
foldgutter.css 457B
tiddlywiki.css 235B
matchesonscrollbar.css 200B
fullscreen.css 136B
ambiance-mobile.css 109B
fontawesome-webfont.eot 59KB
glyphicons-halflings-regular.eot 20KB
editormd-logo.eot 1KB
.gitignore 395B
scala.html 28KB
index.html 22KB
modifyCourseInfo.html 21KB
modifyStuInfo.html 20KB
ModifyTeacherInfo.html 18KB
index.html 17KB
index.html 16KB
addStuInfo.html 16KB
StudentInfoManagement.html 15KB
addCourse.html 15KB
courseManagement.html 15KB
addTeacherInfo.html 14KB
home.html 14KB
teacherInfoManagement.html 14KB
teacherModifyCourseInfo.html 14KB
gradeManagement.html 13KB
upLoadGrade.html 13KB
index.html 13KB
studentInfo.html 13KB
index.html 13KB
couresManagement.html 12KB
teacherInfo.html 12KB
index.html 12KB
details.html 12KB
upLoadTeacherInfo.html 11KB
upLoadStuInfo.html 11KB
teacherGradeManagement.html 11KB
index.html 11KB
index.html 10KB
index.html 8KB
index.html 8KB
共 489 条
- 1
- 2
- 3
- 4
- 5
资源评论
辣椒种子
- 粉丝: 3720
- 资源: 5717
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功