|
@@ -5,12 +5,12 @@
|
5
|
5
|
<select id="listByCourseId" resultType="com.xhkjedu.slive.vo.liveplay.CourseSectionVo">
|
6
|
6
|
select cs.sectionid,cs.sectionname,cs.sectiondate,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate
|
7
|
7
|
,cs.teacherid,cs.createid,cs.stunum,cs.sectionorder
|
8
|
|
- ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
|
|
8
|
+ ,timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
|
9
|
9
|
,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
|
10
|
10
|
,(select u.username from t_user u where u.userid=cs.teacherid)teachername
|
11
|
11
|
from l_course_section cs where cs.courseid=#{courseid}
|
12
|
12
|
<if test="teacherid!=null and teacherid!=0"> and cs.teacherid=#{teacherid}</if>
|
13
|
|
- order by UNIX_TIMESTAMP(concat(sectiondate,' ',planbegintime))
|
|
13
|
+ order by sectiondate,planbegintime
|
14
|
14
|
</select>
|
15
|
15
|
<!--修改课节状态-->
|
16
|
16
|
<update id="updateState">
|
|
@@ -28,22 +28,6 @@
|
28
|
28
|
</if>
|
29
|
29
|
where cs.sectionid=#{section.sectionid} and cs.sectionstate=0
|
30
|
30
|
</update>
|
31
|
|
- <!--获取要结束课节id集合-->
|
32
|
|
- <select id="listEndSectionId" resultType="java.lang.String">
|
33
|
|
- select group_concat(sectionid) from l_course_section
|
34
|
|
- where sectionstate=2 and UNIX_TIMESTAMP(CONCAT(sectiondate,' ',planendtime))<![CDATA[ < ]]>UNIX_TIMESTAMP(now())
|
35
|
|
- </select>
|
36
|
|
- <!--结束课节-->
|
37
|
|
- <update id="updateSectionState2">
|
38
|
|
- update l_course_section cs
|
39
|
|
- set cs.sectionstate=3,cs.endtime=cs.planendtime
|
40
|
|
- where cs.sectionid in (${sectionids})
|
41
|
|
- </update>
|
42
|
|
- <!--修改已过期课节状态-->
|
43
|
|
- <update id="updateSectionState3">
|
44
|
|
- update l_course_section set sectionstate=4
|
45
|
|
- where sectionstate=0 and UNIX_TIMESTAMP(CONCAT(sectiondate,' ',planendtime))<![CDATA[ < ]]>UNIX_TIMESTAMP(now())
|
46
|
|
- </update>
|
47
|
31
|
<!--获取要处理的课节-->
|
48
|
32
|
<select id="listPendingSection" resultType="com.xhkjedu.slive.vo.liveplay.CourseSectionVo">
|
49
|
33
|
SELECT cs.sectionid,cs.sectionstate,cs.planendtime FROM l_course_section cs WHERE cs.sectionstate BETWEEN 0 AND 2
|
|
@@ -102,7 +86,7 @@
|
102
|
86
|
<select id="listByDate" resultType="com.xhkjedu.slive.vo.liveplay.CourseSectionVo">
|
103
|
87
|
select c.coursename,cs.courseid,cs.sectionid,cs.sectionname,cs.sectiondate,cs.teacherid,cs.createid
|
104
|
88
|
,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate,cs.stunum,cs.sectionorder
|
105
|
|
- ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
|
|
89
|
+ ,timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
|
106
|
90
|
,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
|
107
|
91
|
,(select group_concat(distinct u.username separator '、')
|
108
|
92
|
from t_user u left join l_course_section s on s.teacherid=u.userid where s.courseid=cs.courseid)teachername
|
|
@@ -126,13 +110,13 @@
|
126
|
110
|
<if test="section.classid!=null and section.classid!=0">
|
127
|
111
|
and cc.classid=#{section.classid}
|
128
|
112
|
</if>
|
129
|
|
- order by cs.sectionstate,abs(UNIX_TIMESTAMP(concat(cs.sectiondate,' ',cs.planbegintime))-UNIX_TIMESTAMP(now())),cs.sectionid
|
|
113
|
+ order by cs.sectionstate,abs(timestampdiff(second,concat(cs.sectiondate,' ',cs.planbegintime),#{section.strtime})),cs.sectionid
|
130
|
114
|
</select>
|
131
|
115
|
<!--根据日期获取巡课课节列表-->
|
132
|
116
|
<select id="listXkByDate" resultType="com.xhkjedu.slive.vo.liveplay.CourseSectionVo">
|
133
|
117
|
select c.coursename,c.comm,cs.courseid,cs.sectionid,cs.sectionname,cs.sectiondate,cs.teacherid,cs.createid
|
134
|
118
|
,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate,c.stunum,cs.sectionorder
|
135
|
|
- ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
|
|
119
|
+ ,timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
|
136
|
120
|
,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
|
137
|
121
|
,concat('[',group_concat(distinct json_object('teachername',u.username,'headpic',u.headpic)),']')teachername
|
138
|
122
|
,c.gradeid,c.subjectid,s.subjectname,s.level,s.subjectorder
|
|
@@ -163,7 +147,7 @@
|
163
|
147
|
and cc.classid in (${section.classids})
|
164
|
148
|
</if>
|
165
|
149
|
group by cs.sectionid
|
166
|
|
- order by cs.sectionstate,abs(UNIX_TIMESTAMP(concat(cs.sectiondate,' ',cs.planbegintime))-UNIX_TIMESTAMP(now())),cs.sectionid
|
|
150
|
+ order by cs.sectionstate,abs(timestampdiff(second,concat(cs.sectiondate,' ',cs.planbegintime),#{section.strtime})),cs.sectionid
|
167
|
151
|
</select>
|
168
|
152
|
<!--修改教师上课时长-->
|
169
|
153
|
<update id="updateTime">
|
|
@@ -178,8 +162,8 @@
|
178
|
162
|
<!--课节报告-->
|
179
|
163
|
<select id="getReport" resultMap="reportResult">
|
180
|
164
|
select cs.sectionid,cs.sectionname,cs.sectiondate,cs.begintime,cs.endtime,cs.sectionstate,cs.stunum
|
181
|
|
- ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-
|
182
|
|
- UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',ifnull(cs.begintime,cs.planbegintime))))totaltime
|
|
165
|
+ ,timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime)
|
|
166
|
+ ,CONCAT(cs.sectiondate,' ',ifnull(cs.begintime,cs.planbegintime)))totaltime
|
183
|
167
|
,c.classid,c1.classname,truncate(cs.stunum*100/c1.classnum,2)cqrate
|
184
|
168
|
,(select u.username from t_user u where u.userid=cs.teacherid)teachername
|
185
|
169
|
,(select count(*) from l_course_section_chatroom csc where csc.sectionid=cs.sectionid and csc.usertype=2)msgnum
|
|
@@ -221,8 +205,8 @@
|
221
|
205
|
,(select count(*) from l_course_section_chatroom c where c.sectionid=css2.sectionid and c.userid=css2.studentid)msgnum
|
222
|
206
|
,(select count(*) from l_course_section_playback_see s where s.sectionid=css2.sectionid and s.userid=css2.studentid)seenum
|
223
|
207
|
from(select css.studentid,css.sectionid,css.tostamp,css.outstamp,css.totaltime,css.device
|
224
|
|
- ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-
|
225
|
|
- UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',ifnull(cs.begintime,cs.planbegintime))))totaltime2
|
|
208
|
+ ,timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime)
|
|
209
|
+ ,CONCAT(cs.sectiondate,' ',ifnull(cs.begintime,cs.planbegintime)))totaltime2
|
226
|
210
|
from l_course_section_student css
|
227
|
211
|
left join l_course_section cs on css.sectionid=cs.sectionid
|
228
|
212
|
where css.sectionid=#{section.sectionid})css2 left join t_user u on css2.studentid=u.userid
|
|
@@ -235,8 +219,7 @@
|
235
|
219
|
</select>
|
236
|
220
|
<!--获取课节时长和课程类型-->
|
237
|
221
|
<select id="getTotalTime" resultType="com.xhkjedu.slive.vo.liveplay.CourseVo">
|
238
|
|
- select UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,'
|
239
|
|
- ',cs.begintime))duration
|
|
222
|
+ select timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.begintime))duration
|
240
|
223
|
,(select c.coursetype from l_course c where c.courseid=cs.courseid)coursetype
|
241
|
224
|
from l_course_section cs where cs.sectionid=#{sectionid}
|
242
|
225
|
</select>
|
|
@@ -315,30 +298,6 @@
|
315
|
298
|
where cst.satid=#{satid}
|
316
|
299
|
</select>
|
317
|
300
|
|
318
|
|
- <!--获取直播中用户id列表-->
|
319
|
|
- <select id="listUserId" resultType="java.lang.Integer">
|
320
|
|
- select cs.studentid
|
321
|
|
- from t_class_student cs right join l_course c on cs.classid=c.classid
|
322
|
|
- right join l_course_section s on c.courseid=s.courseid
|
323
|
|
- where s.sectionstate=2 group by cs.studentid
|
324
|
|
- union select s.teacherid from l_course_section s where s.sectionstate=2 group by s.teacherid
|
325
|
|
- </select>
|
326
|
|
- <!--获取要结束的直播用户id列表-->
|
327
|
|
- <select id="listUserId2" resultType="java.lang.Integer">
|
328
|
|
- select cs.studentid
|
329
|
|
- from l_course_section_student cs right join l_course_section s on cs.sectionid=s.sectionid
|
330
|
|
- where s.sectionid in (${sectionids}) group by cs.studentid
|
331
|
|
- union select s.teacherid from l_course_section s
|
332
|
|
- where s.sectionid in (${sectionids}) group by s.teacherid
|
333
|
|
- </select>
|
334
|
|
- <!--获取直播中用户id列表-->
|
335
|
|
- <select id="listUserId3" resultType="java.lang.Integer">
|
336
|
|
- select cs.studentid
|
337
|
|
- from l_course_section_student cs right join l_course_section s on cs.sectionid=s.sectionid
|
338
|
|
- where s.sectionstate=2 and s.sectionid not in (${sectionids}) group by cs.studentid
|
339
|
|
- union select s.teacherid from l_course_section s
|
340
|
|
- where s.sectionstate=2 and s.sectionid not in (${sectionids}) group by s.teacherid
|
341
|
|
- </select>
|
342
|
301
|
<!--我的月份下日期课节数量-->
|
343
|
302
|
<select id="listMySectionDate" resultType="java.util.Map">
|
344
|
303
|
select cs.sectiondate as timestr,count(distinct cs.sectionid)as num
|
|
@@ -362,7 +321,7 @@
|
362
|
321
|
,(select t.typename from l_course_type t where t.ctypeid=c.ctypeid)typename
|
363
|
322
|
,cs.sectionid,cs.sectionname,cs.sectiondate,cs.teacherid,cs.stunum cynum
|
364
|
323
|
,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate
|
365
|
|
- ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
|
|
324
|
+ ,timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
|
366
|
325
|
,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
|
367
|
326
|
from l_course_section cs left join l_course c on cs.courseid = c.courseid
|
368
|
327
|
where cs.teacherid=#{section.teacherid} and c.deleted=1 and cs.sectiondate=#{section.timestr}
|
|
@@ -372,7 +331,7 @@
|
372
|
331
|
<if test="section.sectionname!=null and section.sectionname!=''">
|
373
|
332
|
and cs.sectionname like '%${section.sectionname}%'
|
374
|
333
|
</if>
|
375
|
|
- order by cs.sectionstate,abs(UNIX_TIMESTAMP(concat(cs.sectiondate,' ',cs.planbegintime))-UNIX_TIMESTAMP(now())),cs.sectionid
|
|
334
|
+ order by cs.sectionstate,abs(timestampdiff(second,concat(cs.sectiondate,' ',cs.planbegintime),#{section.strtime})),cs.sectionid
|
376
|
335
|
</select>
|
377
|
336
|
<!--根据课节id获取课程状态-->
|
378
|
337
|
<select id="getCourseBySectionId" resultType="com.xhkjedu.slive.vo.liveplay.CourseVo">
|
|
@@ -470,7 +429,7 @@
|
470
|
429
|
select c.courseid,c.gradeid,c.stunum,c.comm,c.createid,c.classid
|
471
|
430
|
,cs.sectionid,cs.sectionname,cs.sectiondate,cs.teacherid,cs.stunum cynum
|
472
|
431
|
,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate
|
473
|
|
- ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
|
|
432
|
+ ,timestampdiff(second,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
|
474
|
433
|
,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
|
475
|
434
|
,(select s.subjectname from t_subject s where s.subjectid=c.subjectid)subjectname
|
476
|
435
|
,u.username teachername,u.headpic
|
|
@@ -487,7 +446,7 @@
|
487
|
446
|
<if test="section.sectionname!=null and section.sectionname!=''">
|
488
|
447
|
and cs.sectionname like '%${section.sectionname}%'
|
489
|
448
|
</if>
|
490
|
|
- order by cs.sectionstate,abs(UNIX_TIMESTAMP(concat(cs.sectiondate,' ',cs.planbegintime))-UNIX_TIMESTAMP(now())),cs.sectionid
|
|
449
|
+ order by cs.sectionstate,abs(timestampdiff(second,concat(cs.sectiondate,' ',cs.planbegintime),#{section.strtime})),cs.sectionid
|
491
|
450
|
</select>
|
492
|
451
|
|
493
|
452
|
<!--获取课程中正在进行的课节数量-->
|