Skip to content

Commit 53bc3af

Browse files
committed
Add orderbook selectedCourse function
1 parent 263e68c commit 53bc3af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+860
-219
lines changed

src/com/giit/www/college/controller/ClazzController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ public String delete(int clazzId) {
3333
@RequestMapping("clazz.view")
3434
public String findAll(Model m) {
3535
m.addAttribute("clazzList", clazzBiz.findAll());
36-
return "/college/clazz";
36+
return "/admin/college/clazz";
3737
}
3838

3939
@RequestMapping("clazz_add.view")
4040
public String findDeptAndSpec(Model m) {
4141
m.addAttribute("deptAndSpecJson", clazzBiz.findDeptAndSpecJson());
4242
m.addAttribute("deptNameList", clazzBiz.findDeptNameList());
43-
return "/college/clazz_add";
43+
return "/admin/college/clazz_add";
4444
}
4545
}

src/com/giit/www/college/controller/CourseController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ public class CourseController {
2020
@RequestMapping("course.view")
2121
private String courseView(Model m) {
2222
m.addAttribute("courseList", courseBiz.findAll());
23-
return "/college/course";
23+
return "/admin/college/course";
2424
}
2525

2626
@RequestMapping("course_add.view")
2727
private String courseAddView(Model m) {
2828
m.addAttribute("specNameList", courseBiz.findAllSpecName());
29-
return "/college/course_add";
29+
return "/admin/college/course_add";
3030
}
3131

3232
@RequestMapping("add")

src/com/giit/www/college/controller/DeptController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ public class DeptController {
2222
@RequestMapping("dept.view")
2323
public String deptView(Model m) {
2424
m.addAttribute("deptList", deptBiz.findAll());
25-
return "/college/dept";
25+
return "/admin/college/dept";
2626
}
2727

2828
@RequestMapping("dept_add.view")
2929
public String deptAddView(Model m) {
30-
return "/college/dept_add";
30+
return "/admin/college/dept_add";
3131
}
3232

3333
@RequestMapping("dept_update.view")
3434
public String deptUpdateView(Model m) {
35-
return "/college/dept_update";
35+
return "/admin/college/dept_update";
3636
}
3737

3838
@RequestMapping("add")

src/com/giit/www/college/controller/OrderBookController.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,54 @@
22

33
import com.giit.www.college.service.OrderBookBiz;
44
import org.springframework.stereotype.Controller;
5+
import org.springframework.ui.Model;
6+
import org.springframework.web.bind.annotation.RequestMapping;
57

68
import javax.annotation.Resource;
9+
import javax.servlet.http.HttpSession;
10+
import java.util.List;
711

812
/**
913
* Created by c0de8ug on 16-2-13.
1014
*/
15+
//TODO URL我自己定义全小写
16+
@RequestMapping("orderbook.do")
1117
@Controller
1218
public class OrderBookController {
1319
@Resource(name = "orderBookBizImpl")
1420
private OrderBookBiz orderBookBiz;
1521

22+
@RequestMapping("orderbook.view")
23+
public String orderBookView(Model m, HttpSession httpSession) {
24+
String staffId = (String) httpSession.getAttribute("username");
25+
26+
//TODO 这里的year应该从服务器端开课的地方拿,但是如何拿怎么拿有点不理解,先给它一个值
27+
List<String> courseList = orderBookBiz.findSelectedCourseTitle(staffId, "20162");
28+
int courseCount = courseList.size();
29+
m.addAttribute("selectedCourseList", courseList);
30+
m.addAttribute("courseCount", courseCount);
31+
return "/teacher/orderbook";
32+
}
33+
34+
@RequestMapping("orderbook_review.view")
35+
public String orderBookReviewView(Model m) {
36+
return "/teacher/orderbook_review";
37+
}
38+
39+
@RequestMapping("orderbook_add.view")
40+
public String orderBookAddView(Model m) {
41+
return "/teacher/orderbook_add";
42+
}
43+
44+
@RequestMapping("orderbook_added.view")
45+
public String orderBookAddedView(Model m) {
46+
return "/teacher/orderbook_added";
47+
}
48+
49+
50+
@RequestMapping("add")
51+
public String add() {
52+
return "/orderbook.do/orderbook.view";
53+
}
1654

1755
}

src/com/giit/www/college/controller/SectionController.java

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
import com.giit.www.college.service.SectionBiz;
44
import com.giit.www.entity.Section;
5+
import com.giit.www.entity.Timetable;
56
import org.springframework.stereotype.Controller;
67
import org.springframework.ui.Model;
78
import org.springframework.web.bind.annotation.RequestMapping;
9+
import sun.misc.Timeable;
810

911
import 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
}

src/com/giit/www/college/controller/SpecController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ public class SpecController {
2424
@RequestMapping("spec_add.view")
2525
public String specAddView(Model m) {
2626
m.addAttribute("deptNameList", specBiz.findDpet());
27-
return "/college/spec_add";
27+
return "/admin/college/spec_add";
2828
}
2929

3030
//TODO 该名字deptAndSpec不好,但是不知道如何命名-, -
3131
@RequestMapping("spec.view")
3232
public String specView(Model m) {
3333
m.addAttribute("deptAndSpec", specBiz.findDeptAndSpec());
34-
return "/college/spec";
34+
return "/admin/college/spec";
3535
}
3636

3737
@RequestMapping("spec_update.view")
3838
public String specUpdateView(Model m) {
39-
return "/college/spec_update";
39+
return "/admin/college/spec_update";
4040
}
4141

4242
@RequestMapping("update")

src/com/giit/www/college/controller/StudentController.java

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.giit.www.college.controller;
22

33
import com.giit.www.college.service.StudentBiz;
4+
import com.giit.www.entity.Student;
45
import org.springframework.stereotype.Controller;
56
import org.springframework.ui.Model;
67
import org.springframework.web.bind.annotation.RequestMapping;
@@ -21,17 +22,36 @@ public class StudentController {
2122
public String studentView(Model m) {
2223
//TODO 将biz命名为和业务有关的函数方法,不知道是否正确留个吭
2324
m.addAttribute("studentList", studentBiz.studentView());
24-
return "/college/student";
25+
return "/admin/college/student";
2526
}
2627

2728
@RequestMapping("student_add.view")
2829
public String studentAddView(Model m) {
2930

30-
return "/college/student_add";
31+
return "/admin/college/student_add";
32+
}
33+
34+
@RequestMapping("student_update.view")
35+
public String studentUpdateView(Model m) {
36+
37+
return "/admin/college/student_update";
3138
}
3239

3340
@RequestMapping("student_elective.view")
3441
public String studentElectiveView() {
35-
return "/college/student_elective";
42+
return "/student/elective";
43+
}
44+
45+
@RequestMapping("add")
46+
public String add(Model m, Student student) {
47+
studentBiz.add(student);
48+
return "/student.do/student.view";
49+
}
50+
51+
@RequestMapping("delete")
52+
public String delete(Model m, int studentId) {
53+
studentBiz.delete(studentId);
54+
return "/student.do/student.view";
3655
}
56+
3757
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.giit.www.college.dao;
2+
3+
import java.util.List;
4+
5+
/**
6+
* Created by c0de8ug on 16-2-14.
7+
*/
8+
public interface BookDao {
9+
public List<String> findSelctedCourse();
10+
11+
public void add();
12+
13+
14+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<!DOCTYPE mapper
3+
PUBLIC "-//mybatis.org//DTD mapper 3.0//EN"
4+
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5+
6+
7+
<mapper namespace="com.giit.www.college.dao.BookDao">
8+
9+
<resultMap id="book_map" type="Book">
10+
<id property="clazzId" column="class_id"/>
11+
<result property="clazzName" column="class_name"/>
12+
<result property="year" column="year"/>
13+
<result property="specName" column="spec_name"/>
14+
</resultMap>
15+
16+
<select id="findSelctedCourse" parameterType="map" resultType="String">
17+
SELECT DISTINCT course_title FROM section WHERE staff_id = #{staffId} AND year = #{year};
18+
</select>
19+
20+
<insert id="add" parameterType="Book">
21+
INSERT INTO book(book_title,isbn,data_of_printing,author,press,category,unit_price) VALUES
22+
(
23+
bookTitle,
24+
isbn,
25+
dataOfPrinting,
26+
author,
27+
press,
28+
category,
29+
unitPrice,
30+
)
31+
</insert>
32+
</mapper>

src/com/giit/www/college/dao/SectionDao.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.giit.www.entity.Section;
44
import com.giit.www.entity.custom.SectionCustom;
5+
import org.apache.ibatis.annotations.Param;
56

67
import java.util.List;
78

@@ -16,4 +17,6 @@ public interface SectionDao {
1617
public void delete(int sectionId);
1718

1819
public void add(Section section);
20+
21+
public List<String> findSelectedCourseTitle(@Param("staffId") String staffId, @Param("year") String year);
1922
}

0 commit comments

Comments
 (0)