-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCourseItemAction.java
More file actions
83 lines (72 loc) · 1.79 KB
/
CourseItemAction.java
File metadata and controls
83 lines (72 loc) · 1.79 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package action;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.logging.SimpleFormatter;
import dao.CourseDao;
import dao.SeriesItemDao;
import model.Course;
import model.CourseSeriesItem;
public class CourseItemAction {
//附表数据插入
public int addItem(CourseSeriesItem csi) throws SQLException
{
SeriesItemDao hd = new SeriesItemDao();
return hd.add(csi);
}
//查询数据group by
public List<CourseSeriesItem> get(Course cr,List<Integer> notin) throws SQLException
{
String ni="(0";
for(int i=0;i<notin.size();i++)
{
ni += ","+notin.get(i);
}
ni += ")";
List<Map> wh = new ArrayList();
Map k = new HashMap();
k.put("pre", "and");
k.put("field", "classDate");
k.put("relation", "=");
k.put("value", "'"+cr.getClassDate()+"'");
wh.add(k);
Map m = new HashMap();
m.put("pre", "and");
m.put("field", "seriesId");
m.put("relation", " not in ");
m.put("value", ni);
wh.add(m);
SeriesItemDao hd = new SeriesItemDao();
return hd.get(wh);
}
//普通数据获取
public List<CourseSeriesItem> getCommon(Course cr,List<Integer> in) throws SQLException
{
String ni="(0";
for(int i=0;i<in.size();i++)
{
ni += ","+in.get(i);
}
ni += ")";
List<Map> wh = new ArrayList();
Map m = new HashMap();
m.put("pre", "and");
m.put("field", "courseId");
m.put("relation", " in ");
m.put("value", ni);
wh.add(m);
SeriesItemDao hd = new SeriesItemDao();
return hd.get(wh);
}
//最普通的get
public List<CourseSeriesItem> getCommon(List<Map> wh) throws SQLException
{
SeriesItemDao hd = new SeriesItemDao();
return hd.get(wh);
}
}