摘 要
【540】基于ssm学生成绩管理平台源码和论文
21新世纪,全世界信息数字电子化的发展趋势无法阻挡。电子计算机存有于社会生活的各行各业,它的广泛运用给经济发展和社会生活产生了深入的改进。信息技术性不但更改了大家的作业和生活习惯,也变化了文化教育和培训的方法。伴随着学校教育的迅猛发展,入学率的普遍提高,各种教育培训公司的持续扩大,对学生成绩管理的效果和规范性明确提出了更高的规定。3354学生成绩管理做为监管的关键构成部分,涉及到很多的信息和复杂性的数据信息。假如这种信息全是手工整理得话,那么就太繁杂繁琐了。因此做了一个学生成绩管理服务平台,系统软件的搜集整理这种数据信息。
由于学生成绩管理劳动量大,为了更好地降低学生统计分析的反复和复杂,简单化管理方法,必须开发设计一套合适具体情况,可以处理具体问题的学生成绩管理系统软件。立即为管理人员给予学生、班集体等各种信息,给予学生分配、考試准确度、成功率、遍布等监管作用。
这一学生成绩管理服务平台是融合HTML和JavaScript开发设计的。在设计过程中,充分保证了系统软件编码优良的易读性、应用性、扩展性和实用性,有利于中后期维护保养,使用方便,网页页面简约。
关键词:学生成绩管理平台;JavaScript;HTML;CSS
ABSTRACT
In the 21st century, the trend of global information electronization is irresistible. Computer exists in every field of social life, and its wide application brings profound improvement to economic and social life. Information technology is not only changing the way people work and live, but also the way they are taught and learned. With the booming development of education, the higher enrollment rate and the continuous expansion of all kinds of education companies, higher requirements have been put forward for the efficiency and standardization of student management. As an important part of management of student achievement management, involved in the amount of information, data, complicated if fully using manual sorts through the data and how complicated and tedious, so I want to be a student achievement management platform and collection of the data systematically.
In view of the workload of student performance management is very large, in order to reduce the repetitive and tedious student performance statistics summary work, simplify the performance management, it is necessary to develop a set of suitable for the actual situation, can solve the actual problem of student performance management system. Provide timely and accurate information of students and classes to administrators, and provide management functions such as sorting out students' scores, test accuracy rate, pass rate and score distribution.
The student score management platform is developed on the basis of HTML and JavaScript. In the design process, the system code is fully guaranteed to be readable, practical, easy to expand, universal, convenient for later maintenance, simple operation and simple page.
Key words: Student score management platform; JavaScript; HTML; CSS
package com.niudada.controller;
import com.niudada.entity.Clazz;
import com.niudada.entity.Student;
import com.niudada.entity.Subject;
import com.niudada.entity.Teacher;
import com.niudada.service.ClazzService;
import com.niudada.service.StudentService;
import com.niudada.service.SubjectService;
import com.niudada.utils.MapControl;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/student")
public class StudentController {
private static final String LIST = "student/list";
private static final String ADD = "student/add";
private static final String UPDATE = "student/update";
@Autowired
private StudentService studentService;
@Autowired
private SubjectService subjectService;
@Autowired
private ClazzService clazzService;
//跳转添加页面
@GetMapping("/add")
public String create(ModelMap modelMap) {
//查询所有的专业,存储到request域
List<Subject> subjects = subjectService.query(null);
modelMap.addAttribute("subjects", subjects);
return ADD;
}
//添加操作
@PostMapping("/create")
@ResponseBody
public Map<String, Object> create(@RequestBody Student student) {
//设置学生的状态
student.setStatus(Student.StatusType.type_1);
int result = studentService.create(student);
if (result <= 0) {
return MapControl.getInstance().error().getMap();
}
return MapControl.getInstance().success().getMap();
}
//根据id查询
@PostMapping("/delete/{id}")
@ResponseBody
public Map<String, Object> delete(@PathVariable("id") Integer id) {
int result = studentService.delete(id);
if (result <= 0) {
return MapControl.getInstance().error().getMap();
}
return MapControl.getInstance().success().getMap();
}
//删除操作
@PostMapping("/delete")
@ResponseBody
public Map<String, Object> delete(String ids) {
int result = studentService.delete(ids);
if (result <= 0) {
return MapControl.getInstance().error().getMap();
}
return MapControl.getInstance().success().getMap();
}
//修改操作
@PostMapping("/update")
@ResponseBody
public Map<String, Object> update(@RequestBody Student student) {
int result = studentService.update(student);
if (result <= 0) {
return MapControl.getInstance().error().getMap();
}
return MapControl.getInstance().success().getMap();
}
//根据id查询,跳转修改页面
@GetMapping("/detail/{id}")
public String detail(@PathVariable("id") Integer id, ModelMap modelMap) {
//查询出要修改的学生的信息
Student student = studentService.detail(id);
//查询所有的专业
List<Subject> subjects = subjectService.query(null);
//将查询出来的数据存储到request域,实现表单回显
modelMap.addAttribute("student", student);
modelMap.addAttribute("subjects", subjects);
return UPDATE;
}
//查询所有
@PostMapping("/query")
@ResponseBody
public Map<String, Object> query(@RequestBody Student student) {
//查询所有的学生信息
List<Student> list = studentService.query(student);
//查询所有的专业
List<Subject> subjects = subjectService.query(null);
//查询所有的班级
List<Clazz> clazzes = clazzService.query(null);
//设置关联
list.forEach(entity -> {
subjects.forEach(subject -> {
//判断学生表中的subjectId和专业表的id是否一致
if (subject.getId() == entity.getSubjectId()) {
entity.setSubject(subject);
}
});
clazzes.forEach(clazz -> {
//判断学生表中的clazzId和班级表的id是否一致
if (clazz.getId() == entity.getClazzId()) {
entity.setClazz(clazz);
}
});
});
//查询总记录条数
Integer count = studentService.count(student);
return MapControl.getInstance().success().page(list, count).getMap();
}
//跳转列表页面
@GetMapping("/list")
public String list() {
return LIST;
}
//跳转查询学生页面
@GetMapping("/teacher_student")
public String teacher_student(ModelMap modelMap, HttpSession session) {
//查询所有的专业
List<Subject> subjects = subjectService.query(null);
//查询所有的班级
List<Clazz> clazzes = clazzService.query(null);
Teacher teacher = (Teacher) session.getAttribute("user");
modelMap.addAttribute("subjects", subjects);
modelMap.addAttribute("clazzes", clazzes);
modelMap.addAttribute("teacher", teacher);
return "student/teacher_student";
}
//老师查询学生
@PostMapping("/teacher_student")
@ResponseBody
public Map<String, Object> teacher_student(Integer clazzId, Integer subjectId, ModelMap modelMap, HttpSession session) {
Teacher teacher = (Teacher) session.getAttribute("user");
List<Student> students = studentService.queryStudentByTeacher(teacher.getId(), clazzId, subjectId);
List<Subject> subjects = subjectService.query(null);
List<Clazz> clazzes = clazzService.query(null);
//设置关联
students.forEach(entity -> {
subjects.forEach(subject -> {
//判断学生表的subjectId和专业表的id是否一致
if (subject.getId() == entity.getSubjectId()) {
entity.setSubject(subject);
}
});
clazzes.forEach(clazz -> {
//判断学生表的clazzId和班级表的id是否一致
if (clazz.getId() == entity.getClazzId()) {
entity.setClazz(clazz);
}
});
});
return MapControl.getInstance().success().add("data", students).getMap();
}
@RequestMapping("/uploadFile")
public @ResponseBody
void uploadImage(@RequestParam("file") MultipartFile file) throws IOException, ParseException {
try{
Map<String, Object> result = new HashMap<>();
Boolean n, flag = null;
//判断文件版本
String fileName = file.getOriginalFilename();
String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
InputStream ins = file.getInputStream();
Workbook wb = null;
if (suffix.equals("xlsx")) {
wb = new XSSFWorkbook(ins);
} else {
wb = new HSSFWorkbook(ins);
}
//获取excel表单
Sheet sheet = wb.getSheetAt(0);
//line = 1:从表的第二行开始获取记录
if (null != sheet) {
for (int line = 1; line <= sheet.getLastRowNum(); line++) {
// Zbqk sendmessage = new Zbqk();
Row row = sheet.getRow(line);
if (null == row) {
continue;
}
row.getCell(0).setCellType(CellType.STRING);
row.getCell(1).setCellType(CellType.STRING);
row.getCell(2).setCellType(CellType.STRING);
row.getCell(3).setCellType(CellType.STRING);
row.getCell(4).setCellType(CellType.STRING);
row.getCell(5).setCellType(CellType.STRING);
row.getCell(6).setCellType(CellType.STRING);
//获取第二个单元格的内容
String bj1 = row.getCell(0).getStringCellValue();
String bj2 = row.getCell(1).getStringCellValue();
String bj3 = row.getCell(2).getStringCellValue();
String bj4 = row.getCell(3).getStringCellValue();
String bj5 = row.getCell(4).getStringCellValue();
String bj6 = row.getCell(5).getStringCellValue();
String bj7 = row.getCell(6).getStringCellValue();
//Date类型
Student student = new Student();
student.setStuNo(bj1);
student.setStuName(bj2);
student.setCardNo(bj3);
student.setGender(bj4);
student.setPhone(bj5);
List<Subject> list1 = subjectService.query(null);
if(list1.size()>0){
for (Subject subject:list1) {
if(subject.getSubjectName().contains(bj6)){
student.setSubjectId(subject.getId());
}
}
}
List<Clazz> list2 = clazzService.query(null);
if(list2.size()>0){
for (Clazz clazz:list2) {
if(clazz.getClazzName().contains(bj7)){
student.setClazzId(clazz.getId());
}
}
}
student.setStuPwd("123456");
student.setStatus("正常");
studentService.create(student);
}
}
}catch (Exception e){
e.printStackTrace();
}
}
}
package com.niudada.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.niudada.entity.*;
import com.niudada.service.*;
import com.niudada.utils.MapControl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/section")
public class SectionController {
private static final String LIST = "section/list";
private static final String ADD = "section/add";
private static final String UPDATE = "section/update";
@Autowired
private SectionService sectionService;
@Autowired
private SubjectService subjectService;
@Autowired
private ClazzService clazzService;
@Autowired
private TeacherService teacherService;
@Autowired
private CourseService courseService;
@Autowired
private StudentService studentService;
@Autowired
public ScoreService scoreService;
//跳转添加页面
@GetMapping("/add")
public String create(Integer clazzId, ModelMap modelMap) {
//查询所有的老师,存储到request域
List<Teacher> teachers = teacherService.query(null);
//查询所有的课程,存储到request域
List<Course> courses = courseService.query(null);
modelMap.addAttribute("teachers", teachers);
modelMap.addAttribute("courses", courses);
modelMap.addAttribute("clazzId", clazzId);
return ADD;
}
//添加操作
@PostMapping("/create")
@ResponseBody
public Map<String, Object> create(@RequestBody Section section) {
int result = sectionService.create(section);
if (result <= 0) {
return MapControl.getInstance().error().getMap();
}
return MapControl.getInstance().success().getMap();
}
//根据id删除
@PostMapping("/delete/{id}")
@ResponseBody
public Map<String, Object> delete(@PathVariable("id") Integer id) {
int result = sectionService.delete(id);
if (result <= 0) {
return MapControl.getInstance().error().getMap();
}
return MapControl.getInstance().success().getMap();
}
//批量删除
@PostMapping("/delete")
@ResponseBody
public Map<String, Object> delete(String ids) {
int result = sectionService.delete(ids);
if (result <= 0) {
return MapControl.getInstance().error().getMap();
}
return MapControl.getInstance().success().getMap();
}
//修改操作
@PostMapping("/update")
@ResponseBody
public Map<String, Object> update(@RequestBody Section section) {
int result = sectionService.update(section);
if (result <= 0) {
return MapControl.getInstance().error().getMap();
}
return MapControl.getInstance().success().getMap();
}
//根据id查询,跳转修改页面
@GetMapping("/detail/{id}")
public String detail(@PathVariable("id") Integer id, ModelMap modelMap) {
//查询出要修改的班级
Section section = sectionService.detail(id);
//查询所有的老师
List<Teacher> teachers = teacherService.query(null);
//查询所有的课程
List<Course> courses = courseService.query(null);
modelMap.addAttribute("teachers", teachers);
modelMap.addAttribute("courses", courses);
modelMap.addAttribute("section", section);
return UPDATE;
}
//查询所有
@PostMapping("/query")
@ResponseBody
public Map<String, Object> query(@RequestBody Section section) {
//查询所有的开课信息
List<Section> list = sectionService.query(section);
//查询所有的老师
List<Teacher> teachers = teacherService.query(null);
//查询所有的班级
List<Course> courses = courseService.query(null);
//设置关联
list.forEach(entity -> {
teachers.forEach(teacher -> {
//判断开课表的teacherId和老师表的id是否一致
if (teacher.getId() == entity.getTeacherId()) {
entity.setTeacher(teacher);
}
});
courses.forEach(course -> {
//判断开课表中的courseId和课程表的id是否一致
if (course.getId() == entity.getCourseId()) {
entity.setCourse(course);
}
});
});
//查询宗记录条数
Integer count = sectionService.count(section);
return MapControl.getInstance().success().page(list, count).getMap();
}
//跳转列表页面
@GetMapping("/list")
public String list() {
return LIST;
}
//生成zTree树形
@PostMapping("/tree")
@ResponseBody
public List<Map> tree() {
List<Subject> subjects = subjectService.query(null);
List<Clazz> clazzes = clazzService.query(null);
List<Map> list = new ArrayList<>();
subjects.forEach(subject -> {
Map<String, Object> map = new HashMap<>();
map.put("id", subject.getId());
map.put("name", subject.getSubjectName());
map.put("parentId", 0);
List<Map<String, Object>> childrenList = new ArrayList<>();
clazzes.forEach(clazz -> {
if (subject.getId() == clazz.getSubjectId()) {
Map<String, Object> children = new HashMap<>();
children.put("id", clazz.getId());
children.put("name", clazz.getClazzName());
children.put("parentId", subject.getId());
childrenList.add(children);
}
});
map.put("children", childrenList);
list.add(map);
});
ObjectMapper objectMapper = new ObjectMapper();
try {
String jsonString = objectMapper.writeValueAsString(list);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return list;
}
//跳转开课信息列表页面
@GetMapping("/student_section")
public String student_section() {
return "section/student_section";
}
@PostMapping("/query_student_section")
@ResponseBody
public Map<String, Object> student_section(HttpSession session) {
Student student = (Student) session.getAttribute("user");
List<Section> sections = sectionService.queryByStudent(student.getId());
List<Clazz> clazzes = clazzService.query(null);
List<Teacher> teachers = teacherService.query(null);
List<Course> courses = courseService.query(null);
sections.forEach(section -> {
clazzes.forEach(clazz -> {
if (section.getClazzId() == clazz.getId()) {
section.setClazz(clazz);
}
});
teachers.forEach(teacher -> {
if (section.getTeacherId() == teacher.getId()) {
section.setTeacher(teacher);
}
});
courses.forEach(course -> {
if (section.getCourseId() == course.getId()) {
section.setCourse(course);
}
});
});
return MapControl.getInstance().success().add("data", sections).getMap();
}
@GetMapping("/teacher_section")
public String teacher_section() {
return "section/teacher_section";
}
@PostMapping("/query_teacher_section")
@ResponseBody
public Map<String, Object> query_teacher_section(HttpSession session) {
//获取登录老师的信息
Teacher teacher = (Teacher) session.getAttribute("user");
Section param = new Section();
param.setTeacherId(teacher.getId());
List<Section> sections = sectionService.query(param);
List<Clazz> clazzes = clazzService.query(null);
List<Course> courses = courseService.query(null);
sections.forEach(section -> {
clazzes.forEach(clazz -> {
if (section.getClazzId() == clazz.getId().intValue()) {
section.setClazz(clazz);
}
});
courses.forEach(course -> {
if (section.getCourseId() == course.getId().intValue()) {
section.setCourse(course);
}
});
});
return MapControl.getInstance().success().add("data", sections).getMap();
}
@GetMapping("/teacher_student_score")
public String teacher_student_score(Integer courseId, Integer sectionId, ModelMap modelMap) {
List<HashMap> list = studentService.querySelectStudent(courseId, sectionId);
modelMap.put("list", list);
modelMap.put("sectionId", sectionId);
modelMap.put("courseId", courseId);
return "section/teacher_student_score";
}
@PostMapping("/teacher_student_score")
@ResponseBody
public Map<String, Object> teacher_student_score(Integer courseId, Integer sectionId, String stuIds, String scores) {
int result = scoreService.update(courseId, sectionId, stuIds, scores);
if (result <= 0) {
return MapControl.getInstance().error().getMap();
}
return MapControl.getInstance().success().getMap();
}
}