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
         select r.createid as userid, count(distinct r.reciteid)bsfbnum,
112
         select r.createid as userid, count(distinct r.reciteid)bsfbnum,
113
         count(distinct rs.rsid)bsstunum,
113
         count(distinct rs.rsid)bsstunum,
114
         count(distinct case when rs.rsstate!=0 then rs.rsid else null end)bscomitnum
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
         and c.gradeid=#{sparams.gradeid} and c.year=#{sparams.year}
119
         and c.gradeid=#{sparams.gradeid} and c.year=#{sparams.year}
119
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
120
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
120
             and r.subjectid=#{sparams.subjectid}
121
             and r.subjectid=#{sparams.subjectid}
121
         </if>
122
         </if>
122
         <if test="sparams.starttime!=null and sparams.starttime!=0">
123
         <if test="sparams.starttime!=null and sparams.starttime!=0">
123
-            and r.createtime>=#{sparams.starttime}
124
+            and rg.starttime>=#{sparams.starttime}
124
         </if>
125
         </if>
125
         <if test="sparams.stoptime!=null and sparams.stoptime!=0">
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
         </if>
128
         </if>
128
         group by r.createid
129
         group by r.createid
129
     </select>
130
     </select>

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

27
         WHERE p.paperstate=22 AND p.schoolid=#{sparams.schoolid} AND pg.schoolid=#{sparams.schoolid}
27
         WHERE p.paperstate=22 AND p.schoolid=#{sparams.schoolid} AND pg.schoolid=#{sparams.schoolid}
28
         AND c.gradeid=#{sparams.gradeid} and c.year=#{sparams.year} AND u.userstate=1
28
         AND c.gradeid=#{sparams.gradeid} and c.year=#{sparams.year} AND u.userstate=1
29
         <if test="sparams.starttime!=null and sparams.starttime!=0">
29
         <if test="sparams.starttime!=null and sparams.starttime!=0">
30
-            AND p.createtime<![CDATA[ >= ]]>#{sparams.starttime}
30
+            AND pg.starttime>=#{sparams.starttime}
31
         </if>
31
         </if>
32
         <if test="sparams.stoptime!=null and sparams.stoptime!=0">
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
         </if>
34
         </if>
35
         GROUP BY p.subjectid ORDER BY s.subjectorder
35
         GROUP BY p.subjectid ORDER BY s.subjectorder
36
     </select>
36
     </select>
47
         where p.schoolid=#{sparams.schoolid} and p.paperstate=22 and pg.schoolid=#{sparams.schoolid}
47
         where p.schoolid=#{sparams.schoolid} and p.paperstate=22 and pg.schoolid=#{sparams.schoolid}
48
         and c.gradeid=#{sparams.gradeid} and c.year=#{sparams.year}
48
         and c.gradeid=#{sparams.gradeid} and c.year=#{sparams.year}
49
         <if test="sparams.starttime!=null and sparams.starttime!=0">
49
         <if test="sparams.starttime!=null and sparams.starttime!=0">
50
-            AND p.createtime<![CDATA[ >= ]]>#{sparams.starttime}
50
+            AND pg.starttime>=#{sparams.starttime}
51
         </if>
51
         </if>
52
         <if test="sparams.stoptime!=null and sparams.stoptime!=0">
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
         </if>
54
         </if>
55
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
55
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
56
             and p.subjectid=#{sparams.subjectid}
56
             and p.subjectid=#{sparams.subjectid}
102
           SELECT r.subjectid,s.subjectname,count(distinct r.reciteid)fabunum,
102
           SELECT r.subjectid,s.subjectname,count(distinct r.reciteid)fabunum,
103
          count(distinct rs.rsid) stunum,
103
          count(distinct rs.rsid) stunum,
104
          count(distinct case when rs.rsstate!=0 then rs.rsid else null end) commitnum
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
           LEFT JOIN t_subject s ON r.subjectid=s.subjectid
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
          LEFT JOIN T_USER U ON r.createid=u.userid
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
         AND c.gradeid=#{sparams.gradeid} and c.year=#{sparams.year} AND u.userstate=1
111
         AND c.gradeid=#{sparams.gradeid} and c.year=#{sparams.year} AND u.userstate=1
112
         <if test="sparams.starttime!=null and sparams.starttime!=0">
112
         <if test="sparams.starttime!=null and sparams.starttime!=0">
113
-            AND r.createtime<![CDATA[ >= ]]>#{sparams.starttime}
113
+            AND rg.starttime>=#{sparams.starttime}
114
         </if>
114
         </if>
115
         <if test="sparams.stoptime!=null and sparams.stoptime!=0">
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
         </if>
117
         </if>
118
          GROUP BY r.subjectid ORDER BY s.subjectorder
118
          GROUP BY r.subjectid ORDER BY s.subjectorder
119
     </select>
119
     </select>
123
         select r.createid userid,count(distinct r.reciteid)fabunum,
123
         select r.createid userid,count(distinct r.reciteid)fabunum,
124
         count(distinct rs.rsid) stunum,
124
         count(distinct rs.rsid) stunum,
125
         count(distinct case when rs.rsstate!=0 then rs.rsid else null end) commitnum
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
         and c.gradeid=#{sparams.gradeid} and c.year=#{sparams.year}
130
         and c.gradeid=#{sparams.gradeid} and c.year=#{sparams.year}
130
         <if test="sparams.starttime!=null and sparams.starttime!=0">
131
         <if test="sparams.starttime!=null and sparams.starttime!=0">
131
-            AND r.createtime<![CDATA[ >= ]]>#{sparams.starttime}
132
+            AND rg.starttime>=#{sparams.starttime}
132
         </if>
133
         </if>
133
         <if test="sparams.stoptime!=null and sparams.stoptime!=0">
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
         </if>
136
         </if>
136
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
137
         <if test="sparams.subjectid!=null and sparams.subjectid!='0'.toString() and sparams.subjectid!=''">
137
             and r.subjectid=#{sparams.subjectid}
138
             and r.subjectid=#{sparams.subjectid}

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

13
         from t_guide g left join t_guide_group gg on g.guideid=gg.guideid
13
         from t_guide g left join t_guide_group gg on g.guideid=gg.guideid
14
         left join t_guide_group_student ggs on ggs.guideid=gg.guideid and ggs.classid=gg.classid
14
         left join t_guide_group_student ggs on ggs.guideid=gg.guideid and ggs.classid=gg.classid
15
         left join t_class c on gg.classid=c.classid
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
         where s.schoolstate=1 and s.year=c.year and c.classstate=1
17
         where s.schoolstate=1 and s.year=c.year and c.classstate=1
18
         <if test="type.reporttype==1">and YEARWEEK(FROM_UNIXTIME(g.createtime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)-#{type.basenum}</if>
18
         <if test="type.reporttype==1">and YEARWEEK(FROM_UNIXTIME(g.createtime,'%Y-%m-%d'),1)=YEARWEEK(now(),1)-#{type.basenum}</if>
19
         <if test="type.reporttype==2">and MONTH(FROM_UNIXTIME(g.createtime))=MONTH(now())-#{type.basenum}</if>
19
         <if test="type.reporttype==2">and MONTH(FROM_UNIXTIME(g.createtime))=MONTH(now())-#{type.basenum}</if>
106
         ,sum(case when pg.starttime&lt;=#{type.createtime} then ps.paperscore else 0 end)pscore
106
         ,sum(case when pg.starttime&lt;=#{type.createtime} then ps.paperscore else 0 end)pscore
107
         ,sum(ps.userscore)uscore
107
         ,sum(ps.userscore)uscore
108
         ,ifnull(truncate(sum(ps.userscore)*100/sum(case when pg.starttime&lt;=#{type.createtime} then ps.paperscore else 0 end),2),0)zqrate
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
         from t_paper p left join t_paper_class pg on p.paperid=pg.paperid
110
         from t_paper p left join t_paper_class pg on p.paperid=pg.paperid
111
         left join t_paper_student ps on ps.paperid=p.paperid and ps.classid=pg.classid
111
         left join t_paper_student ps on ps.paperid=p.paperid and ps.classid=pg.classid
112
         left join t_class c on pg.classid=c.classid
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
         where p.paperstate=22 and s.schoolstate=1 and s.year=c.year and c.classstate=1
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
         <if test="type.gradeid!=null">and c.gradeid=#{type.gradeid}</if>
119
         <if test="type.gradeid!=null">and c.gradeid=#{type.gradeid}</if>
120
         <if test="type.classtype!=null">and c.classtype=#{type.classtype}</if>
120
         <if test="type.classtype!=null">and c.classtype=#{type.classtype}</if>
121
         <if test="type.subjectid!=null">and p.subjectid=#{type.subjectid}</if>
121
         <if test="type.subjectid!=null">and p.subjectid=#{type.subjectid}</if>
153
         ,sum(case when rs.rsstate!=0 then 1 else 0 end)*100 pscore
153
         ,sum(case when rs.rsstate!=0 then 1 else 0 end)*100 pscore
154
         ,sum(rs.userscore)uscore
154
         ,sum(rs.userscore)uscore
155
         ,ifnull(truncate(sum(rs.userscore)*100/(sum(case when rs.rsstate!=0 then 1 else 0 end)*100),2),0)zqrate
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
         from t_recite r left join t_recite_group rg on r.reciteid=rg.reciteid
157
         from t_recite r left join t_recite_group rg on r.reciteid=rg.reciteid
158
         left join t_recite_student rs on rs.reciteid=r.reciteid and rs.classid=rg.classid
158
         left join t_recite_student rs on rs.reciteid=r.reciteid and rs.classid=rg.classid
159
         left join t_class c on rg.classid=c.classid
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
         where r.recitestate=22 and s.schoolstate=1 and s.year=c.year and c.classstate=1
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
         <if test="type.gradeid!=null">and c.gradeid=#{type.gradeid}</if>
166
         <if test="type.gradeid!=null">and c.gradeid=#{type.gradeid}</if>
167
         <if test="type.classtype!=null">and c.classtype=#{type.classtype}</if>
167
         <if test="type.classtype!=null">and c.classtype=#{type.classtype}</if>
168
         <if test="type.subjectid!=null">and r.subjectid=#{type.subjectid}</if>
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
                 LEFT JOIN t_recite_group rg ON rs.reciteid=rg.reciteid AND rg.classid=rs.classid
85
                 LEFT JOIN t_recite_group rg ON rs.reciteid=rg.reciteid AND rg.classid=rs.classid
86
                 where rg.starttime&lt;=#{timestamp} and rs.studentid=#{todo.studentid} and rs.rsstate=0
86
                 where rg.starttime&lt;=#{timestamp} and rs.studentid=#{todo.studentid} and rs.rsstate=0
87
                 <if test="todo.showtime!=null and todo.showtime!=0">
87
                 <if test="todo.showtime!=null and todo.showtime!=0">
88
-                    and r.createtime>=#{todo.showtime}
88
+                    and rg.starttime>=#{todo.showtime}
89
                 </if>
89
                 </if>
90
                 <if test="todo.subjectid!=null and todo.subjectid!='0'.toString() and todo.subjectid!=''">
90
                 <if test="todo.subjectid!=null and todo.subjectid!='0'.toString() and todo.subjectid!=''">
91
                     and r.subjectid=#{todo.subjectid}
91
                     and r.subjectid=#{todo.subjectid}

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

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

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

81
         count(distinct ps.psid)stunum,
81
         count(distinct ps.psid)stunum,
82
         count(distinct case when ps.psstate!=0 then ps.psid else null end)commitnum,
82
         count(distinct case when ps.psstate!=0 then ps.psid else null end)commitnum,
83
         count(distinct case when ps.psstate!=0 and ps.pschecked=1 then ps.psid else null end)checknum
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
         and pg.starttime between #{param.begintime} and #{param.endtime}
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
         left join t_class c on c.classid=pg.classid
89
         left join t_class c on c.classid=pg.classid
89
         where s.schoolstate=1
90
         where s.schoolstate=1
90
         <if test="param.year!=null and param.year!=0">
91
         <if test="param.year!=null and param.year!=0">
102
         count(distinct case when gs.readtime>0 then gs.rgsid else null end) commitnum
103
         count(distinct case when gs.readtime>0 then gs.rgsid else null end) commitnum
103
         from t_guide g right join t_school s on g.schoolid=s.schoolid
104
         from t_guide g right join t_school s on g.schoolid=s.schoolid
104
         and g.createtime between #{param.begintime} and #{param.endtime}
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
         left join t_class c on c.classid=gs.classid
107
         left join t_class c on c.classid=gs.classid
107
         where s.schoolstate=1
108
         where s.schoolstate=1
108
         <if test="param.year!=null and param.year!=0">
109
         <if test="param.year!=null and param.year!=0">
119
         select s.schoolid,s.schoolname,s.shortname,rg.reciteid as wid,
120
         select s.schoolid,s.schoolname,s.shortname,rg.reciteid as wid,
120
         count(distinct rs.rsid) stunum,
121
         count(distinct rs.rsid) stunum,
121
         count(distinct case when rs.rsstate!=0 then rs.rsid else null end) commitnum
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
         and rg.starttime between #{param.begintime} and #{param.endtime}
125
         and rg.starttime between #{param.begintime} and #{param.endtime}
124
         left join t_recite_student rs on rs.reciteid=rg.reciteid and rs.classid=rg.classid
126
         left join t_recite_student rs on rs.reciteid=rg.reciteid and rs.classid=rg.classid
125
         left join t_class c on c.classid=rg.classid
127
         left join t_class c on c.classid=rg.classid
151
     <!--布置作业统计_布置作业次数-->
153
     <!--布置作业统计_布置作业次数-->
152
     <select id="listPapernumMonth" resultType="com.xhkjedu.sapi.vo.region.WorkVo">
154
     <select id="listPapernumMonth" resultType="com.xhkjedu.sapi.vo.region.WorkVo">
153
         select s.schoolid,s.schoolname,s.shortname,count(distinct pg.paperid) num
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
         where s.schoolstate=1
161
         where s.schoolstate=1
158
         <if test="param.year!=null and param.year!=0">
162
         <if test="param.year!=null and param.year!=0">
159
             and c.year=#{param.year}
163
             and c.year=#{param.year}

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

71
         from t_paper_class pg right join t_paper p on pg.paperid=p.paperid
71
         from t_paper_class pg right join t_paper p on pg.paperid=p.paperid
72
         left join t_subject s on p.subjectid=s.subjectid
72
         left join t_subject s on p.subjectid=s.subjectid
73
         left join t_class c on pg.classid=c.classid
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
         and pg.starttime between #{param.begintime} and #{param.endtime}
76
         and pg.starttime between #{param.begintime} and #{param.endtime}
77
         group by c.gradeid,p.subjectid
77
         group by c.gradeid,p.subjectid
78
     </select>
78
     </select>
83
         from t_guide g left join t_subject s on g.subjectid=s.subjectid
83
         from t_guide g left join t_subject s on g.subjectid=s.subjectid
84
         left join t_guide_group_student gs on gs.guideid=g.guideid
84
         left join t_guide_group_student gs on gs.guideid=g.guideid
85
         left join t_class c on gs.classid=c.classid
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
         and g.createtime between #{param.begintime} and #{param.endtime}
87
         and g.createtime between #{param.begintime} and #{param.endtime}
88
         group by c.gradeid,g.subjectid
88
         group by c.gradeid,g.subjectid
89
     </select>
89
     </select>

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

313
         from t_paper_class pg left join t_class c on pg.classid = c.classid
313
         from t_paper_class pg left join t_class c on pg.classid = c.classid
314
         left join t_school s on c.schoolid = s.schoolid
314
         left join t_school s on c.schoolid = s.schoolid
315
         where pg.paperid=#{paperid}
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
     </select>
317
     </select>
318
     <!--作业班级学生列表-->
318
     <!--作业班级学生列表-->
319
     <select id="listPaperClassStudent" resultType="com.xhkjedu.sstudy.vo.gradeclass.CStudentVo">
319
     <select id="listPaperClassStudent" resultType="com.xhkjedu.sstudy.vo.gradeclass.CStudentVo">

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

79
                     select="listClass" column="{paperid=paperid,createid=createid,checkid=checkid,checktype=checktype,logschoolid=logschoolid,classids=classids}">
79
                     select="listClass" column="{paperid=paperid,createid=createid,checkid=checkid,checktype=checktype,logschoolid=logschoolid,classids=classids}">
80
         </collection>
80
         </collection>
81
         <collection property="checklist" ofType="java.util.Map" javaType="java.util.List"
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
             <result property="userid" column="userid"></result>
83
             <result property="userid" column="userid"></result>
84
             <result property="username" column="username"></result>
84
             <result property="username" column="username"></result>
85
             <result property="classid" column="classid"></result>
85
             <result property="classid" column="classid"></result>
134
         <if test="classids!=null and classids!=''">
134
         <if test="classids!=null and classids!=''">
135
             and ps.classid in(${classids})
135
             and ps.classid in(${classids})
136
         </if>
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
     </select>
139
     </select>
139
     <!--本校作业班级批阅人-->
140
     <!--本校作业班级批阅人-->
140
     <resultMap id="checkUserResult" type="java.util.Map">
141
     <resultMap id="checkUserResult" type="java.util.Map">
158
            from t_paper_class pg left join t_school s on pg.schoolid=s.schoolid
159
            from t_paper_class pg left join t_school s on pg.schoolid=s.schoolid
159
            left join t_user u on pg.checkid=u.userid
160
            left join t_user u on pg.checkid=u.userid
160
            left join t_class c on pg.classid=c.classid
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
        </if>
168
        </if>
164
        <if test="checktype==3">
169
        <if test="checktype==3">
165
            select ps.checkid userid,u.username,c.classid,c.classname,c.gradeid,ps.schoolid,s.schoolname
170
            select ps.checkid userid,u.username,c.classid,c.classname,c.gradeid,ps.schoolid,s.schoolname
166
            from t_paper_student ps left join t_school s on ps.schoolid=s.schoolid
171
            from t_paper_student ps left join t_school s on ps.schoolid=s.schoolid
167
            left join t_user u on ps.checkid=u.userid
172
            left join t_user u on ps.checkid=u.userid
168
            left join t_class c on ps.classid=c.classid
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
            group by ps.classid,ps.checkid
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
        </if>
181
        </if>
173
         <if test="checktype!=1 and checktype!=3">
182
         <if test="checktype!=1 and checktype!=3">
174
             select checktype from t_paper where paperid=#{paperid}
183
             select checktype from t_paper where paperid=#{paperid}
297
         where p.createid=#{paper.teacherid} and c.gradeid=#{paper.gradeid} and c.year=#{paper.year}
306
         where p.createid=#{paper.teacherid} and c.gradeid=#{paper.gradeid} and c.year=#{paper.year}
298
         and pg.schoolid=#{paper.schoolid}
307
         and pg.schoolid=#{paper.schoolid}
299
         <if test="paper.starttime!=null and paper.starttime!=0">
308
         <if test="paper.starttime!=null and paper.starttime!=0">
300
-            and p.createtime>=#{paper.starttime}
309
+            and pg.starttime>=#{paper.starttime}
301
         </if>
310
         </if>
302
         <if test="paper.stoptime!=null and paper.stoptime!=0">
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
         </if>
313
         </if>
305
         <if test="paper.classid!=null and paper.classid!=0">
314
         <if test="paper.classid!=null and paper.classid!=0">
306
             and c.classid=#{paper.classid}
315
             and c.classid=#{paper.classid}
358
         <if test="checkid!=null and checkid!=0">
367
         <if test="checkid!=null and checkid!=0">
359
             and pg.checkid=#{checkid}
368
             and pg.checkid=#{checkid}
360
         </if>
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
     </select>
372
     </select>
363
     <!--根据作业id获取作业分类-->
373
     <!--根据作业id获取作业分类-->
364
     <select id="getPaperTypeById" resultType="java.lang.Integer">
374
     <select id="getPaperTypeById" resultType="java.lang.Integer">

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

82
             and pg.checkid=#{checkid}
82
             and pg.checkid=#{checkid}
83
         </if>-->
83
         </if>-->
84
         group by pg.classid
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
     </select>
86
     </select>
87
 
87
 
88
     <!--作业报告-->
88
     <!--作业报告-->

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

66
             and gg.classid in(${guide.classids})
66
             and gg.classid in(${guide.classids})
67
         </if>
67
         </if>
68
         group by gg.classid
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
     </select>
70
     </select>
71
 </mapper>
71
 </mapper>

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

156
         <if test="classtype==null or classtype==0">
156
         <if test="classtype==null or classtype==0">
157
             and c.classtype!=99
157
             and c.classtype!=99
158
         </if>
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
     </select>
160
     </select>
161
     <!--教师基本信息-->
161
     <!--教师基本信息-->
162
     <select id="getTeacherInfo" resultMap="teacherInfoMap">
162
     <select id="getTeacherInfo" resultMap="teacherInfoMap">

Loading…
Cancel
Save