基于java SpringMVC框架学生综合管理系统设计

所用技术

前端:BootStrap、JQuery、HTML+CSS、Ajax、Jstl

后端:SpringMVC、Spring-Data-Jpa、Interceptor拦截器

项目管理:Maven

项目目录

功能

成绩管理系统分为三个角色:管理员,老师,学生

管理员: 主要功能:老师管理,班级管理,学生管理,课程管理,修改密码等功能

老师: 主要功能:成绩录入和修改,课程管理,学生管理,修改密码等功能

学生: 功能:查看班级成绩,查看课程,查看班级成员,查看个人成绩等功能

成绩管理逻辑代码

@Controller
@RequestMapping(value="/grade")
public class GradeController {
	@Autowired
	private GradeService gradeService;
	@Autowired
	private TbClassService tbClassService;
	@Autowired
	private CourseService courseService;
	@Autowired
	private StudentService studentService;
	
	@RequestMapping(value="grcj")
	public String grcj(Integer id, ModelMap map) {
		List grade = gradeService.findByStudentId(id);
		map.put("grcj", grade);
		return "user/grcj";
	}
	
	@RequestMapping(value="entering")
	public String entering(ModelMap map) {
		List tbClass = tbClassService.findAll();
		List course = courseService.findAll();
		map.put("tbClass", tbClass);
		map.put("course", course);
		return "grade/entering";
	}
	
	@RequestMapping(value="xs_all")
	public String xs_all(Integer tbClass_id, Integer course_id, ModelMap map) {
		List student = studentService.findByTbClassId(tbClass_id);
		Course course = courseService.findById(course_id);
		List grade = gradeService.findByStudentTbClassIdAndCourseId(tbClass_id, course_id);
		for (Student s : student) {
			for (Grade g : grade) {
				if((course.getId() == g.getCourse().getId()) && (s.getId() == g.getStudent().getId())) {
					s.setCj(g.getGrade());
					break;
				}
			}
		}
		map.put("student", student);
		return "grade/xs_all";
	}
	
	@RequestMapping(value="save")
	public void save(Integer grade, Integer kc_id, Integer xs_id) {
		Grade g = gradeService.findByStudentIdAndCourseId(xs_id, kc_id);
		Grade cj = new Grade();
		cj.setGrade(grade);
		cj.setCourse(courseService.findById(kc_id));
		cj.setStudent(studentService.findById(xs_id));
		if(g == null) {
			gradeService.save(cj);			
		}else {
			cj.setId(g.getId());
			gradeService.save(cj);			
		}
	}
	
	@RequestMapping(value="/updata1")
	public void updata1(Integer grade, Integer id) {
		Grade g = gradeService.findById(id);
		g.setGrade(grade);
		gradeService.save(g);
	}
	
	@RequestMapping(value="updata")
	public String updata(ModelMap map) {
		List tbClass = tbClassService.findAll();
		map.put("tbClass", tbClass);
		return "grade/updata";
	}
	
	@RequestMapping(value="xg")
	public String xg(Integer id, ModelMap map) {
		List grade = gradeService.findByStudentId(id);
		map.put("grade", grade);
		return "grade/xg";
	}
	
	@RequestMapping(value="bj_all")
	public String bj_all(Integer id, ModelMap map) {
		List grade = gradeService.findByStudentTbClassId(id);
		map.put("grade", grade);
		return "grade/bj_all";
	}
}

你可能感兴趣的:(Java,后端,java,mysql)