Browse Source

登录日志、作业学生完善

tags/正式3.10.0
雍文秀 1 year ago
parent
commit
776d36356c

+ 115
- 113
sstudy/src/main/resources/mapper/paper/PaperMapper.xml View File

@@ -2,34 +2,34 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.xhkjedu.sstudy.mapper.paper.PaperMapper">
4 4
     <resultMap id="typeResult" type="com.xhkjedu.sstudy.vo.paper.PaperQtypeVo">
5
-        <result property="qtypeid" column="qtypeid"></result>
6
-        <result property="qtypename" column="qtypename"></result>
7
-        <result property="ptorder" column="ptorder"></result>
8
-        <result property="ptscore" column="ptscore"></result>
9
-        <result property="ptnum" column="ptnum"></result>
10
-        <result property="ctype" column="pctype"></result>
5
+        <result property="qtypeid" column="qtypeid"/>
6
+        <result property="qtypename" column="qtypename"/>
7
+        <result property="ptorder" column="ptorder"/>
8
+        <result property="ptscore" column="ptscore"/>
9
+        <result property="ptnum" column="ptnum"/>
10
+        <result property="ctype" column="pctype"/>
11 11
         <collection property="questions" ofType="com.xhkjedu.sstudy.vo.question.QuestionVo">
12
-            <result property="questionid" column="questionid"></result>
13
-            <result property="questionpid" column="questionpid"></result>
14
-            <result property="qlevel" column="qlevel"></result>
15
-            <result property="score" column="score"></result>
16
-            <result property="ptqorder" column="ptqorder"></result>
17
-            <result property="ctype" column="ctype"></result>
18
-            <result property="qstem" column="qstem"></result>
19
-            <result property="qoption" column="qoption"></result>
20
-            <result property="qanswer" column="qanswer"></result>
21
-            <result property="qanalyze" column="qanalyze"></result>
22
-            <result property="hashear" column="hashear"></result>
23
-            <result property="hearfile" column="hearfile"></result>
24
-            <result property="qn" column="qn"></result>
25
-            <result property="complexity" column="complexity"></result>
26
-            <result property="qtypename" column="typename"></result>
12
+            <result property="questionid" column="questionid"/>
13
+            <result property="questionpid" column="questionpid"/>
14
+            <result property="qlevel" column="qlevel"/>
15
+            <result property="score" column="score"/>
16
+            <result property="ptqorder" column="ptqorder"/>
17
+            <result property="ctype" column="ctype"/>
18
+            <result property="qstem" column="qstem"/>
19
+            <result property="qoption" column="qoption"/>
20
+            <result property="qanswer" column="qanswer"/>
21
+            <result property="qanalyze" column="qanalyze"/>
22
+            <result property="hashear" column="hashear"/>
23
+            <result property="hearfile" column="hearfile"/>
24
+            <result property="qn" column="qn"/>
25
+            <result property="complexity" column="complexity"/>
26
+            <result property="qtypename" column="typename"/>
27 27
         </collection>
28 28
     </resultMap>
29 29
     <!--获取作业题型列表-->
30 30
     <select id="listPaperType" resultMap="typeResult">
31
-        select pt.qtypeid,pt.qtypename,pt.ptorder,pt.ptscore,pt.ptnum,ptq.questionid,ptq.ptqscore score,ptq.ptqorder,ptq.qn
32
-        ,q.questionid,ifnull(q.questionpid,q.questionid)questionpid,q.qlevel,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze
31
+        select pt.qtypeid,pt.qtypename,pt.ptorder,pt.ptscore,pt.ptnum,ptq.questionid,ptq.ptqscore as score,ptq.ptqorder,ptq.qn
32
+        ,q.questionid,ifnull(q.questionpid,q.questionid)as questionpid,q.qlevel,q.ctype,q.qstem,q.qoption,q.qanswer,q.qanalyze
33 33
         ,q.hashear,q.hearfile,q.complexity,q.qtypename typename,pt.ctype pctype
34 34
         from t_paper_qtype pt left join t_paper_qtype_question ptq on pt.ptid = ptq.ptid
35 35
         left join t_question q on ptq.questionid = q.questionid
@@ -61,52 +61,52 @@
61 61
 
62 62
     <!--作业列表-->
63 63
     <resultMap id="paperResult" type="com.xhkjedu.sstudy.vo.paper.PaperListVo">
64
-        <result property="paperid" column="paperid"></result>
65
-        <result property="papername" column="papername"></result>
66
-        <result property="papertype" column="papertype"></result>
67
-        <result property="paperclass" column="paperclass"></result>
68
-        <result property="paperstate" column="paperstate"></result>
69
-        <result property="checktype" column="checktype"></result>
70
-        <result property="createid" column="createid"></result>
71
-        <result property="createtime" column="createtime"></result>
72
-        <result property="createname" column="createname"></result>
73
-        <result property="starttime" column="starttime"></result>
74
-        <result property="stoptime" column="stoptime"></result>
75
-        <result property="papernum" column="papernum"></result>
76
-        <result property="timetype" column="timetype"></result>
77
-        <result property="showtype" column="showtype"></result>
78
-        <result property="schoolid" column="schoolid"></result>
79
-        <result property="logschoolid" column="logschoolid"></result>
80
-        <result property="classnum" column="classnum"></result>
81
-        <result property="ytjnum" column="ytjnum"></result>
82
-        <result property="ypgnum" column="ypgnum"></result>
64
+        <result property="paperid" column="paperid"/>
65
+        <result property="papername" column="papername"/>
66
+        <result property="papertype" column="papertype"/>
67
+        <result property="paperclass" column="paperclass"/>
68
+        <result property="paperstate" column="paperstate"/>
69
+        <result property="checktype" column="checktype"/>
70
+        <result property="createid" column="createid"/>
71
+        <result property="createtime" column="createtime"/>
72
+        <result property="createname" column="createname"/>
73
+        <result property="starttime" column="starttime"/>
74
+        <result property="stoptime" column="stoptime"/>
75
+        <result property="papernum" column="papernum"/>
76
+        <result property="timetype" column="timetype"/>
77
+        <result property="showtype" column="showtype"/>
78
+        <result property="schoolid" column="schoolid"/>
79
+        <result property="logschoolid" column="logschoolid"/>
80
+        <result property="classnum" column="classnum"/>
81
+        <result property="ytjnum" column="ytjnum"/>
82
+        <result property="ypgnum" column="ypgnum"/>
83 83
         <collection property="schools" ofType="java.util.Map" javaType="java.util.List"
84 84
                     select="listClass" column="{paperid=paperid,createid=createid,checkid=checkid,checktype=checktype,logschoolid=logschoolid,classids=classids}">
85 85
         </collection>
86 86
         <collection property="checklist" ofType="java.util.Map" javaType="java.util.List"
87 87
                     select="listPaperCheckStu" column="{paperid=paperid,checktype=checktype,logschoolid=logschoolid,classids=classids}">
88
-            <result property="userid" column="userid"></result>
89
-            <result property="username" column="username"></result>
90
-            <result property="classid" column="classid"></result>
91
-            <result property="classname" column="classname"></result>
92
-            <result property="gradeid" column="gradeid"></result>
88
+            <result property="userid" column="userid"/>
89
+            <result property="username" column="username"/>
90
+            <result property="classid" column="classid"/>
91
+            <result property="classname" column="classname"/>
92
+            <result property="gradeid" column="gradeid"/>
93 93
         </collection>
94 94
     </resultMap>
95 95
     <resultMap id="classResult" type="java.util.Map">
96
-        <result property="schoolid" column="schoolid"></result>
97
-        <result property="schoolname" column="schoolname"></result>
96
+        <result property="schoolid" column="schoolid"/>
97
+        <result property="schoolname" column="schoolname"/>
98 98
         <collection property="classes" ofType="com.xhkjedu.sstudy.vo.paper.PaperClassVo" javaType="java.util.List">
99
-            <result property="schoolid" column="schoolid"></result>
100
-            <result property="classid" column="classid"></result>
101
-            <result property="classname" column="classname"></result>
102
-            <result property="gradeid" column="gradeid"></result>
103
-            <result property="classnum" column="classnum"></result>
104
-            <result property="ytjnum" column="ytjnum"></result>
105
-            <result property="ypgnum" column="ypgnum"></result>
106
-            <result property="studentname" column="studentname"></result>
107
-            <result property="checkid" column="checkid"></result>
108
-            <result property="teachername" column="teachername"></result>
109
-            <result property="checked" column="checked"></result>
99
+            <result property="schoolid" column="schoolid"/>
100
+            <result property="classid" column="classid"/>
101
+            <result property="classname" column="classname"/>
102
+            <result property="gradeid" column="gradeid"/>
103
+            <result property="classnum" column="classnum"/>
104
+            <result property="ytjnum" column="ytjnum"/>
105
+            <result property="ypgnum" column="ypgnum"/>
106
+            <result property="studentname" column="studentname"/>
107
+            <result property="checkid" column="checkid"/>
108
+            <result property="teachername" column="teachername"/>
109
+            <result property="checked" column="checked"/>
110 110
         </collection>
111 111
     </resultMap>
112 112
     <!--<select id="listClass" resultMap="classResult">
@@ -130,9 +130,9 @@
130 130
     </select>-->
131 131
     <!--本校作业班级-->
132 132
     <select id="listClass" resultMap="classResult">
133
-        select count(*) classnum,ps.classid,c.classname,c.gradeid,c.schoolid,s.schoolname
134
-        ,count(distinct case when ps.psstate in (1,2) then ps.psid else null end)ytjnum
135
-        ,count(distinct case when ps.pschecked=1 then ps.psid else null end)ypgnum
133
+        select count(*) as classnum,ps.classid,c.classname,c.gradeid,c.schoolid,s.schoolname
134
+        ,count(distinct if(ps.psstate in (1,2), ps.psid, null))ytjnum
135
+        ,count(distinct if(ps.pschecked=1, ps.psid, null))ypgnum
136 136
         from t_paper_student ps left join t_class c on ps.classid=c.classid
137 137
         left join t_school s on c.schoolid = s.schoolid
138 138
         where ps.paperid=#{paperid}
@@ -140,27 +140,28 @@
140 140
             and ps.classid in(${classids})
141 141
         </if>
142 142
         group by ps.classid
143
-        order by case c.schoolid when #{logschoolid} then 0 else c.schoolid end,c.gradeid,c.classtype,c.classorder
143
+        order by if(c.schoolid = #{logschoolid}, 0, c.schoolid)
144
+        ,c.gradeid,c.classtype,c.classorder
144 145
     </select>
145 146
     <!--本校作业班级批阅人-->
146 147
     <resultMap id="checkUserResult" type="java.util.Map">
147
-        <result property="schoolid" column="schoolid"></result>
148
-        <result property="schoolname" column="schoolname"></result>
149
-        <result property="checktype" column="checktype"></result>
148
+        <result property="schoolid" column="schoolid"/>
149
+        <result property="schoolname" column="schoolname"/>
150
+        <result property="checktype" column="checktype"/>
150 151
         <collection property="classes" ofType="java.util.Map" javaType="java.util.List">
151
-            <result property="schoolid" column="schoolid"></result>
152
-            <result property="classid" column="classid"></result>
153
-            <result property="classname" column="classname"></result>
154
-            <result property="gradeid" column="gradeid"></result>
152
+            <result property="schoolid" column="schoolid"/>
153
+            <result property="classid" column="classid"/>
154
+            <result property="classname" column="classname"/>
155
+            <result property="gradeid" column="gradeid"/>
155 156
             <collection property="users" ofType="java.util.Map" javaType="java.util.List">
156
-                <result property="userid" column="userid"></result>
157
-                <result property="username" column="username"></result>
157
+                <result property="userid" column="userid"/>
158
+                <result property="username" column="username"/>
158 159
             </collection>
159 160
         </collection>
160 161
     </resultMap>
161 162
     <select id="listPaperCheckStu" resultMap="checkUserResult">
162 163
          <if test="checktype==1">
163
-           select pg.checkid userid,u.username,c.classid,c.classname,c.gradeid,pg.schoolid,s.schoolname
164
+           select pg.checkid as userid,u.username,c.classid,c.classname,c.gradeid,pg.schoolid,s.schoolname
164 165
            from t_paper_class pg left join t_school s on pg.schoolid=s.schoolid
165 166
            left join t_user u on pg.checkid=u.userid
166 167
            left join t_class c on pg.classid=c.classid
@@ -168,11 +169,11 @@
168 169
              <if test="classids!=null and classids!=''">
169 170
                  and pg.classid in(${classids})
170 171
              </if>
171
-             order by case c.schoolid when #{logschoolid} then 0 else c.schoolid end,
172
+             order by if(c.schoolid = #{logschoolid}, 0, c.schoolid),
172 173
              c.gradeid,c.classtype,c.classorder,convert(u.username using gbk)
173
-       </if>
174
+         </if>
174 175
        <if test="checktype==3">
175
-           select ps.checkid userid,u.username,c.classid,c.classname,c.gradeid,ps.schoolid,s.schoolname
176
+           select ps.checkid as userid,u.username,c.classid,c.classname,c.gradeid,ps.schoolid,s.schoolname
176 177
            from t_paper_student ps left join t_school s on ps.schoolid=s.schoolid
177 178
            left join t_user u on ps.checkid=u.userid
178 179
            left join t_class c on ps.classid=c.classid
@@ -181,7 +182,7 @@
181 182
                and ps.classid in(${classids})
182 183
            </if>
183 184
            group by ps.classid,ps.checkid
184
-           order by case c.schoolid when #{logschoolid} then 0 else c.schoolid end,
185
+           order by IF(c.schoolid = #{logschoolid}, 0, c.schoolid),
185 186
            c.gradeid,c.classtype,c.classorder,convert(u.username using gbk)
186 187
        </if>
187 188
         <if test="checktype!=1 and checktype!=3">
@@ -192,7 +193,7 @@
192 193
     <!--教师作业列表-->
193 194
     <select id="listAll" resultMap="paperResult">
194 195
         select p.paperid,p.papername,p.papertype,p.paperclass,p.paperstate,p.checktype,p.createtime,p.schoolid,p.hasreport,p.timetype,
195
-        #{paper.schoolid} logschoolid,u.username createname,pg.starttime,pg.stoptime,pg.showtype,p.papernum,p.createid,#{paper.createid} checkid
196
+        #{paper.schoolid} logschoolid,u.username createname,pg.starttime,pg.stoptime,pg.showtype,p.papernum,p.createid,#{paper.createid} as checkid
196 197
         ,group_concat(pg.classid) classids
197 198
         from t_paper p left join t_user u on p.createid=u.userid
198 199
         left join t_paper_class pg on p.paperid=pg.paperid
@@ -244,7 +245,7 @@
244 245
     </select>
245 246
     <!--教师批阅列表-->
246 247
     <select id="correctList" resultMap="paperResult">
247
-        select p.paperid,p.papername,p.papertype,p.paperclass,p.paperstate,p.checktype,p.createtime,p.createid,#{checkid} checkid,p.schoolid as logschoolid
248
+        select p.paperid,p.papername,p.papertype,p.paperclass,p.paperstate,p.checktype,p.createtime,p.createid,#{checkid} as checkid,p.schoolid as logschoolid
248 249
         ,u.username createname,pg.starttime,pg.stoptime,p.papernum
249 250
         ,group_concat(pg.classid) classids
250 251
         from t_paper p left join t_user u on p.createid=u.userid
@@ -259,20 +260,20 @@
259 260
     </update>
260 261
     <!--获取批改学生列表-->
261 262
     <resultMap id="checkResult" type="com.xhkjedu.sstudy.vo.paper.CheckClassVo">
262
-        <result property="classid" column="classid"></result>
263
-        <result property="classname" column="classname"></result>
264
-        <result property="classnum" column="classnum"></result>
265
-        <result property="ytjnum" column="ytjnum"></result>
266
-        <result property="ypynum" column="ypynum"></result>
263
+        <result property="classid" column="classid"/>
264
+        <result property="classname" column="classname"/>
265
+        <result property="classnum" column="classnum"/>
266
+        <result property="ytjnum" column="ytjnum"/>
267
+        <result property="ypynum" column="ypynum"/>
267 268
         <collection property="students" ofType="com.xhkjedu.sstudy.vo.paperstudent.StudentVo"
268 269
                     javaType="java.util.List" select="listStudent" column="{paperid=paperid,classid=classid}">
269 270
         </collection>
270 271
     </resultMap>
271 272
     <resultMap id="studentResult" type="com.xhkjedu.sstudy.vo.paperstudent.StudentVo">
272
-        <result property="psid" column="psid"></result>
273
-        <result property="studentid" column="studentid"></result>
274
-        <result property="studentname" column="studentname"></result>
275
-        <result property="pschecked" column="pschecked"></result>
273
+        <result property="psid" column="psid"/>
274
+        <result property="studentid" column="studentid"/>
275
+        <result property="studentname" column="studentname"/>
276
+        <result property="pschecked" column="pschecked"/>
276 277
     </resultMap>
277 278
     <select id="listStudent" resultMap="studentResult">
278 279
         select ps.psid,ps.studentid,u.username studentname,ps.pschecked
@@ -281,11 +282,11 @@
281 282
         order by ps.pschecked,convert(u.username using gbk),u.userid
282 283
     </select>
283 284
     <select id="listStudentsByPaperIdCheckId" resultMap="checkResult">
284
-        select ps.classid,c.classname,c.gradeid,count(*)classnum,ps.paperid
285
-        ,count(distinct case when ps.psstate in(1,2) then ps.psid else null end)ytjnum
286
-        ,count(distinct case when ps.pschecked=1 then ps.psid else null end)ypynum
287
-        from t_paper_student ps left join t_class c on ps.classid=c.classid
288
-        where ps.paperid=#{paperid} and ps.classid=#{classid}
285
+        select ps.classid,c.classname,c.gradeid,count(*) as classnum,ps.paperid
286
+        ,count(distinct IF(ps.psstate in (1, 2), ps.psid, null)) ytjnum
287
+        ,count(distinct IF(ps.pschecked = 1, ps.psid, null)) ypynum
288
+        from t_paper_student ps left join t_class c on ps.classid = c.classid
289
+        where ps.paperid = #{paperid} and ps.classid = #{classid}
289 290
     </select>
290 291
     <!--作业附件列表-->
291 292
     <select id="listPaperFile" resultType="com.xhkjedu.sstudy.model.paper.TPaperFile">
@@ -298,7 +299,7 @@
298 299
     <!--获取年级下教师发布作业列表-->
299 300
     <select id="listPaper" resultMap="paperResult">
300 301
         select p.paperid,p.papername,p.papertype,p.paperclass,p.paperstate,p.checktype,p.createtime,p.timetype
301
-        ,pg.starttime,pg.stoptime,p.papernum,p.createid,#{paper.teacherid} checkid,p.schoolid,#{paper.schoolid} logschoolid
302
+        ,pg.starttime,pg.stoptime,p.papernum,p.createid,#{paper.teacherid} as checkid,p.schoolid,#{paper.schoolid} as logschoolid
302 303
         ,pg.showtype,p.hasreport,group_concat(pg.classid) classids
303 304
         ,(select u.username from t_user u where u.userid=p.createid)createname
304 305
         from t_paper p left join t_paper_class pg on p.paperid=pg.paperid
@@ -347,14 +348,14 @@
347 348
 
348 349
     <!--获取批阅班级-->
349 350
     <resultMap id="schoolMap" type="java.util.Map">
350
-        <result property="schoolid" column="schoolid"></result>
351
-        <result property="schoolname" column="schoolname"></result>
351
+        <result property="schoolid" column="schoolid"/>
352
+        <result property="schoolname" column="schoolname"/>
352 353
         <collection property="classes" ofType="java.util.Map" javaType="java.util.List">
353
-            <result property="classid" column="classid"></result>
354
-            <result property="classname" column="classname"></result>
355
-            <result property="gradeid" column="gradeid"></result>
356
-            <result property="schoolid" column="schoolid"></result>
357
-            <result property="checked" column="checked"></result>
354
+            <result property="classid" column="classid"/>
355
+            <result property="classname" column="classname"/>
356
+            <result property="gradeid" column="gradeid"/>
357
+            <result property="schoolid" column="schoolid"/>
358
+            <result property="checked" column="checked"/>
358 359
         </collection>
359 360
     </resultMap>
360 361
     <select id="listPaperClass" resultMap="schoolMap">
@@ -367,7 +368,8 @@
367 368
             and pg.checkid=#{checkid}
368 369
         </if>
369 370
         group by pg.classid
370
-        order by ps.pschecked,case c.schoolid when #{schoolid} then 0 else c.schoolid end,c.gradeid,c.classtype,c.classorder
371
+        order by ps.pschecked,if(c.schoolid = #{schoolid}, 0, c.schoolid)
372
+        ,c.gradeid,c.classtype,c.classorder
371 373
     </select>
372 374
     <!--根据作业id获取作业分类-->
373 375
     <select id="getPaperTypeById" resultType="java.lang.Integer">
@@ -440,17 +442,17 @@
440 442
         group by ct.teacherid order by c.classtype,c.classorder, convert(u.username using gbk)
441 443
     </select>
442 444
     <resultMap id="paperStudentList" type="java.util.Map">
443
-        <result property="schoolid" column="schoolid"></result>
444
-        <result property="schoolname" column="schoolname"></result>
445
+        <result property="schoolid" column="schoolid"/>
446
+        <result property="schoolname" column="schoolname"/>
445 447
         <collection property="classlist" ofType="java.util.Map" javaType="java.util.List">
446
-            <result property="classid" column="classid"></result>
447
-            <result property="classname" column="classname"></result>
448
-            <result property="gradeid" column="gradeid"></result>
449
-            <result property="classnum" column="classnum"></result>
448
+            <result property="classid" column="classid"/>
449
+            <result property="classname" column="classname"/>
450
+            <result property="gradeid" column="gradeid"/>
451
+            <result property="classnum" column="classnum"/>
450 452
             <collection property="students" ofType="java.util.Map" javaType="java.util.List">
451
-                <result property="studentid" column="studentid"></result>
452
-                <result property="studentname" column="studentname"></result>
453
-                <result property="headpic" column="headpic"></result>
453
+                <result property="studentid" column="studentid"/>
454
+                <result property="studentname" column="studentname"/>
455
+                <result property="headpic" column="headpic"/>
454 456
             </collection>
455 457
         </collection>
456 458
     </resultMap>
@@ -458,7 +460,7 @@
458 460
     <select id="listPaperStudentsByPaperid" resultMap="paperStudentList">
459 461
         select u.schoolid,s.schoolname, pg.classid,c.classname,c.gradeid,c.classnum,cs.studentid,u.username studentname
460 462
         from t_paper_class pg left join t_class c on pg.classid=c.classid
461
-        left join t_class_student cs on c.classid = cs.classid
463
+        left join t_paper_student cs on pg.paperid=cs.paperid and pg.classid=cs.classid
462 464
         left join t_user u on cs.studentid=u.userid
463 465
         left join t_school s on s.schoolid=u.schoolid
464 466
         where pg.paperid=#{paperid} order by s.createtime desc, c.gradeid,c.classtype,c.classorder,convert(u.username using gbk)

+ 4
- 0
suser/src/main/java/com/xhkjedu/suser/service/system/UserService.java View File

@@ -414,6 +414,10 @@ public class UserService extends JedisUtil {
414 414
         } else {
415 415
             if(N_Utils.isNotEmpty(result.getObj())){
416 416
                 userVo = (UserVo) result.getObj();
417
+            } else {
418
+                userVo = new UserVo();
419
+                userVo.setLoginname(user.getLoginname());
420
+                userVo.setLoginpwd(loginpwd);
417 421
             }
418 422
             userLog.setLoginstate(2);
419 423
             if(result.getMsg().contains("密码错误")){

Loading…
Cancel
Save