22
33import com .giit .www .college .service .SectionBiz ;
44import com .giit .www .entity .Section ;
5+ import com .giit .www .entity .Timetable ;
56import org .springframework .stereotype .Controller ;
67import org .springframework .ui .Model ;
78import org .springframework .web .bind .annotation .RequestMapping ;
9+ import sun .misc .Timeable ;
810
911import javax .annotation .Resource ;
12+ import javax .servlet .http .HttpSession ;
1013
1114/**
1215 * Created by c0de8ug on 16-2-12.
@@ -20,26 +23,38 @@ public class SectionController {
2023 @ RequestMapping ("section.view" )
2124 public String sectionView (Model m ) {
2225 m .addAttribute ("sectionList" , sectionBiz .findAllCustom ());
23- return "/college/section" ;
26+ return "/admin/ college/section" ;
2427 }
2528
2629 @ RequestMapping ("section_add.view" )
2730 public String sectionAddView (Model m ) {
2831 m .addAttribute ("courseTitleList" , sectionBiz .findAllCourseTitle ());
2932 m .addAttribute ("staffList" , sectionBiz .findAllStaff ());
30- return "/college/section_add" ;
33+ return "/admin/college/section_add" ;
34+ }
35+
36+ @ RequestMapping ("section_timetable_add.view" )
37+ public String sectionTimetableAdd (Model m ) {
38+ return "/admin/college/section_timetable_add" ;
3139 }
3240
3341 @ RequestMapping ("add" )
34- public String add (Section section ) {
35- sectionBiz .add (section );
42+ public String add (Section section , HttpSession session ) {
43+ String staffId = (String ) session .getAttribute ("username" );
44+ sectionBiz .add (section , staffId );
45+ return "redirect:section.view" ;
46+ }
47+
48+ @ RequestMapping ("addTimetable" )
49+ public String addTimetable (Timetable timetable ) {
50+ sectionBiz .addTimetable (timetable );
3651 return "redirect:section.view" ;
3752 }
3853
39- //TODO 1.这里需要事务管理
54+
4055 @ RequestMapping ("delete" )
41- public String delete (int sectionId ) {
42- sectionBiz .delete (sectionId );
56+ public String delete (int secId ) {
57+ sectionBiz .delete (secId );
4358 return "redirect:section.view" ;
4459 }
4560}
0 commit comments