Skip to content

Commit 51c39a6

Browse files
committed
Merge branch 'dev'
2 parents 24753f2 + d4f3deb commit 51c39a6

Some content is hidden

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

42 files changed

+902
-61
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.giit.www.college.service.OrderBookBiz;
44
import com.giit.www.entity.Section;
55
import com.giit.www.entity.custom.ChangedItems;
6+
import com.giit.www.entity.custom.OrderBookReviewVo;
67
import com.giit.www.entity.custom.OrderBookVo;
78
import com.giit.www.util.TermContainer;
89
import org.springframework.http.HttpStatus;
@@ -43,7 +44,9 @@ public String orderBookView(Model m, HttpSession httpSession) {
4344
}
4445

4546
@RequestMapping("orderbook_review.view")
46-
public String orderBookReviewView(Model m) {
47+
public String orderBookReviewView(Model m, HttpSession session) {
48+
//TODO 放到SESSION方便处理
49+
session.setAttribute("notReviewedBookList", orderBookBiz.findAllNotReviewedBook());
4750
return "/teacher/orderbook_review";
4851
}
4952

@@ -60,7 +63,6 @@ public String orderBookAddedView(Model m, HttpSession session) {
6063
}
6164

6265

63-
//TODO 这里的数据提交没有回显,会给用户带来不便,如果设计是一个问题!!!
6466
@RequestMapping("add")
6567
public String add(HttpServletRequest request, HttpSession session) {
6668
Map map = request.getParameterMap();
@@ -76,4 +78,11 @@ public String add(HttpServletRequest request, HttpSession session) {
7678
public void update(@RequestBody ChangedItems changedItems, HttpSession session) {
7779
orderBookBiz.update(changedItems, (String) session.getAttribute("username"));
7880
}
81+
82+
@RequestMapping("audit")
83+
public String audit(HttpSession session) {
84+
List<OrderBookReviewVo> orderBookReviewVoList = (List<OrderBookReviewVo>) session.getAttribute("notReviewedBookList");
85+
orderBookBiz.audit(orderBookReviewVoList);
86+
return "orderbook.do/orderbook_review.view"
87+
}
7988
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.giit.www.college.service.SectionBiz;
44
import com.giit.www.entity.Section;
55
import com.giit.www.entity.Timetable;
6+
import com.giit.www.util.TermContainer;
67
import org.springframework.stereotype.Controller;
78
import org.springframework.ui.Model;
89
import org.springframework.web.bind.annotation.RequestMapping;
@@ -30,6 +31,7 @@ public String sectionView(Model m) {
3031
public String sectionAddView(Model m) {
3132
m.addAttribute("courseTitleList", sectionBiz.findAllCourseTitle());
3233
m.addAttribute("staffList", sectionBiz.findAllStaff());
34+
m.addAttribute("termList", TermContainer.getTermList());
3335
return "/admin/college/section_add";
3436
}
3537

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ public String studentUpdateView(Model m) {
3636

3737
return "/admin/college/student_update";
3838
}
39-
40-
@RequestMapping("student_elective.view")
41-
public String studentElectiveView() {
42-
return "/student/elective";
43-
}
44-
4539
@RequestMapping("add")
4640
public String add(Model m, Student student) {
4741
studentBiz.add(student);

src/com/giit/www/college/dao/BookDao.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<mapper namespace="com.giit.www.college.dao.BookDao">
88

99
<insert id="add" parameterType="Book">
10-
INSERT INTO book(book_title,isbn,data_of_printing,author,press,category,unit_price)
11-
VALUES(#{bookTitle},#{isbn},#{dataOfPrinting},#{author},#{press},#{category},#{unitPrice})
10+
INSERT INTO book(book_title,isbn,date_of_printing,author,press,category,unit_price)
11+
VALUES(#{bookTitle},#{isbn},#{dateOfPrinting},#{author},#{press},#{category},#{unitPrice})
1212
</insert>
1313

1414
<select id="find" parameterType="map" resultType="Book">

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import com.giit.www.entity.OrderBook;
44
import com.giit.www.entity.custom.AddedBookVo;
55
import com.giit.www.entity.custom.ChangedItems;
6+
import com.giit.www.entity.custom.OrderBookReviewVo;
7+
import com.giit.www.entity.custom.ReviewedBookVo;
68
import org.apache.ibatis.annotations.Param;
79

810
import java.util.List;
@@ -18,4 +20,10 @@ public interface OrderBookDao {
1820
public int usedByOtherSec(@Param("bookTitle") String bookTitle, @Param("isbn") String isbn, @Param("secId") int secId);
1921

2022
public void delete(@Param("secId") int secId, @Param("bookTitle") String bookTitle, @Param("isbn") String isbn);
23+
24+
public List<OrderBookReviewVo> findAllNotReviewedBook();
25+
26+
public void audit(@Param("secId") int secId, @Param("bookTitle") String bookTitle, @Param("isbn") String isbn);
27+
28+
public List<ReviewedBookVo> findAllReviewedBook();
2129
}

src/com/giit/www/college/dao/OrderBookDao.xml

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,20 @@
66

77
<mapper namespace="com.giit.www.college.dao.OrderBookDao">
88

9+
<resultMap id="orderBookReviewVo_map" type="OrderBookReviewVo">
10+
<result property="secId" column="sec_id"/>
11+
<result property="speciality" column="speciality"/>
12+
<result property="courseTitle" column="course_title"/>
13+
<result property="bookTitle" column="book_title"/>
14+
<result property="isbn" column="isbn"/>
15+
<result property="dateOfPrinting" column="date_of_printing"/>
16+
<result property="author" column="author"/>
17+
<result property="category" column="category"/>
18+
<result property="unitPrice" column="unitPrice"/>
19+
<result property="remark" column="remark"/>
20+
</resultMap>
921

10-
<resultMap id="addedBookInfo" type="AddedBookVo">
22+
<resultMap id="addedBookInfo_map" type="AddedBookVo">
1123
<result property="secId" column="sec_id"/>
1224
<result property="courseTitle" column="course_title"/>
1325
<collection property="bookInfoList" ofType="BookInfo">
@@ -22,13 +34,21 @@
2234
</collection>
2335
</resultMap>
2436

37+
<resultMap id="reviewedBookVo_map" type="ReviewedBookVo">
38+
<result property="bookTitle" column="book_title"/>
39+
<result property="isbn" column="isbn"/>
40+
<result property="dateOfPrinting" column="date_of_printing"/>
41+
<result property="author" column="author"/>
42+
<result property="press" column="press"/>
43+
<collection property="countList" column="count" ofType="Integer"/>
44+
</resultMap>
45+
2546
<insert id="add" parameterType="OrderBook">
26-
INSERT INTO order_book(staff_id,sec_id,book_title,isbn,remark) VALUES(#{staffId},#{secId},#{bookTitle},#{isbn},#{remark})
47+
INSERT INTO order_book(staff_id,sec_id,book_title,isbn,remark,approval) VALUES(#{staffId},#{secId},#{bookTitle},#{isbn},#{remark},#{approval})
2748
</insert>
2849

29-
30-
<select id="findAddedBookInfoList" parameterType="String" resultMap="addedBookInfo">
31-
SELECT section.sec_id,section.course_title,book.isbn,book.book_title,data_of_printing,author,press,category,unit_price,remark
50+
<select id="findAddedBookInfoList" parameterType="String" resultMap="addedBookInfo_map">
51+
SELECT section.sec_id,section.course_title,book.isbn,book.book_title,date_of_printing,author,press,category,unit_price,remark
3252
FROM order_book
3353
INNER JOIN book ON order_book.book_title = book.book_title AND order_book.isbn = book.isbn
3454
INNER JOIN section ON order_book.sec_id = section.sec_id
@@ -39,7 +59,31 @@
3959
SELECT count(*) FROM order_book WHERE book_title = #{bookTitle} AND isbn = #{isbn} AND sec_id != #{secId}
4060
</select>
4161

62+
<select id="findAllNotReviewedBook" resultMap="orderBookReviewVo_map">
63+
SELECT section.sec_id,speciality,course.course_title,book.isbn,book.book_title,
64+
date_of_printing,author,press,category,unit_price,remark
65+
FROM order_book
66+
INNER JOIN book ON order_book.isbn = book.isbn AND order_book.book_title = book.book_title
67+
INNER JOIN section ON order_book.sec_id = section.sec_id
68+
INNER JOIN course ON section.course_title = course.course_title
69+
WHERE approval = 0
70+
</select>
71+
72+
<select id="findAllReviewedBook" resultMap="reviewedBookVo_map">
73+
SELECT book.isbn,book.book_title,
74+
date_of_printing,author,press,category,
75+
(SELECT count(student_id) FROM takes WHERE order_book.sec_id = takes.sec_id) AS count
76+
FROM order_book
77+
INNER JOIN book ON order_book.isbn = book.isbn AND order_book.book_title = book.book_title
78+
WHERE approval = 1
79+
</select>
80+
81+
4282
<delete id="delete" parameterType="map">
4383
DELETE FROM order_book WHERE sec_id = #{secId} AND book_title = #{bookTitle} AND isbn = #{isbn}
4484
</delete>
85+
86+
<update id="audit" parameterType="map">
87+
UPDATE order_book SET approval = 1 WHERE sec_id = #{secId} AND book_title = #{bookTitle} AND isbn=#{isbn}
88+
</update>
4589
</mapper>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ public interface SectionDao {
2121
public List<Section> findSelectedSection(@Param("staffId") String staffId, @Param("year") String year);
2222

2323
int getSecId(String item, String s);
24+
25+
public List<Section> findAll();
2426
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.giit.www.college.dao;
2+
3+
import org.apache.ibatis.annotations.Param;
4+
5+
/**
6+
* Created by c0de8ug on 16-2-16.
7+
*/
8+
9+
public interface TakesDao {
10+
public int getStdCountInSection(int secId);
11+
12+
public void add(@Param("secId") int secId, @Param("stdId") String stdId);
13+
14+
public void delete(@Param("secId") int secId, @Param("stdId") String stdId);
15+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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.TakesDao">
8+
9+
<select id="getStdCountInSection" parameterType="int" resultType="int">
10+
SELECT count(student_id) FROM takes WHERE sec_id = #{value}
11+
</select>
12+
13+
<insert id="add" parameterType="map">
14+
INSERT INTO takes(student_id,sec_Id) VALUES(#{stdId},#{secId})
15+
</insert>
16+
17+
<delete id="delete" parameterType="map">
18+
DELETE FROM takes WHERE student_id = #{stdId} AND sec_id = #{secId}
19+
</delete>
20+
</mapper>

src/com/giit/www/college/service/OrderBookBiz.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.giit.www.entity.Section;
44
import com.giit.www.entity.custom.AddedBookVo;
55
import com.giit.www.entity.custom.ChangedItems;
6+
import com.giit.www.entity.custom.OrderBookReviewVo;
67
import com.giit.www.entity.custom.OrderBookVo;
78

89
import java.util.List;
@@ -18,4 +19,8 @@ public interface OrderBookBiz {
1819
public List<AddedBookVo> findAddedBookInfoList(String staffId);
1920

2021
public void update(ChangedItems changedItems, String staffId);
22+
23+
public void audit(List<OrderBookReviewVo> orderBookReviewVoList);
24+
25+
public List<OrderBookReviewVo> findAllNotReviewedBook();
2126
}

0 commit comments

Comments
 (0)