Browse Source

直播获取时间

tags/正式版本
雍文秀 2 years ago
parent
commit
917ee57aea

+ 0
- 20
slive/src/main/java/com/xhkjedu/slive/mapper/liveplay/CourseSectionMapper.java View File

@@ -25,9 +25,6 @@ public interface CourseSectionMapper extends TkMapper<LCourseSection> {
25 25
     //课节统计
26 26
     Map<String, Integer> analyze(Integer sectionid, Integer classid);
27 27
 
28
-    //修改课节回放信息
29
-    //void updatePlayback(@Param("section") LCourseSection section);
30
-
31 28
     //根据日期获取教师课节列表
32 29
     List<CourseSectionVo> listByDate(@Param("section") LCourseSection section);
33 30
     //根据日期获取巡课课节列表
@@ -62,26 +59,9 @@ public interface CourseSectionMapper extends TkMapper<LCourseSection> {
62 59
     //获取课程教师id集合
63 60
     List<Integer> listTeacherId(Integer courseid);
64 61
 
65
-    //获取要结束课节id集合
66
-    String listEndSectionId();
67
-
68
-    //结束课节
69
-    void updateSectionState2(@Param("sectionids") String sectionids);
70
-    //修改已过期课节状态
71
-    void updateSectionState3();
72
-
73 62
     //更新课节学生在线状态为下线
74 63
     void updateStuOnLined(@Param("sectionids") List<Integer> sectionids,@Param("nowtime") Integer nowtime);
75 64
 
76
-    //获取直播中用户id列表
77
-    List<Integer> listUserId();
78
-
79
-    //获取要结束的直播用户id列表
80
-    List<Integer> listUserId2(@Param("sectionids") String sectionids);
81
-
82
-    //获取直播中用户id列表
83
-    List<Integer> listUserId3(@Param("sectionids") String sectionids);
84
-
85 65
     CourseVo getCourseBySectionId(Integer sectionid);
86 66
 
87 67
     //我的月份下日期课节数量

+ 3
- 0
slive/src/main/java/com/xhkjedu/slive/model/liveplay/LCourse.java View File

@@ -106,4 +106,7 @@ public class LCourse extends BaseBean {
106 106
 
107 107
     @Transient
108 108
     private String teachername;//教师姓名
109
+
110
+    @Transient
111
+    private String strtime;//当前时间
109 112
 }

+ 3
- 0
slive/src/main/java/com/xhkjedu/slive/model/liveplay/LCourseSection.java View File

@@ -75,4 +75,7 @@ public class LCourseSection extends BaseBean {
75 75
 
76 76
     @Transient
77 77
     private String subjectid;//科目id
78
+
79
+    @Transient
80
+    private String strtime;//当前时间
78 81
 }

+ 12
- 8
slive/src/main/java/com/xhkjedu/slive/service/liveplay/CourseSectionService.java View File

@@ -196,14 +196,6 @@ public class CourseSectionService {
196 196
             Callable<String> call = new Callable() {
197 197
                 @Override
198 198
                 public String call() throws IOException {
199
-                    /*//修改已过期课节状态
200
-                    courseSectionMapper.updateSectionState3();
201
-                    //获取要结束课节id集合
202
-                    String sectionids = courseSectionMapper.listEndSectionId();
203
-                    if (N_Utils.isEmpty(sectionids)) return "执行成功";
204
-                    //结束课节
205
-                    courseSectionMapper.updateSectionState2(sectionids);*/
206
-
207 199
                     List<CourseSectionVo> sections = courseSectionMapper.listPendingSection();//获取要处理的课节
208 200
                     if (N_Utils.isListEmpty(sections)) return "执行成功";
209 201
                     List<Integer> sectionids = new ArrayList<>();
@@ -244,11 +236,17 @@ public class CourseSectionService {
244 236
 
245 237
     //根据日期获取教师课节列表
246 238
     public List<CourseSectionVo> listByDate(LCourseSection section) {
239
+        int timestamp = N_Utils.getSecondTimestamp();
240
+        String strtime = N_Utils.getStrtimeTimestamp(timestamp, "yyyy-MM-dd HH:mm");
241
+        section.setStrtime(strtime);
247 242
         return courseSectionMapper.listByDate(section);
248 243
     }
249 244
 
250 245
     //根据日期获取巡课课节列表
251 246
     public List<CourseSectionVo> listXkByDate(CourseParams p) {
247
+        int timestamp = N_Utils.getSecondTimestamp();
248
+        String strtime = N_Utils.getStrtimeTimestamp(timestamp, "yyyy-MM-dd HH:mm");
249
+        p.setStrtime(strtime);
252 250
         return courseSectionMapper.listXkByDate(p);
253 251
     }
254 252
 
@@ -336,6 +334,9 @@ public class CourseSectionService {
336 334
 
337 335
     //我的课程列表
338 336
     public List<Map> listMySection(CourseParams params) {
337
+        int timestamp = N_Utils.getSecondTimestamp();
338
+        String strtime = N_Utils.getStrtimeTimestamp(timestamp, "yyyy-MM-dd HH:mm");
339
+        params.setStrtime(strtime);
339 340
         return courseSectionMapper.listMySection(params);
340 341
     }
341 342
 
@@ -402,6 +403,9 @@ public class CourseSectionService {
402 403
 
403 404
     //学生课节列表
404 405
     public List<Map> listStuByDate(CourseParams params) {
406
+        int timestamp = N_Utils.getSecondTimestamp();
407
+        String strtime = N_Utils.getStrtimeTimestamp(timestamp, "yyyy-MM-dd HH:mm");
408
+        params.setStrtime(strtime);
405 409
         return courseSectionMapper.listStuByDate(params);
406 410
     }
407 411
 }

+ 5
- 0
slive/src/main/java/com/xhkjedu/slive/service/liveplay/CourseService.java View File

@@ -412,6 +412,7 @@ public class CourseService {
412 412
 
413 413
     //分类下课程
414 414
     public List<CourseTypeVo> listAllForStu(LCourse course) {
415
+        course.setCreatetime(N_Utils.getSecondTimestamp());
415 416
         //获取所有课程
416 417
         List<CourseVo> courselst = courseMapper.listAllForStu(course);
417 418
 
@@ -459,6 +460,7 @@ public class CourseService {
459 460
 
460 461
     //课程列表
461 462
     public List<CourseVo> listAllForStu2(LCourse course) {
463
+        course.setCreatetime(N_Utils.getSecondTimestamp());
462 464
         return courseMapper.listAllForStu2(course);
463 465
     }
464 466
 
@@ -543,6 +545,9 @@ public class CourseService {
543 545
 
544 546
     //指定日期的课节列表
545 547
     public List<CourseSectionVo> listSectionsByDate(CourseParams p){
548
+        int timestamp = N_Utils.getSecondTimestamp();
549
+        String strtime = N_Utils.getStrtimeTimestamp(timestamp, "yyyy-MM-dd HH:mm");
550
+        p.setStrtime(strtime);
546 551
         return courseMapper.listSectionsByDate(p);
547 552
     }
548 553
 

+ 3
- 0
slive/src/main/java/com/xhkjedu/slive/service/liveplay/CsService.java View File

@@ -213,6 +213,9 @@ public class CsService {
213 213
 
214 214
     //我的课程列表
215 215
     public List<Map> listMySection(CourseParams params) {
216
+        int timestamp = N_Utils.getSecondTimestamp();
217
+        String strtime = N_Utils.getStrtimeTimestamp(timestamp, "yyyy-MM-dd HH:mm");
218
+        params.setStrtime(strtime);
216 219
         return csMapper.listMySection(params);
217 220
     }
218 221
 }

+ 3
- 1
slive/src/main/java/com/xhkjedu/slive/service/xz/XzService.java View File

@@ -680,11 +680,12 @@ public class XzService {
680 680
         try {
681 681
 
682 682
             //保存直播关联班级
683
+            int timestamp = N_Utils.getSecondTimestamp();
683 684
             LCourseClass courseClass = new LCourseClass();
684 685
             courseClass.setCourseid(courseVo.getCourseid());
685 686
             courseClass.setClassid(kjTeaVo.getClassid());
686 687
             courseClass.setCreateid(kjTeaVo.getTeacherid());
687
-            courseClass.setCreatetime(N_Utils.getSecondTimestamp());
688
+            courseClass.setCreatetime(timestamp);
688 689
             courseClassMapper.insertUseGeneratedKeys(courseClass);
689 690
 
690 691
             //说明该教师当前有其他直播课,则把班级加入课程,完成直播课学生数量
@@ -692,6 +693,7 @@ public class XzService {
692 693
             cs.setSchoolid(kjTeaVo.getSchoolid());
693 694
             cs.setClassid(kjTeaVo.getClassid());
694 695
             cs.setCreateid(kjTeaVo.getCreateid());
696
+            cs.setCreatetime(timestamp);
695 697
             classStudentMapper.saveAllClassStu(cs, courseVo.getClassid());
696 698
             //获取直播班对应全班学生分组id
697 699
             Integer groupid = groupMapper.getGroupIdByClassid(courseVo.getClassid());

+ 1
- 0
slive/src/main/java/com/xhkjedu/slive/vo/liveplay/CourseParams.java View File

@@ -37,4 +37,5 @@ public class CourseParams {
37 37
     private Integer pageSize;//分页显示条数
38 38
 
39 39
     private String sectionname;//课节名称
40
+    private String strtime;//当前时间
40 41
 }

+ 1
- 1
slive/src/main/resources/mapper/gradeclass/ClassStudentMapper.xml View File

@@ -20,7 +20,7 @@
20 20
     <!--保存班级学生到指定班级-->
21 21
     <insert id="saveAllClassStu">
22 22
         insert ignore into t_class_student (classid,studentid,createid,createtime,schoolid)
23
-        SELECT #{zbclassid},studentid,#{student.createid}, UNIX_TIMESTAMP(),#{student.schoolid} FROM t_class_student WHERE classid=#{student.classid};
23
+        SELECT #{zbclassid},studentid,#{student.createid},#{student.createtime},#{student.schoolid} FROM t_class_student WHERE classid=#{student.classid};
24 24
     </insert>
25 25
     <!--班级学生列表-->
26 26
     <select id="listByClassIds" resultType="com.xhkjedu.slive.vo.gradeclass.CStudentVo">

+ 1
- 1
slive/src/main/resources/mapper/gradeclass/GroupMapper.xml View File

@@ -15,6 +15,6 @@
15 15
     <!--保存全部分组学生-->
16 16
     <insert id="saveAllClassGroupStu">
17 17
         insert ignore into t_group_student (classid,groupid,studentid,createid,createtime,schoolid)
18
-        SELECT #{zbclassid},#{zbgroupid},studentid,#{student.createid}, UNIX_TIMESTAMP(),#{student.schoolid} FROM t_class_student WHERE classid=#{student.classid};
18
+        SELECT #{zbclassid},#{zbgroupid},studentid,#{student.createid},#{student.createtime},#{student.schoolid} FROM t_class_student WHERE classid=#{student.classid};
19 19
     </insert>
20 20
 </mapper>

+ 6
- 6
slive/src/main/resources/mapper/liveplay/CourseMapper.xml View File

@@ -88,11 +88,11 @@
88 88
     <select id="listSection" resultType="com.xhkjedu.slive.vo.liveplay.CourseSectionVo">
89 89
         select cs.sectionid,cs.sectionname,cs.sectiondate,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate
90 90
         ,cs.teacherid,cs.createid,cs.stunum,cs.sectionorder
91
-        ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
91
+        ,TIMESTAMPDIFF(SECOND,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
92 92
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
93 93
         ,(select u.username from t_user u where u.userid=cs.teacherid)teachername
94 94
         from l_course_section cs where cs.courseid=#{courseid}
95
-        order by UNIX_TIMESTAMP(concat(cs.sectiondate,' ',cs.planbegintime))
95
+        order by cs.sectiondate,cs.planbegintime
96 96
     </select>
97 97
     <!--学生选课详情-->
98 98
     <select id="findById" resultMap="courseResult">
@@ -220,7 +220,7 @@
220 220
         left join t_subject s on c.subjectid = s.subjectid
221 221
         left join l_course_type ct on c.ctypeid = ct.ctypeid
222 222
         where c.schoolid=#{course.schoolid} and c.coursetype=0 and c.deleted=1 and c.coursestate!=3
223
-        and c.limitstamp>=unix_timestamp(now())
223
+        and c.limitstamp>=#{course.createtime}
224 224
         <if test="course.gradeid!=null and course.gradeid!=0">
225 225
             and c.gradeid=#{course.gradeid}
226 226
         </if>
@@ -258,7 +258,7 @@
258 258
         left join t_user u on lcs.teacherid=u.userid
259 259
         left join t_subject s on c.subjectid = s.subjectid
260 260
         where c.schoolid=#{course.schoolid} and c.coursetype=0 and c.ctypeid=#{course.ctypeid} and c.deleted=1 and c.coursestate!=3
261
-        and c.limitstamp>=unix_timestamp(now())
261
+        and c.limitstamp>=#{course.createtime}
262 262
         <if test="course.gradeid!=null and course.gradeid!=0">
263 263
             and c.gradeid=#{course.gradeid}
264 264
         </if>
@@ -289,7 +289,7 @@
289 289
         select cs.courseid,cs.sectionid,c.coursename,c.classid,cs.sectionname,cs.sectiondate,cs.planbegintime,
290 290
         cs.planendtime,cs.begintime,cs.endtime,cs.teacherid,u.username as teachername,cs.sectionstate,
291 291
         c.subjectid,st.subjectname
292
-        ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
292
+        ,TIMESTAMPDIFF(SECOND,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
293 293
         ,cs.stunum,cs.sectionorder
294 294
         ,c.coursenum
295 295
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
@@ -309,7 +309,7 @@
309 309
             and cs.sectionstate=#{cp.cstate}
310 310
         </if>
311 311
         group by cs.sectionid
312
-        order by cs.sectionstate,abs(UNIX_TIMESTAMP(concat(cs.sectiondate,' ',cs.planbegintime))-UNIX_TIMESTAMP(now())),cs.sectionid
312
+        order by cs.sectionstate,abs(timestampdiff(second,concat(cs.sectiondate,' ',cs.planbegintime),#{cp.strtime})),cs.sectionid
313 313
     </select>
314 314
 
315 315
     <!--教师某月份下日期课程数量-->

+ 15
- 56
slive/src/main/resources/mapper/liveplay/CourseSectionMapper.xml View File

@@ -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
     <!--获取课程中正在进行的课节数量-->

+ 2
- 2
slive/src/main/resources/mapper/liveplay/CsMapper.xml View File

@@ -87,7 +87,7 @@
87 87
         ,(select t.typename from l_course_type t where t.ctypeid=c.ctypeid)typename
88 88
         ,cs.sectionid,cs.sectionname,cs.sectiondate,cs.teacherid,cs.stunum cynum
89 89
         ,cs.planbegintime,cs.planendtime,cs.begintime,cs.endtime,cs.sectionstate
90
-        ,(UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planendtime))-UNIX_TIMESTAMP(CONCAT(cs.sectiondate,' ',cs.planbegintime))) totaltime
90
+        ,TIMESTAMPDIFF(SECOND,CONCAT(cs.sectiondate,' ',cs.planendtime),CONCAT(cs.sectiondate,' ',cs.planbegintime)) totaltime
91 91
         ,(select count(*) from l_course_section_playback p where p.sectionid=cs.sectionid and p.pb is not null)playnum
92 92
         from l_course_section cs left join l_course c on cs.courseid = c.courseid
93 93
         where cs.teacherid=#{section.teacherid} and c.deleted=1 and c.courseschool=1 and cs.sectiondate=#{section.timestr}
@@ -97,6 +97,6 @@
97 97
         <if test="section.sectionname!=null and section.sectionname!=''">
98 98
             and cs.sectionname like '%${section.sectionname}%'
99 99
         </if>
100
-        order by cs.sectionstate,abs(UNIX_TIMESTAMP(concat(cs.sectiondate,' ',cs.planbegintime))-UNIX_TIMESTAMP(now())),cs.sectionid
100
+        order by cs.sectionstate,abs(timestampdiff(second,concat(cs.sectiondate,' ',cs.planbegintime),#{section.strtime})),cs.sectionid
101 101
     </select>
102 102
 </mapper>

Loading…
Cancel
Save