Browse Source

作业、预习、背诵统计完善

tags/正式3.9.0
雍文秀 1 year ago
parent
commit
fdbf40fcaf

+ 6
- 5
sapi/src/main/resources/mapper/analyze/SchoolSummaryMapper.xml View File

@@ -112,18 +112,19 @@
112 112
         select r.createid as userid, count(distinct r.reciteid)bsfbnum,
113 113
         count(distinct rs.rsid)bsstunum,
114 114
         count(distinct case when rs.rsstate!=0 then rs.rsid else null end)bscomitnum
115
-        from t_recite r left join t_recite_student rs on rs.reciteid=r.reciteid
116
-        left join t_class c on c.classid=rs.classid
117
-        where r.schoolid=#{sparams.schoolid} and rs.schoolid=#{sparams.schoolid}
115
+        from t_recite r left join t_recite_group rg on rg.reciteid=r.reciteid
116
+        left join t_recite_student rs on rs.reciteid=rg.reciteid and rs.classid=rg.classid
117
+        left join t_class c on c.classid=rg.classid
118
+        where r.schoolid=#{sparams.schoolid} and rg.schoolid=#{sparams.schoolid}
118 119
         and c.gradeid=#{sparams.gradeid} and c.year=#{sparams.year}
119 120
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
120 121
             and r.subjectid=#{sparams.subjectid}
121 122
         </if>
122 123
         <if test="sparams.starttime!=null and sparams.starttime!=0">
123
-            and r.createtime>=#{sparams.starttime}
124
+            and rg.starttime>=#{sparams.starttime}
124 125
         </if>
125 126
         <if test="sparams.stoptime!=null and sparams.stoptime!=0">
126
-            and r.createtime&lt;=#{sparams.stoptime}
127
+            and rg.starttime&lt;=#{sparams.stoptime}
127 128
         </if>
128 129
         group by r.createid
129 130
     </select>

+ 16
- 15
sapi/src/main/resources/mapper/analyze/SchoolTaskMapper.xml View File

@@ -27,10 +27,10 @@
27 27
         WHERE p.paperstate=22 AND p.schoolid=#{sparams.schoolid} AND pg.schoolid=#{sparams.schoolid}
28 28
         AND c.gradeid=#{sparams.gradeid} and c.year=#{sparams.year} AND u.userstate=1
29 29
         <if test="sparams.starttime!=null and sparams.starttime!=0">
30
-            AND p.createtime<![CDATA[ >= ]]>#{sparams.starttime}
30
+            AND pg.starttime>=#{sparams.starttime}
31 31
         </if>
32 32
         <if test="sparams.stoptime!=null and sparams.stoptime!=0">
33
-            AND p.createtime<![CDATA[ <= ]]>#{sparams.stoptime}
33
+            AND pg.stoptime <![CDATA[ <= ]]>#{sparams.stoptime}
34 34
         </if>
35 35
         GROUP BY p.subjectid ORDER BY s.subjectorder
36 36
     </select>
@@ -47,10 +47,10 @@
47 47
         where p.schoolid=#{sparams.schoolid} and p.paperstate=22 and pg.schoolid=#{sparams.schoolid}
48 48
         and c.gradeid=#{sparams.gradeid} and c.year=#{sparams.year}
49 49
         <if test="sparams.starttime!=null and sparams.starttime!=0">
50
-            AND p.createtime<![CDATA[ >= ]]>#{sparams.starttime}
50
+            AND pg.starttime>=#{sparams.starttime}
51 51
         </if>
52 52
         <if test="sparams.stoptime!=null and sparams.stoptime!=0">
53
-            AND p.createtime<![CDATA[ <= ]]>#{sparams.stoptime}
53
+            AND pg.starttime <![CDATA[ <= ]]>#{sparams.stoptime}
54 54
         </if>
55 55
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
56 56
             and p.subjectid=#{sparams.subjectid}
@@ -102,18 +102,18 @@
102 102
           SELECT r.subjectid,s.subjectname,count(distinct r.reciteid)fabunum,
103 103
          count(distinct rs.rsid) stunum,
104 104
          count(distinct case when rs.rsstate!=0 then rs.rsid else null end) commitnum
105
-         FROM t_recite r
105
+         FROM t_recite r left join t_recite_group rg on rg.reciteid=r.reciteid
106 106
           LEFT JOIN t_subject s ON r.subjectid=s.subjectid
107
-         LEFT JOIN t_recite_student rs ON r.reciteid=rs.reciteid
108
-         LEFT JOIN t_class c ON rs.classid=c.classid
107
+         LEFT JOIN t_recite_student rs ON rg.reciteid=rs.reciteid and rg.classid=rs.classid
108
+         LEFT JOIN t_class c ON rg.classid=c.classid
109 109
          LEFT JOIN T_USER U ON r.createid=u.userid
110
-         WHERE r.recitestate=22 AND r.schoolid=#{sparams.schoolid} AND rs.schoolid=#{sparams.schoolid}
110
+         WHERE r.recitestate=22 AND r.schoolid=#{sparams.schoolid} AND rg.schoolid=#{sparams.schoolid}
111 111
         AND c.gradeid=#{sparams.gradeid} and c.year=#{sparams.year} AND u.userstate=1
112 112
         <if test="sparams.starttime!=null and sparams.starttime!=0">
113
-            AND r.createtime<![CDATA[ >= ]]>#{sparams.starttime}
113
+            AND rg.starttime>=#{sparams.starttime}
114 114
         </if>
115 115
         <if test="sparams.stoptime!=null and sparams.stoptime!=0">
116
-            AND r.createtime<![CDATA[ <= ]]>#{sparams.stoptime}
116
+            AND rg.starttime <![CDATA[ <= ]]>#{sparams.stoptime}
117 117
         </if>
118 118
          GROUP BY r.subjectid ORDER BY s.subjectorder
119 119
     </select>
@@ -123,15 +123,16 @@
123 123
         select r.createid userid,count(distinct r.reciteid)fabunum,
124 124
         count(distinct rs.rsid) stunum,
125 125
         count(distinct case when rs.rsstate!=0 then rs.rsid else null end) commitnum
126
-        from t_recite r left join t_recite_student rs on rs.reciteid=r.reciteid
127
-        left join t_class c on c.classid=rs.classid
128
-        where r.schoolid=#{sparams.schoolid} and r.recitestate=22 and rs.schoolid=#{sparams.schoolid}
126
+        from t_recite r left join t_recite_group rg on rg.reciteid=r.reciteid
127
+        left join t_recite_student rs on rs.reciteid=rg.reciteid and rs.classid=rg.classid
128
+        left join t_class c on c.classid=rg.classid
129
+        where r.schoolid=#{sparams.schoolid} and r.recitestate=22 and rg.schoolid=#{sparams.schoolid}
129 130
         and c.gradeid=#{sparams.gradeid} and c.year=#{sparams.year}
130 131
         <if test="sparams.starttime!=null and sparams.starttime!=0">
131
-            AND r.createtime<![CDATA[ >= ]]>#{sparams.starttime}
132
+            AND rg.starttime>=#{sparams.starttime}
132 133
         </if>
133 134
         <if test="sparams.stoptime!=null and sparams.stoptime!=0">
134
-            AND r.createtime<![CDATA[ <= ]]>#{sparams.stoptime}
135
+            AND rg.starttime <![CDATA[ <= ]]>#{sparams.stoptime}
135 136
         </if>
136 137
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
137 138
             and r.subjectid=#{sparams.subjectid}

+ 13
- 13
sapi/src/main/resources/mapper/classreport/ClassReportMapper.xml View File

@@ -13,7 +13,7 @@
13 13
         from t_guide g left join t_guide_group gg on g.guideid=gg.guideid
14 14
         left join t_guide_group_student ggs on ggs.guideid=gg.guideid and ggs.classid=gg.classid
15 15
         left join t_class c on gg.classid=c.classid
16
-        left join t_school s on g.schoolid=s.schoolid
16
+        left join t_school s on g.schoolid=s.schoolid and gg.schoolid=s.schoolid
17 17
         where s.schoolstate=1 and s.year=c.year and c.classstate=1
18 18
         <if test="type.reporttype==1">and YEARWEEK(FROM_UNIXTIME(g.createtime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)-#{type.basenum}</if>
19 19
         <if test="type.reporttype==2">and MONTH(FROM_UNIXTIME(g.createtime))=MONTH(now())-#{type.basenum}</if>
@@ -106,16 +106,16 @@
106 106
         ,sum(case when pg.starttime&lt;=#{type.createtime} then ps.paperscore else 0 end)pscore
107 107
         ,sum(ps.userscore)uscore
108 108
         ,ifnull(truncate(sum(ps.userscore)*100/sum(case when pg.starttime&lt;=#{type.createtime} then ps.paperscore else 0 end),2),0)zqrate
109
-        ,from_unixtime(p.createtime,'%Y-%m-%d')begindate,count(distinct p.paperid)fbnum
109
+        ,from_unixtime(pg.starttime,'%Y-%m-%d')begindate,count(distinct p.paperid)fbnum
110 110
         from t_paper p left join t_paper_class pg on p.paperid=pg.paperid
111 111
         left join t_paper_student ps on ps.paperid=p.paperid and ps.classid=pg.classid
112 112
         left join t_class c on pg.classid=c.classid
113
-        left join t_school s on p.schoolid=s.schoolid
113
+        left join t_school s on p.schoolid=s.schoolid and pg.schoolid=s.schoolid
114 114
         where p.paperstate=22 and s.schoolstate=1 and s.year=c.year and c.classstate=1
115
-        <if test="type.reporttype==1">and YEARWEEK(FROM_UNIXTIME(p.createtime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)-#{type.basenum}</if>
116
-        <if test="type.reporttype==2">and MONTH(FROM_UNIXTIME(p.createtime))=MONTH(now())-#{type.basenum}</if>
117
-        <if test="type.reporttype==3">and YEARWEEK(FROM_UNIXTIME(p.createtime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)</if>
118
-        <if test="type.reporttype==4">and MONTH(FROM_UNIXTIME(p.createtime))=MONTH(now())</if>
115
+        <if test="type.reporttype==1">and YEARWEEK(FROM_UNIXTIME(pg.starttime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)-#{type.basenum}</if>
116
+        <if test="type.reporttype==2">and MONTH(FROM_UNIXTIME(pg.starttime))=MONTH(now())-#{type.basenum}</if>
117
+        <if test="type.reporttype==3">and YEARWEEK(FROM_UNIXTIME(pg.starttime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)</if>
118
+        <if test="type.reporttype==4">and MONTH(FROM_UNIXTIME(pg.starttime))=MONTH(now())</if>
119 119
         <if test="type.gradeid!=null">and c.gradeid=#{type.gradeid}</if>
120 120
         <if test="type.classtype!=null">and c.classtype=#{type.classtype}</if>
121 121
         <if test="type.subjectid!=null">and p.subjectid=#{type.subjectid}</if>
@@ -153,16 +153,16 @@
153 153
         ,sum(case when rs.rsstate!=0 then 1 else 0 end)*100 pscore
154 154
         ,sum(rs.userscore)uscore
155 155
         ,ifnull(truncate(sum(rs.userscore)*100/(sum(case when rs.rsstate!=0 then 1 else 0 end)*100),2),0)zqrate
156
-        ,from_unixtime(r.createtime,'%Y-%m-%d')begindate,count(distinct r.reciteid)fbnum
156
+        ,from_unixtime(rg.starttime,'%Y-%m-%d')begindate,count(distinct r.reciteid)fbnum
157 157
         from t_recite r left join t_recite_group rg on r.reciteid=rg.reciteid
158 158
         left join t_recite_student rs on rs.reciteid=r.reciteid and rs.classid=rg.classid
159 159
         left join t_class c on rg.classid=c.classid
160
-        left join t_school s on r.schoolid=s.schoolid
160
+        left join t_school s on r.schoolid=s.schoolid and rg.schoolid=s.schoolid
161 161
         where r.recitestate=22 and s.schoolstate=1 and s.year=c.year and c.classstate=1
162
-        <if test="type.reporttype==1">and YEARWEEK(FROM_UNIXTIME(r.createtime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)-#{type.basenum}</if>
163
-        <if test="type.reporttype==2">and MONTH(FROM_UNIXTIME(r.createtime))=MONTH(now())-#{type.basenum}</if>
164
-        <if test="type.reporttype==3">and YEARWEEK(FROM_UNIXTIME(r.createtime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)</if>
165
-        <if test="type.reporttype==4">and MONTH(FROM_UNIXTIME(r.createtime))=MONTH(now())</if>
162
+        <if test="type.reporttype==1">and YEARWEEK(FROM_UNIXTIME(rg.starttime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)-#{type.basenum}</if>
163
+        <if test="type.reporttype==2">and MONTH(FROM_UNIXTIME(rg.starttime))=MONTH(now())-#{type.basenum}</if>
164
+        <if test="type.reporttype==3">and YEARWEEK(FROM_UNIXTIME(rg.starttime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)</if>
165
+        <if test="type.reporttype==4">and MONTH(FROM_UNIXTIME(rg.starttime))=MONTH(now())</if>
166 166
         <if test="type.gradeid!=null">and c.gradeid=#{type.gradeid}</if>
167 167
         <if test="type.classtype!=null">and c.classtype=#{type.classtype}</if>
168 168
         <if test="type.subjectid!=null">and r.subjectid=#{type.subjectid}</if>

+ 1
- 1
sapi/src/main/resources/mapper/itemtool/StudentTodoMapper.xml View File

@@ -85,7 +85,7 @@
85 85
                 LEFT JOIN t_recite_group rg ON rs.reciteid=rg.reciteid AND rg.classid=rs.classid
86 86
                 where rg.starttime&lt;=#{timestamp} and rs.studentid=#{todo.studentid} and rs.rsstate=0
87 87
                 <if test="todo.showtime!=null and todo.showtime!=0">
88
-                    and r.createtime>=#{todo.showtime}
88
+                    and rg.starttime>=#{todo.showtime}
89 89
                 </if>
90 90
                 <if test="todo.subjectid!=null and todo.subjectid!='0'.toString() and todo.subjectid!=''">
91 91
                     and r.subjectid=#{todo.subjectid}

+ 14
- 13
sapi/src/main/resources/mapper/region/RPaperAnalyzeMapper.xml View File

@@ -5,7 +5,7 @@
5 5
     <!--作业数量统计——作业数量-->
6 6
     <select id="getRegionPaperNumPaper" resultType="java.lang.Integer">
7 7
       select count(DISTINCT pg.paperid) from t_paper_class pg left join t_paper p on pg.paperid=p.paperid
8
-        LEFT JOIN t_school s on p.schoolid=s.schoolid
8
+        LEFT JOIN t_school s on p.schoolid=s.schoolid and pg.schoolid=s.schoolid
9 9
         left join t_class c on c.classid=pg.classid
10 10
         where s.schoollevel=#{param.level}
11 11
         <if test="param.begintime!=null and param.begintime!=0">
@@ -21,7 +21,7 @@
21 21
     <!--作业数量统计——预习数量-->
22 22
     <select id="getRegionPaperNumPreview" resultType="java.lang.Integer">
23 23
         select count(DISTINCT g.guideid) from t_guide_group gg left join t_guide g on gg.guideid=g.guideid
24
-        LEFT JOIN t_school s on g.schoolid=s.schoolid
24
+        LEFT JOIN t_school s on g.schoolid=s.schoolid and gg.schoolid=s.schoolid
25 25
         left join t_class c on c.classid=gg.classid
26 26
         where s.schoollevel=#{param.level}
27 27
         <if test="param.begintime!=null and param.begintime!=0">
@@ -37,7 +37,7 @@
37 37
     <!--作业数量统计——背诵数量-->
38 38
     <select id="getRegionPaperNumRecite" resultType="java.lang.Integer">
39 39
        select count(DISTINCT rg.reciteid) from t_recite_group rg left join t_recite r on rg.reciteid=r.reciteid
40
-        LEFT JOIN t_school s on r.schoolid=s.schoolid
40
+        LEFT JOIN t_school s on r.schoolid=s.schoolid and rg.schoolid=s.schoolid
41 41
         left join t_class c on c.classid=rg.classid
42 42
         where s.schoollevel=#{param.level}
43 43
         <if test="param.begintime!=null and param.begintime!=0">
@@ -93,7 +93,7 @@
93 93
         count(case when ps.psstate!=0 and ps.pschecked=1 then ps.psid else null end) checknum
94 94
         from t_paper p left join t_paper_class pg on p.paperid=pg.paperid
95 95
         left join t_paper_student ps on ps.paperid=p.paperid and ps.classid=pg.classid
96
-        left join t_school s on p.schoolid=s.schoolid
96
+        left join t_school s on p.schoolid=s.schoolid and pg.schoolid=s.schoolid
97 97
         left join t_class c on c.classid=pg.classid
98 98
         where s.schoollevel=#{param.level}
99 99
         <if test="param.begintime!=null and param.begintime!=0">
@@ -115,7 +115,7 @@
115 115
         count(case when rs.rsstate=1 then rs.rsid else null end)commitasnum
116 116
         from t_recite r left join t_recite_group rg on r.reciteid=rg.reciteid
117 117
         left join t_recite_student rs on rs.reciteid=r.reciteid and rs.classid=rg.classid
118
-        left join t_school s on r.schoolid=s.schoolid
118
+        left join t_school s on r.schoolid=s.schoolid and rg.schoolid=s.schoolid
119 119
         left join t_class c on c.classid=rg.classid
120 120
         where s.schoollevel=#{param.level}
121 121
         <if test="param.begintime!=null and param.begintime!=0">
@@ -137,7 +137,7 @@
137 137
         from t_guide g
138 138
         left join t_guide_group gg on gg.guideid=g.guideid
139 139
         left join t_guide_group_student ggs on ggs.guideid=g.guideid and ggs.classid=gg.classid
140
-        left join t_school s on s.schoolid=g.schoolid
140
+        left join t_school s on s.schoolid=g.schoolid and s.schoolid=gg.schoolid
141 141
         left join t_class c on c.classid=gg.classid
142 142
         where s.schoollevel=#{param.level}
143 143
         <if test="param.begintime!=null and param.begintime!=0">
@@ -157,12 +157,13 @@
157 157
         select s.schoolid,s.schoolname,s.shortname,
158 158
         count(ps.psid) as stunum,
159 159
         ifnull(SUM(ps.costtime),0) costtime
160
-         from t_paper_student ps
161
-        left join t_school s on ps.schoolid=s.schoolid
162
-        left join t_class c on c.classid=ps.classid
160
+        from t_paper p left join t_paper_class pg on p.paperid=pg.paperid
161
+        left join t_school s on p.schoolid=s.schoolid and pg.schoolid=s.schoolid
162
+        left join t_paper_student ps on pg.paperid=ps.paperid and pg.classid=ps.classid and ps.psstate!=0
163
+        left join t_class c on c.classid=pg.classid
163 164
         where s.schoollevel=#{param.level}
164 165
         <if test="param.begintime!=null and param.begintime!=0">
165
-            and ps.stoptime between #{param.begintime} and #{param.endtime}
166
+            and pg.starttime between #{param.begintime} and #{param.endtime}
166 167
         </if>
167 168
         <if test="param.year!=null and param.year!=0">
168 169
             and c.year=#{param.year}
@@ -170,7 +171,7 @@
170 171
         <if test="param.year==null || param.year==0">
171 172
             and c.year=s.year
172 173
         </if>
173
-        group by ps.schoolid order by ps.schoolid
174
+        group by s.schoolid order by s.schoolid
174 175
     </select>
175 176
     <!--人均用时——预习-->
176 177
     <select id="listRegionSchoolUsetimePreview" resultType="java.util.Map">
@@ -179,11 +180,11 @@
179 180
         sum(gs.costtime) costtime
180 181
         from t_guide_group_student gs
181 182
         left join t_guide g on gs.guideid=g.guideid
182
-        left join t_school s on g.schoolid=s.schoolid
183
+        left join t_school s on g.schoolid=s.schoolid and gs.schoolid=s.schoolid
183 184
         left join t_class c on c.classid=gs.classid
184 185
         where s.schoollevel=#{param.level} and gs.readtime>0
185 186
         <if test="param.begintime!=null and param.begintime!=0">
186
-            and gs.readtime between #{param.begintime} and #{param.endtime}
187
+            and g.createtime between #{param.begintime} and #{param.endtime}
187 188
         </if>
188 189
         <if test="param.year!=null and param.year!=0">
189 190
             and c.year=#{param.year}

+ 12
- 8
sapi/src/main/resources/mapper/region/RegionAnalyzeMapper.xml View File

@@ -81,10 +81,11 @@
81 81
         count(distinct ps.psid)stunum,
82 82
         count(distinct case when ps.psstate!=0 then ps.psid else null end)commitnum,
83 83
         count(distinct case when ps.psstate!=0 and ps.pschecked=1 then ps.psid else null end)checknum
84
-        from t_paper_class pg
85
-        right join t_school s on pg.schoolid=s.schoolid and pg.pgstate=22
84
+        from t_paper p
85
+        right join t_school s on p.schoolid=s.schoolid and p.paperstate=22
86
+        left join t_paper_class pg on p.paperid = pg.paperid and pg.schoolid=s.schoolid
86 87
         and pg.starttime between #{param.begintime} and #{param.endtime}
87
-        left join t_paper_student ps on ps.paperid=pg.paperid
88
+        left join t_paper_student ps on ps.paperid=pg.paperid and ps.classid=pg.classid
88 89
         left join t_class c on c.classid=pg.classid
89 90
         where s.schoolstate=1
90 91
         <if test="param.year!=null and param.year!=0">
@@ -102,7 +103,7 @@
102 103
         count(distinct case when gs.readtime>0 then gs.rgsid else null end) commitnum
103 104
         from t_guide g right join t_school s on g.schoolid=s.schoolid
104 105
         and g.createtime between #{param.begintime} and #{param.endtime}
105
-        left join t_guide_group_student gs on gs.guideid=g.guideid
106
+        left join t_guide_group_student gs on gs.guideid=g.guideid and gs.schoolid=s.schoolid
106 107
         left join t_class c on c.classid=gs.classid
107 108
         where s.schoolstate=1
108 109
         <if test="param.year!=null and param.year!=0">
@@ -119,7 +120,8 @@
119 120
         select s.schoolid,s.schoolname,s.shortname,rg.reciteid as wid,
120 121
         count(distinct rs.rsid) stunum,
121 122
         count(distinct case when rs.rsstate!=0 then rs.rsid else null end) commitnum
122
-        from t_recite_group rg right join t_school s on rg.schoolid=s.schoolid
123
+        from t_recite r right join t_school s on r.schoolid=s.schoolid
124
+        left join t_recite_group rg on r.reciteid=rg.reciteid and rg.schoolid=s.schoolid
123 125
         and rg.starttime between #{param.begintime} and #{param.endtime}
124 126
         left join t_recite_student rs on rs.reciteid=rg.reciteid and rs.classid=rg.classid
125 127
         left join t_class c on c.classid=rg.classid
@@ -151,9 +153,11 @@
151 153
     <!--布置作业统计_布置作业次数-->
152 154
     <select id="listPapernumMonth" resultType="com.xhkjedu.sapi.vo.region.WorkVo">
153 155
         select s.schoolid,s.schoolname,s.shortname,count(distinct pg.paperid) num
154
-        from t_paper_class pg left join t_class c on c.classid=pg.classid
155
-        right join t_school s on pg.schoolid=s.schoolid and pg.pgstate=22
156
-        and pg.createtime between #{param.begintime} and #{param.endtime}
156
+        from t_paper p
157
+        right join t_school s on p.schoolid=s.schoolid and p.paperstate=22
158
+        left join t_paper_class pg on p.paperid=pg.paperid and s.schoolid=pg.schoolid
159
+        and pg.starttime between #{param.begintime} and #{param.endtime}
160
+        left join t_class c on c.classid=pg.classid
157 161
         where s.schoolstate=1
158 162
         <if test="param.year!=null and param.year!=0">
159 163
             and c.year=#{param.year}

+ 3
- 3
sapi/src/main/resources/mapper/region/SAnalyzeMapper.xml View File

@@ -71,8 +71,8 @@
71 71
         from t_paper_class pg right join t_paper p on pg.paperid=p.paperid
72 72
         left join t_subject s on p.subjectid=s.subjectid
73 73
         left join t_class c on pg.classid=c.classid
74
-        left join t_paper_student ps on ps.paperid=pg.paperid
75
-        where c.year=#{param.year} and p.schoolid=#{param.schoolid} and pg.pgstate=22
74
+        left join t_paper_student ps on ps.paperid=pg.paperid and ps.classid=pg.classid
75
+        where c.year=#{param.year} and p.schoolid=#{param.schoolid} and pg.pgstate=22 and pg.schoolid=#{param.schoolid}
76 76
         and pg.starttime between #{param.begintime} and #{param.endtime}
77 77
         group by c.gradeid,p.subjectid
78 78
     </select>
@@ -83,7 +83,7 @@
83 83
         from t_guide g left join t_subject s on g.subjectid=s.subjectid
84 84
         left join t_guide_group_student gs on gs.guideid=g.guideid
85 85
         left join t_class c on gs.classid=c.classid
86
-        where c.year=#{param.year} and g.schoolid=#{param.schoolid}
86
+        where c.year=#{param.year} and g.schoolid=#{param.schoolid} and gs.schoolid=#{param.schoolid}
87 87
         and g.createtime between #{param.begintime} and #{param.endtime}
88 88
         group by c.gradeid,g.subjectid
89 89
     </select>

+ 1
- 1
sstudy/src/main/resources/mapper/paper/PaperAnalyzeMapper.xml View File

@@ -313,7 +313,7 @@
313 313
         from t_paper_class pg left join t_class c on pg.classid = c.classid
314 314
         left join t_school s on c.schoolid = s.schoolid
315 315
         where pg.paperid=#{paperid}
316
-        group by pg.classid order by c.schoolid <![CDATA[ <> ]]> #{schoolid},c.gradeid,c.classtype,c.classorder
316
+        group by pg.classid order by case c.schoolid when #{schoolid} then 0 else c.schoolid end,c.gradeid,c.classtype,c.classorder
317 317
     </select>
318 318
     <!--作业班级学生列表-->
319 319
     <select id="listPaperClassStudent" resultType="com.xhkjedu.sstudy.vo.gradeclass.CStudentVo">

+ 19
- 9
sstudy/src/main/resources/mapper/paper/PaperMapper.xml View File

@@ -79,7 +79,7 @@
79 79
                     select="listClass" column="{paperid=paperid,createid=createid,checkid=checkid,checktype=checktype,logschoolid=logschoolid,classids=classids}">
80 80
         </collection>
81 81
         <collection property="checklist" ofType="java.util.Map" javaType="java.util.List"
82
-                    select="listPaperCheckStu" column="{paperid=paperid,checktype=checktype,logschoolid=logschoolid}">
82
+                    select="listPaperCheckStu" column="{paperid=paperid,checktype=checktype,logschoolid=logschoolid,classids=classids}">
83 83
             <result property="userid" column="userid"></result>
84 84
             <result property="username" column="username"></result>
85 85
             <result property="classid" column="classid"></result>
@@ -134,7 +134,8 @@
134 134
         <if test="classids!=null and classids!=''">
135 135
             and ps.classid in(${classids})
136 136
         </if>
137
-        group by ps.classid order by c.gradeid,c.classtype,c.classorder
137
+        group by ps.classid
138
+        order by case c.schoolid when #{logschoolid} then 0 else c.schoolid end,c.gradeid,c.classtype,c.classorder
138 139
     </select>
139 140
     <!--本校作业班级批阅人-->
140 141
     <resultMap id="checkUserResult" type="java.util.Map">
@@ -158,17 +159,25 @@
158 159
            from t_paper_class pg left join t_school s on pg.schoolid=s.schoolid
159 160
            left join t_user u on pg.checkid=u.userid
160 161
            left join t_class c on pg.classid=c.classid
161
-           where pg.paperid=#{paperid} and pg.schoolid=#{logschoolid}
162
-           order by c.gradeid,c.classtype,c.classorder,convert(u.username using gbk)
162
+           where pg.paperid=#{paperid}
163
+             <if test="classids!=null and classids!=''">
164
+                 and pg.classid in(${classids})
165
+             </if>
166
+             order by case c.schoolid when #{logschoolid} then 0 else c.schoolid end,
167
+             c.gradeid,c.classtype,c.classorder,convert(u.username using gbk)
163 168
        </if>
164 169
        <if test="checktype==3">
165 170
            select ps.checkid userid,u.username,c.classid,c.classname,c.gradeid,ps.schoolid,s.schoolname
166 171
            from t_paper_student ps left join t_school s on ps.schoolid=s.schoolid
167 172
            left join t_user u on ps.checkid=u.userid
168 173
            left join t_class c on ps.classid=c.classid
169
-           where ps.paperid=#{paperid} and ps.schoolid=#{logschoolid}
174
+           where ps.paperid=#{paperid}
175
+           <if test="classids!=null and classids!=''">
176
+               and ps.classid in(${classids})
177
+           </if>
170 178
            group by ps.classid,ps.checkid
171
-           order by c.gradeid,c.classtype,c.classorder,convert(u.username using gbk)
179
+           order by case c.schoolid when #{logschoolid} then 0 else c.schoolid end,
180
+           c.gradeid,c.classtype,c.classorder,convert(u.username using gbk)
172 181
        </if>
173 182
         <if test="checktype!=1 and checktype!=3">
174 183
             select checktype from t_paper where paperid=#{paperid}
@@ -297,10 +306,10 @@
297 306
         where p.createid=#{paper.teacherid} and c.gradeid=#{paper.gradeid} and c.year=#{paper.year}
298 307
         and pg.schoolid=#{paper.schoolid}
299 308
         <if test="paper.starttime!=null and paper.starttime!=0">
300
-            and p.createtime>=#{paper.starttime}
309
+            and pg.starttime>=#{paper.starttime}
301 310
         </if>
302 311
         <if test="paper.stoptime!=null and paper.stoptime!=0">
303
-            and p.createtime&lt;=#{paper.stoptime}
312
+            and pg.starttime&lt;=#{paper.stoptime}
304 313
         </if>
305 314
         <if test="paper.classid!=null and paper.classid!=0">
306 315
             and c.classid=#{paper.classid}
@@ -358,7 +367,8 @@
358 367
         <if test="checkid!=null and checkid!=0">
359 368
             and pg.checkid=#{checkid}
360 369
         </if>
361
-        group by pg.classid order by c.schoolid <![CDATA[ <> ]]> #{schoolid},c.gradeid,c.classtype,c.classorder
370
+        group by pg.classid
371
+        order by case c.schoolid when #{schoolid} then 0 else c.schoolid end,c.gradeid,c.classtype,c.classorder
362 372
     </select>
363 373
     <!--根据作业id获取作业分类-->
364 374
     <select id="getPaperTypeById" resultType="java.lang.Integer">

+ 1
- 1
sstudy/src/main/resources/mapper/paper/PaperTeaAppMapper.xml View File

@@ -82,7 +82,7 @@
82 82
             and pg.checkid=#{checkid}
83 83
         </if>-->
84 84
         group by pg.classid
85
-        order by pg.schoolid <![CDATA[ <> ]]> #{schoolid},c.classtype,c.classorder,c.classid
85
+        order by case c.schoolid when #{schoolid} then 0 else c.schoolid,c.classtype,c.classorder,c.classid
86 86
     </select>
87 87
 
88 88
     <!--作业报告-->

+ 1
- 1
sstudy/src/main/resources/mapper/resource/GuideGroupMapper.xml View File

@@ -66,6 +66,6 @@
66 66
             and gg.classid in(${guide.classids})
67 67
         </if>
68 68
         group by gg.classid
69
-        order by s.schoolid <![CDATA[ <> ]]> #{guide.schoolid},c.gradeid,c.classtype,c.classorder
69
+        order by case c.schoolid when #{guide.schoolid} then 0 else c.schoolid end,c.gradeid,c.classtype,c.classorder
70 70
     </select>
71 71
 </mapper>

+ 1
- 1
suser/src/main/resources/mapper/system/UserMapper.xml View File

@@ -156,7 +156,7 @@
156 156
         <if test="classtype==null or classtype==0">
157 157
             and c.classtype!=99
158 158
         </if>
159
-        order by c.schoolid <![CDATA[ <> ]]> #{schoolid},c.gradeid,c.classtype,c.classorder
159
+        order by case c.schoolid when #{schoolid} then 0 else c.schoolid end,c.gradeid,c.classtype,c.classorder
160 160
     </select>
161 161
     <!--教师基本信息-->
162 162
     <select id="getTeacherInfo" resultMap="teacherInfoMap">

Loading…
Cancel
Save