主要代码
在线提交作业:
Controller层:
@PostMapping("/upload")
@ResponseBody
public String upload(Model model, @RequestParam("file")MultipartFile file){
File targetFile = new File(filepath);
String fileName = null;
String repeat = null;
if(!targetFile.exists()){
targetFile.mkdirs();
}
try {
FileOutputStream out = new FileOutputStream(filepath+file.getOriginalFilename());
fileName = file.getOriginalFilename();
System.out.println("文件上传名称:"+file.getOriginalFilename());
out.write(file.getBytes());
} catch (Exception e) {
e.printStackTrace();
}
班级学习信息统计:
Mapper:
<select id="selectCourseBySidCid" resultMap="CourseMapBySidCid">
SELECT student.id AS studentId,student.name As studentName,
class.name As GradeName,course.cname AS ConCname,
middle_cs.grade_usual,middle_cs.grade_finally, middle_cs.grade_total
FROM middle_cs,course,class,student
<where>
middle_cs.cid=course.cid and student.id=middle_cs.sid
and class.id=student.class_id
<if test="grade != null and grade != ''">
and class.id = #{grade}
</if>
<if test="course != null and course != ''">
and course.cid= #{course}
</if>
<if test="sid !=null and sid != '' ">
and student.id= #{sid}
</if>
<if test="message!= null and message != '' ">
and student.name=#{sssname}
</if>
</where>
</select>
Controller层:
@GetMapping("score")
public PageInfo<MiddleStudentCourse> findCourseBySid(int num, Integer sid, String sname, Integer grade, Integer course){
Map map = new HashMap();
map.put("sid",sid);
if(sname!=null){
if(sname.isEmpty()){
map.put("message",null);
}
else {
map.put("sssname",sname);
map.put("message",1);
}}
map.put("course",course);
map.put("grade",grade);
PageHelper.startPage(num,7);
List<MiddleStudentCourse> list= middleStudentCourseService.findCourseBySidCid(map);
PageInfo<MiddleStudentCourse> pageInfo =new PageInfo<MiddleStudentCourse>(list);
return pageInfo ;
}
版本管理过程
1.使用git。
2.将项目交给git管理。
3.将项目add。
4.将项目commit。
5.将项目进行push