forked from cmzalvin/giit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentController.java
More file actions
62 lines (49 loc) · 1.74 KB
/
StudentController.java
File metadata and controls
62 lines (49 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.giit.www.college.controller;
import com.giit.www.college.service.StudentBiz;
import com.giit.www.entity.Student;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.annotation.MultipartConfig;
import java.io.IOException;
/**
* Created by c0de8ug on 16-2-12.
*/
@Controller
@RequestMapping("student.do")
public class StudentController {
@Resource(name = "studentBizImpl")
StudentBiz studentBiz;
@RequiresRoles("admin")
@RequestMapping("student.view")
public String studentView(Model m) {
//TODO 将biz命名为和业务有关的函数方法,不知道是否正确留个吭
m.addAttribute("studentList", studentBiz.studentView());
return "/admin/college/student";
}
@RequiresRoles("admin")
@RequestMapping("student_add.view")
public String studentAddView(Model m) {
return "/admin/college/student_add";
}
@RequiresRoles("admin")
@RequestMapping("student_update.view")
public String studentUpdateView(Model m) {
return "/admin/college/student_update";
}
@RequiresRoles("admin")
@RequestMapping("add")
public String add(Model m, MultipartFile pic, Student student) throws IOException {
studentBiz.add(student, pic);
return "redirect:/student.do/student.view";
}
@RequiresRoles("admin")
@RequestMapping("delete")
public String delete(Model m, int studentId) {
studentBiz.delete(studentId);
return "redirect:/student.do/student.view";
}
}