forked from cmzalvin/giit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElectiveController.java
More file actions
46 lines (38 loc) · 1.5 KB
/
ElectiveController.java
File metadata and controls
46 lines (38 loc) · 1.5 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
package com.giit.www.student.controller;
import com.giit.www.student.service.ElectiveBiz;
import org.apache.shiro.authz.annotation.Logical;
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 javax.annotation.Resource;
import javax.servlet.http.HttpSession;
/**
* Created by c0de8ug on 16-2-16.
*/
@Controller
@RequestMapping("elective.do")
public class ElectiveController {
@Resource(name = "electiveBizImpl")
private ElectiveBiz electiveBiz;
@RequiresRoles(value = {"admin", "student"}, logical = Logical.OR)
@RequestMapping("elective.view")
public String electiveView(Model m) {
m.addAttribute("sectionList", electiveBiz.findAllSection());
return "/student/elective";
}
@RequiresRoles(value = {"admin", "student"}, logical = Logical.OR)
@RequestMapping("add")
public String add(int secId, HttpSession session) {
String stdId = (String) session.getAttribute("username");
electiveBiz.add(secId, stdId);
return "redirect:/elective.do/elective.view";
}
@RequiresRoles(value = {"admin", "student"}, logical = Logical.OR)
@RequestMapping("delete")
public String delete(int secId, HttpSession session) {
String stdId = (String) session.getAttribute("username");
electiveBiz.delete(secId, stdId);
return "redirect:/elective.do/elective.view";
}
}