Browse Source

修改课程回顾详情排序,课程表删除单个单元格

tags/正式3.2.0
王宁 2 years ago
parent
commit
087347e19b

+ 7
- 7
sclass/src/main/resources/mapper/classroom/ClassroomMapper.xml View File

@@ -36,7 +36,7 @@
36 36
         ,sum(case when s.radiocorrect!=0 then 1 else 0 end)correctnum
37 37
         from t_classroom_askstudent s left join t_classroom_askteacher rt on s.asktid=rt.asktid
38 38
         where rt.roomid=#{roomid} and rt.asktype between 32 and 33
39
-        group by s.asktid
39
+        group by s.asktid order by rt.createtime
40 40
     </select>
41 41
     <select id="listExam" resultType="com.xhkjedu.sclass.vo.classroom.RoomCorrectExamVo">
42 42
         select s.paperid,p.papername,count(*)commitnum,count(*) stunum
@@ -44,7 +44,7 @@
44 44
         from t_classroom_paper_student s left join t_classroom_paper p on s.paperid=p.paperid
45 45
         left join t_classroom_askteacher rt on s.paperid=rt.paperid
46 46
         where rt.roomid=#{roomid} and rt.asktype=40
47
-        group by s.paperid
47
+        group by s.paperid order by p.createtime
48 48
     </select>
49 49
     <select id="listCorrect" resultMap="correctResult">
50 50
         select r.roomid,r.roomname,r.createtime,r.endtime,r.realstunum
@@ -77,7 +77,7 @@
77 77
         left join t_classroom_askteacher rt on rs.asktid=rt.asktid
78 78
         left join t_classroom_askstudent rs2 on rs2.asktid=rs.asktid
79 79
         where rs.asktid=#{asktid}
80
-        group by rs.asksid
80
+        group by rs.asksid order by rs.studentid
81 81
     </select>
82 82
     <!--获取考试批改学生列表-->
83 83
     <select id="listStudentsByPaperId" resultMap="checkResult">
@@ -87,7 +87,7 @@
87 87
         from t_classroom_paper_student ps left join t_user u on ps.studentid=u.userid
88 88
         left join t_classroom_paper_student ps2 on ps2.paperid=ps.paperid
89 89
         where ps.paperid=#{paperid}
90
-        group by ps.psid
90
+        group by ps.psid order by ps.studentid
91 91
     </select>
92 92
 
93 93
     <resultMap id="objectiveResult" type="com.xhkjedu.sclass.vo.classroom.ObjectiveVo">
@@ -218,7 +218,7 @@
218 218
         from t_classroom_askstudent s1 where s1.asktid=rt.asktid)correctrate
219 219
         from t_classroom_askstudent s right join t_classroom_askteacher rt on s.asktid=rt.asktid and s.studentid=#{studentid}
220 220
         where rt.roomid=#{roomid} and rt.asktype between 30 and 33
221
-        group by rt.asktid
221
+        group by rt.asktid order by rt.createtime
222 222
     </select>
223 223
     <select id="listStuAsk" resultType="java.util.Map">
224 224
         select a.asktype,a.fqnum,a.cynum,truncate(a.cynum*100/a.fqnum,2)cyrate
@@ -258,7 +258,7 @@
258 258
         left join t_classroom_paper_student s on s.paperid=p.paperid
259 259
         left join t_classroom_paper_student s1 on s1.paperid=rt.paperid and s1.studentid=#{studentid}
260 260
         where rt.roomid=#{roomid} and rt.asktype=40 and p.paperid is not null
261
-        group by p.paperid
261
+        group by p.paperid order by p.createtime
262 262
     </select>
263 263
     <select id="listStuEQuestion" resultType="java.util.Map">
264 264
         select
@@ -384,7 +384,7 @@
384 384
         LEFT JOIN t_classroom_paper_student ps ON p.paperid=ps.paperid
385 385
         LEFT JOIN t_classroom_askteacher rt ON p.paperid=rt.paperid
386 386
         LEFT JOIN t_classroom c ON rt.roomid=c.roomid
387
-        WHERE c.roomid=#{roomid} GROUP BY p.paperid
387
+        WHERE c.roomid=#{roomid} GROUP BY p.paperid order by p.createtime
388 388
     </select>
389 389
 
390 390
     <!--班级学生列表-->

+ 25
- 9
slive/src/main/java/com/xhkjedu/slive/controller/xz/XzController.java View File

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5 5
 import com.xhkjedu.slive.model.xz.LXz;
6 6
 import com.xhkjedu.slive.service.xz.XzService;
7
+import com.xhkjedu.slive.vo.xz.XzDateKjTeaVo;
7 8
 import com.xhkjedu.slive.vo.xz.XzDateVo;
8 9
 import com.xhkjedu.utils.N_Utils;
9 10
 import com.xhkjedu.utils.PageUtil;
@@ -107,6 +108,21 @@ public class XzController {
107 108
         return new ResultVo(0, "删除成功");
108 109
     }
109 110
 
111
+    /**
112
+     * @Description 获取行政直播课程表
113
+     * @Param [xz]
114
+     * @Return com.xhkjedu.vo.ResultVo
115
+     * @Author wn
116
+     * @Date 2022/4/1 13:57
117
+     **/
118
+    @PostMapping("/xzkb")
119
+    public ResultVo getXzKjDetail(@RequestBody LXz xz){
120
+        N_Utils.validation(new Object[]{xz.getXzid(),"行政直播id",1});
121
+        Map rtnmap = xzService.getXzKjDetail(xz);
122
+        return new ResultVo(0, "成功获取行政直播课程表",rtnmap);
123
+    }
124
+
125
+
110 126
     /**
111 127
      * @Description  保存行政直播课程表
112 128
      * @Param [xz]
@@ -114,24 +130,24 @@ public class XzController {
114 130
      * @Author wn
115 131
      * @Date 2022/4/1 9:41
116 132
      **/
117
-    @PostMapping("/sxzk")
133
+    @PostMapping("/kcbs")
118 134
     public ResultVo saveXzCourse(@RequestBody LXz xz){
119 135
         N_Utils.validation(new Object[]{xz.getXzid(),"行政直播id",1});
120 136
         return xzService.saveXzCourse(xz);
121 137
     }
122 138
 
123 139
     /**
124
-     * @Description 获取行政直播课程表
125
-     * @Param [xz]
140
+     * @Description 删除课程表单个单元格数据
141
+     * @Param [kjTeaVo]
126 142
      * @Return com.xhkjedu.vo.ResultVo
127 143
      * @Author wn
128
-     * @Date 2022/4/1 13:57
144
+     * @Date 2022/4/1 17:52
129 145
      **/
130
-    @PostMapping("/xzkb")
131
-    public ResultVo getXzKjDetail(@RequestBody LXz xz){
132
-        N_Utils.validation(new Object[]{xz.getXzid(),"行政直播id",1});
133
-        Map rtnmap = xzService.getXzKjDetail(xz);
134
-        return new ResultVo(0, "成功获取行政直播课程表",rtnmap);
146
+    @PostMapping("/kcbd")
147
+    public ResultVo delXzkjDyg(@RequestBody XzDateKjTeaVo kjTeaVo){
148
+        N_Utils.validation(new Object[]{kjTeaVo.getCourseid(),"课程id",1,kjTeaVo.getClassid(),"班级id",1});
149
+        xzService.delXzkjDyg(kjTeaVo);
150
+        return new ResultVo(0, "成功删除单个课程信息");
135 151
     }
136 152
 
137 153
 }

+ 3
- 3
slive/src/main/java/com/xhkjedu/slive/controller/xz/XzKjController.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.slive.controller.xz;
2 2
 
3 3
 import com.xhkjedu.slive.model.xz.LXzKj;
4 4
 import com.xhkjedu.slive.service.xz.XzKjService;
5
+import com.xhkjedu.slive.vo.xz.XzDateKjVo;
5 6
 import com.xhkjedu.utils.N_Utils;
6 7
 import com.xhkjedu.vo.ResultVo;
7 8
 import org.springframework.web.bind.annotation.PostMapping;
@@ -11,7 +12,6 @@ import org.springframework.web.bind.annotation.RestController;
11 12
 
12 13
 import javax.annotation.Resource;
13 14
 import java.util.List;
14
-import java.util.Map;
15 15
 
16 16
 /**
17 17
  * @Description 行政直播课节详情
@@ -27,8 +27,8 @@ public class XzKjController {
27 27
     @PostMapping("/kjs")
28 28
     public ResultVo listKjsByXzid(@RequestBody LXzKj kj){
29 29
         N_Utils.validation(new Object[]{kj.getXzid(),"行政直播id",1});
30
-        List<Map> map = xzKjService.listXzKjsByXzid(kj.getXzid());
31
-        return new ResultVo(0,"成功获取行政直播课节详情",map);
30
+        List<XzDateKjVo> rtn = xzKjService.listXzKjsByXzid(kj.getXzid());
31
+        return new ResultVo(0,"成功获取行政直播课节详情",rtn);
32 32
     }
33 33
 
34 34
     /**

+ 3
- 0
slive/src/main/java/com/xhkjedu/slive/mapper/gradeclass/ClassMapper.java View File

@@ -28,4 +28,7 @@ public interface ClassMapper extends TkMapper<TClass> {
28 28
 
29 29
     //获取班级当前年份
30 30
     Integer getYearById(Integer classid);
31
+
32
+    //删除班级学生及分组学生
33
+    void deleteClassstu(@Param("zbclassid") Integer zbclassid, @Param("classid")Integer classid);
31 34
 }

+ 6
- 0
slive/src/main/java/com/xhkjedu/slive/mapper/liveplay/CourseClassMapper.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.slive.mapper.liveplay;
2 2
 
3 3
 import com.xhkjedu.slive.base.TkMapper;
4 4
 import com.xhkjedu.slive.model.liveplay.LCourseClass;
5
+import org.apache.ibatis.annotations.Param;
5 6
 import org.springframework.stereotype.Repository;
6 7
 
7 8
 /**
@@ -13,4 +14,9 @@ import org.springframework.stereotype.Repository;
13 14
 @Repository
14 15
 public interface CourseClassMapper extends TkMapper<LCourseClass> {
15 16
 
17
+    //获取课程关联指定班级外的其他班级数量
18
+    Integer getOtherClassnumByCourseid(@Param("courseid")Integer courseid,@Param("classid")Integer classid);
19
+
20
+    //根据课程id和班级id删除关联关系
21
+    void deleteByCourseidAndClassid(@Param("courseid")Integer courseid,@Param("classid")Integer classid);
16 22
 }

+ 2
- 0
slive/src/main/java/com/xhkjedu/slive/mapper/liveplay/CourseMapper.java View File

@@ -102,4 +102,6 @@ public interface CourseMapper extends TkMapper<LCourse> {
102 102
     void updateCoursename(@Param("course") LCourse course);
103 103
     //修改课程课节备注
104 104
     void updateCoursecomm(@Param("course") LCourse course);
105
+    //根据课程id删除关联课程关联信息
106
+    void deleteCourseClassByCourseid(@Param("courseid") Integer courseid);
105 107
 }

+ 2
- 1
slive/src/main/java/com/xhkjedu/slive/mapper/xz/XzKjMapper.java View File

@@ -2,6 +2,7 @@ package com.xhkjedu.slive.mapper.xz;
2 2
 
3 3
 import com.xhkjedu.slive.base.TkMapper;
4 4
 import com.xhkjedu.slive.model.xz.LXzKj;
5
+import com.xhkjedu.slive.vo.xz.XzDateKjVo;
5 6
 import org.apache.ibatis.annotations.Param;
6 7
 import org.springframework.stereotype.Repository;
7 8
 
@@ -17,7 +18,7 @@ import java.util.Map;
17 18
 public interface XzKjMapper extends TkMapper<LXzKj> {
18 19
 
19 20
     //获取行政直播课节详情
20
-    List<Map> listXzKjsByXzid(@Param("xzid") Integer xzid);
21
+    List<XzDateKjVo> listXzKjsByXzid(@Param("xzid") Integer xzid);
21 22
 
22 23
     //批量修改行政直播课节详情
23 24
     void updateBatchXzKj(@Param("list") List<LXzKj> list);

+ 1
- 1
slive/src/main/java/com/xhkjedu/slive/mapper/xz/XzMapper.java View File

@@ -20,7 +20,7 @@ public interface XzMapper extends TkMapper<LXz> {
20 20
     //行政直播列表
21 21
     List<Map> listXzs(@Param("xz") LXz xz);
22 22
 
23
-    //行政直播下进行中或已结束的课节数量
23
+    //行政直播课对应的课程已开课数量
24 24
     Integer getXzSectionKsNum(@Param("xzid") Integer xzid);
25 25
 
26 26
     //删除行政直播下所有的直播课程和直播班级

+ 2
- 3
slive/src/main/java/com/xhkjedu/slive/service/xz/XzKjService.java View File

@@ -2,13 +2,13 @@ package com.xhkjedu.slive.service.xz;
2 2
 
3 3
 import com.xhkjedu.slive.mapper.xz.XzKjMapper;
4 4
 import com.xhkjedu.slive.model.xz.LXzKj;
5
+import com.xhkjedu.slive.vo.xz.XzDateKjVo;
5 6
 import com.xhkjedu.utils.N_Utils;
6 7
 import com.xhkjedu.vo.ResultVo;
7 8
 import org.springframework.stereotype.Service;
8 9
 
9 10
 import javax.annotation.Resource;
10 11
 import java.util.List;
11
-import java.util.Map;
12 12
 
13 13
 /**
14 14
  * @Description 行政直播课节
@@ -23,11 +23,10 @@ public class XzKjService {
23 23
     /**
24 24
      * @Description  获取行政直播课节基本信息
25 25
      * @Param [xzid]
26
-     * @Return com.xhkjedu.vo.ResultVo
27 26
      * @Author wn
28 27
      * @Date 2022/3/31 14:07
29 28
      **/
30
-    public List<Map> listXzKjsByXzid(Integer xzid) {
29
+    public List<XzDateKjVo> listXzKjsByXzid(Integer xzid) {
31 30
         return xzKjMapper.listXzKjsByXzid(xzid);
32 31
     }
33 32
 

+ 75
- 34
slive/src/main/java/com/xhkjedu/slive/service/xz/XzService.java View File

@@ -1,5 +1,6 @@
1 1
 package com.xhkjedu.slive.service.xz;
2 2
 
3
+import com.xhkjedu.slive.mapper.gradeclass.ClassMapper;
3 4
 import com.xhkjedu.slive.mapper.gradeclass.ClassTeacherMapper;
4 5
 import com.xhkjedu.slive.mapper.gradeclass.SchoolMapper;
5 6
 import com.xhkjedu.slive.mapper.liveplay.CourseClassMapper;
@@ -18,8 +19,8 @@ import com.xhkjedu.slive.service.gradeclass.ClassService;
18 19
 import com.xhkjedu.slive.utils.LiveUtil;
19 20
 import com.xhkjedu.slive.vo.gradeclass.ClassVo;
20 21
 import com.xhkjedu.slive.vo.xz.XzDateVo;
21
-import com.xhkjedu.slive.vo.xz.XzDateXjTeaVo;
22
-import com.xhkjedu.slive.vo.xz.XzDateXjVo;
22
+import com.xhkjedu.slive.vo.xz.XzDateKjTeaVo;
23
+import com.xhkjedu.slive.vo.xz.XzDateKjVo;
23 24
 import com.xhkjedu.utils.N_Utils;
24 25
 import com.xhkjedu.vo.ResultVo;
25 26
 import lombok.extern.slf4j.Slf4j;
@@ -58,6 +59,8 @@ public class XzService {
58 59
     private ClassService classService;
59 60
     @Resource
60 61
     private ClassTeacherMapper classTeacherMapper;
62
+    @Resource
63
+    private ClassMapper classMapper;
61 64
 
62 65
     /**
63 66
      * @Description 行政直播列表
@@ -91,7 +94,7 @@ public class XzService {
91 94
             kj.setXzid(xzid);
92 95
             String kjname = LiveUtil.getChineStrByNum(i);
93 96
             kj.setKjname("第" + kjname + "节");
94
-            kj.setKjorder(i+1);
97
+            kj.setKjorder(i + 1);
95 98
             kj.setCreateid(xz.getCreateid());
96 99
             kj.setCreatetime(timestamp);
97 100
 
@@ -145,13 +148,14 @@ public class XzService {
145 148
                 xzMapper.deleteCourseClassByXzid(xzid);
146 149
                 xzMapper.deleteXzAndKjByXzid(xzid);
147 150
             }
148
-        }catch (Exception e){
149
-            log.error("删除行政直播出错:"+e.getMessage());
151
+        } catch (Exception e) {
152
+            log.error("删除行政直播出错:" + e.getMessage());
150 153
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
151 154
         }
152 155
 
153 156
 
154 157
     }
158
+
155 159
     /**
156 160
      * @Description 保存行政直播课程表
157 161
      * @Param [xzDatelst]
@@ -168,14 +172,14 @@ public class XzService {
168 172
             //日期下的课节情况
169 173
             XzDateVo xzDateVo = xzDatelst.get(i);
170 174
             String datazhou = LiveUtil.getDateZhou(xzDateVo.getSelectdate());//要保存日期对应的周
171
-            List<XzDateXjVo> dateKjlst = xzDateVo.getKjs();//指定日期下课节情况
175
+            List<XzDateKjVo> dateKjlst = xzDateVo.getKjs();//指定日期下课节情况
172 176
 
173 177
             for (int j = 0; j < dateKjlst.size(); j++) {
174 178
                 //单课节情况
175
-                XzDateXjVo dateKjVo = dateKjlst.get(j);
176
-                List<XzDateXjTeaVo> xjTealst = dateKjVo.getKjteas();//单课节下各班级情况
179
+                XzDateKjVo dateKjVo = dateKjlst.get(j);
180
+                List<XzDateKjTeaVo> xjTealst = dateKjVo.getKjteas();//单课节下各班级情况
177 181
                 //处理成教师下班级形式,生成课程
178
-                Map<Integer, List<XzDateXjTeaVo>> map = listChangeTeacherClass(xjTealst);
182
+                Map<Integer, List<XzDateKjTeaVo>> map = listChangeTeacherClass(xjTealst);
179 183
                 LCourse course = new LCourse();
180 184
                 course.setGradeid(x.getGradeid());
181 185
                 course.setBegindate(xzDateVo.getSelectdate());
@@ -189,11 +193,12 @@ public class XzService {
189 193
                 course.setCreatetime(N_Utils.getSecondTimestamp());
190 194
                 course.setSchoolid(x.getSchoolid());
191 195
 
192
-                for(Map.Entry<Integer, List<XzDateXjTeaVo>> entry : map.entrySet()){
193
-                    List<XzDateXjTeaVo> xjTeas = entry.getValue();
196
+                for (Map.Entry<Integer, List<XzDateKjTeaVo>> entry : map.entrySet()) {
197
+                    List<XzDateKjTeaVo> xjTeas = entry.getValue();
194 198
                     String teachername = xjTeas.get(0).getTeachername();
195 199
                     //单个教师课程信息
196
-                    String coursename = datazhou + dateKjVo.getKjname() +xjTeas.get(0).getSubjectname()+ "("+ teachername +")";
200
+                    String coursename =
201
+                            datazhou + dateKjVo.getKjname() + xjTeas.get(0).getSubjectname() + "(" + teachername + ")";
197 202
 
198 203
                     course.setCoursename(coursename);
199 204
                     course.setSubjectid(xjTeas.get(0).getSubjectid());
@@ -202,7 +207,7 @@ public class XzService {
202 207
                     course.setEndtime(dateKjVo.getEndtime());
203 208
                     course.setKjid(dateKjVo.getKjid());
204 209
                     //保存行政直播课程表
205
-                    saveCourseAll(xjTeas,course);
210
+                    saveCourseAll(xjTeas, course);
206 211
                 }
207 212
             }
208 213
         }
@@ -210,17 +215,19 @@ public class XzService {
210 215
     }
211 216
 
212 217
     //指定天某天某节课下的教师班级层级关系
213
-    private Map<Integer, List<XzDateXjTeaVo>> listChangeTeacherClass(List<XzDateXjTeaVo> xjTealst) {
214
-        Map<Integer, List<XzDateXjTeaVo>> map = new HashMap<>();
218
+    private Map<Integer, List<XzDateKjTeaVo>> listChangeTeacherClass(List<XzDateKjTeaVo> xjTealst) {
219
+        Map<Integer, List<XzDateKjTeaVo>> map = new HashMap<>();
215 220
 
216 221
         for (int i = 0; i < xjTealst.size(); i++) {
217
-            XzDateXjTeaVo xzDateXjTeaVo = xjTealst.get(i);
218
-            if (map.containsKey(xzDateXjTeaVo.getTeacherid())) {
219
-                map.get(xzDateXjTeaVo.getTeacherid()).add(xzDateXjTeaVo);
220
-            } else {
221
-                List<XzDateXjTeaVo> classlst = new ArrayList<>();
222
-                classlst.add(xzDateXjTeaVo);
223
-                map.put(xzDateXjTeaVo.getTeacherid(), classlst);
222
+            XzDateKjTeaVo xzDateXjTeaVo = xjTealst.get(i);
223
+            if (!N_Utils.isEmptyInteger(xzDateXjTeaVo.getTeacherid())) {
224
+                if (map.containsKey(xzDateXjTeaVo.getTeacherid())) {
225
+                    map.get(xzDateXjTeaVo.getTeacherid()).add(xzDateXjTeaVo);
226
+                } else {
227
+                    List<XzDateKjTeaVo> classlst = new ArrayList<>();
228
+                    classlst.add(xzDateXjTeaVo);
229
+                    map.put(xzDateXjTeaVo.getTeacherid(), classlst);
230
+                }
224 231
             }
225 232
         }
226 233
         return map;
@@ -228,10 +235,10 @@ public class XzService {
228 235
 
229 236
     //保存行政直播课程表
230 237
     @Transactional(rollbackFor = Exception.class)
231
-    public void saveCourseAll(List<XzDateXjTeaVo> xjTeas,LCourse course){
238
+    public void saveCourseAll(List<XzDateKjTeaVo> xjTeas, LCourse course) {
232 239
         try {
233 240
             //获取集合中所有的班级id
234
-            List classidlst = xjTeas.stream().map(XzDateXjTeaVo::getClassid).collect(Collectors.toList());
241
+            List classidlst = xjTeas.stream().map(XzDateKjTeaVo::getClassid).collect(Collectors.toList());
235 242
             List<Map> users = courseMapper.listUid(classidlst);//获取课班级下学生
236 243
 
237 244
             //新生成直播班班级信息
@@ -273,7 +280,7 @@ public class XzService {
273 280
 
274 281
             //保存直播关联班级
275 282
             List<LCourseClass> cclist = new ArrayList<>();
276
-            for(int i=0;i<classidlst.size();i++){
283
+            for (int i = 0; i < classidlst.size(); i++) {
277 284
                 Integer cid = Integer.parseInt(classidlst.get(i).toString());
278 285
                 LCourseClass cc = new LCourseClass();
279 286
                 cc.setCourseid(courseid);
@@ -287,9 +294,6 @@ public class XzService {
287 294
             }
288 295
             courseClassMapper.insertList(cclist);//保存原班级和直播的关联关系
289 296
 
290
-            //获取班级人数
291
-            ClassVo classVo = classService.getById(classid);
292
-
293 297
             //保存课程课节关联关系
294 298
             LCourseSection cs = new LCourseSection();
295 299
             cs.setCourseid(courseid);
@@ -299,14 +303,14 @@ public class XzService {
299 303
             cs.setSectiondate(course.getBegindate());
300 304
             cs.setPlanbegintime(course.getBegintime());
301 305
             cs.setPlanendtime(course.getEndtime());
302
-            cs.setStunum(classVo.getClassnum());
306
+            cs.setStunum(0);
303 307
             cs.setSectionstate(0);
304 308
             cs.setCreateid(course.getCreateid());
305 309
             cs.setCreatetime(course.getCreatetime());
306 310
             courseSectionMapper.insertUseGeneratedKeys(cs);//保存课程课节信息
307 311
 
308
-        }catch (Exception e){
309
-            log.info("保存行政直播课程表出错:"+e.getMessage());
312
+        } catch (Exception e) {
313
+            log.info("保存行政直播课程表出错:" + e.getMessage());
310 314
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
311 315
         }
312 316
     }
@@ -319,12 +323,49 @@ public class XzService {
319 323
      * @Date 2022/4/1 13:59
320 324
      **/
321 325
     public Map getXzKjDetail(LXz xz) {
322
-        if(N_Utils.isNotEmpty(xz.getBegindate())){
323
-            xz.setEnddate(LiveUtil.getSelectDateAfter(xz.getBegindate(),6));
326
+        if (N_Utils.isNotEmpty(xz.getBegindate())) {
327
+            xz.setEnddate(LiveUtil.getSelectDateAfter(xz.getBegindate(), 6));
324 328
         }
325 329
         //先获取课程基本信息
326 330
         Map map = xzMapper.getXzForRtn(xz.getXzid());
327
-        map.put("xzdates",xzMapper.listXzKjDetail(xz));
331
+        map.put("xzdates", xzMapper.listXzKjDetail(xz));
328 332
         return map;
329 333
     }
334
+
335
+    /**
336
+     * @Description 删除单个单元格
337
+     * @Param [kjTeaVo]
338
+     * @Return com.xhkjedu.vo.ResultVo
339
+     * @Author wn
340
+     * @Date 2022/4/1 17:42
341
+     **/
342
+    @Transactional
343
+    public ResultVo delXzkjDyg(XzDateKjTeaVo kjTeaVo) {
344
+        try {
345
+            //判断课程的状态,如果已经开始上课则不能删除
346
+            LCourse course = courseMapper.selectByPrimaryKey(kjTeaVo.getCourseid());
347
+            if (course.getCoursestate() > 0) {
348
+                return new ResultVo(1,"选择的课程已经开始上课,不允许删除");
349
+            } else {
350
+                //删除单个单元格中设置的教师信息,先判断该单元格对应的课程是否有其他班级
351
+                Integer coursenum = courseClassMapper.getOtherClassnumByCourseid(kjTeaVo.getCourseid(), kjTeaVo.getClassid());
352
+                if (coursenum == 0) {
353
+                    //说明该课程仅关联一个班级,直接删除该课程以及该课程对应的直播班
354
+                    courseMapper.deleteCourseClassByCourseid(kjTeaVo.getCourseid());
355
+                } else {
356
+                    //说明关联的还有其他班级,删除该班级在直播班级中的学生,
357
+                    courseClassMapper.deleteByCourseidAndClassid(kjTeaVo.getCourseid(),kjTeaVo.getClassid());
358
+                    //处理对应直播班级中学生
359
+                    classMapper.deleteClassstu(course.getClassid(),kjTeaVo.getClassid());
360
+                    classMapper.updateNum2(course.getClassid());//更改班级以及班级分组人数
361
+                    courseMapper.updateStuNum(kjTeaVo.getCourseid());//更新直播课学生数量
362
+                }
363
+            }
364
+            return new ResultVo(0,"成功删除课程表单个课程");
365
+        }catch (Exception e){
366
+            log.error("删除课程表单个课程出错:"+e.getMessage());
367
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
368
+            return new ResultVo(1,"删除课程表单个课程失败");
369
+        }
370
+    }
330 371
 }

slive/src/main/java/com/xhkjedu/slive/vo/xz/XzDateXjTeaVo.java → slive/src/main/java/com/xhkjedu/slive/vo/xz/XzDateKjTeaVo.java View File

@@ -10,7 +10,7 @@ import java.util.List;
10 10
  * Date 2022/3/31 10:04
11 11
  **/
12 12
 @Data
13
-public class XzDateXjTeaVo {
13
+public class XzDateKjTeaVo {
14 14
 
15 15
     private Integer classid;//班级id
16 16
     private String classname;//班级名称
@@ -21,5 +21,5 @@ public class XzDateXjTeaVo {
21 21
     private String subjectid;//科目id
22 22
     private String subjectname;//科目名称
23 23
 
24
-    private List<XzDateXjTeaVo> xjclass;//存放层级用于保存时使用
24
+    private List<XzDateKjTeaVo> xjclass;//存放层级用于保存时使用
25 25
 }

slive/src/main/java/com/xhkjedu/slive/vo/xz/XzDateXjVo.java → slive/src/main/java/com/xhkjedu/slive/vo/xz/XzDateKjVo.java View File

@@ -10,12 +10,12 @@ import java.util.List;
10 10
  * Date 2022/3/31 10:04
11 11
  **/
12 12
 @Data
13
-public class XzDateXjVo {
13
+public class XzDateKjVo {
14 14
     private Integer kjid;//行政课节id
15 15
     private String kjname;//课节名称
16 16
     private Integer kjorder;//课节排序
17 17
     private String begintime;//开始时间
18 18
     private String endtime;//结束时间
19
-    private List<XzDateXjTeaVo> kjteas;//指定日期下课节下所有的直播课
19
+    private List<XzDateKjTeaVo> kjteas;//指定日期下课节下所有的直播课
20 20
 
21 21
 }

+ 1
- 2
slive/src/main/java/com/xhkjedu/slive/vo/xz/XzDateVo.java View File

@@ -2,7 +2,6 @@ package com.xhkjedu.slive.vo.xz;
2 2
 
3 3
 import lombok.Data;
4 4
 
5
-import java.util.ArrayList;
6 5
 import java.util.List;
7 6
 
8 7
 /**
@@ -13,7 +12,7 @@ import java.util.List;
13 12
 @Data
14 13
 public class XzDateVo {
15 14
     private String selectdate;//当前选择日期
16
-    private List<XzDateXjVo> kjs;//行政直播课节集合
15
+    private List<XzDateKjVo> kjs;//行政直播课节集合
17 16
 
18 17
 
19 18
 }

+ 8
- 0
slive/src/main/resources/mapper/gradeclass/ClassMapper.xml View File

@@ -40,4 +40,12 @@
40 40
     <select id="getYearById" resultType="java.lang.Integer">
41 41
         select year from t_class where classid=#{classid}
42 42
     </select>
43
+
44
+    <!--删除班级学生及分组学生-->
45
+    <delete id="deleteClassstu">
46
+        delete cs.*,gs.* from t_class_student cs
47
+        left join t_class_student cs2 on cs.studentid=cs2.studentid
48
+        left join t_group_student gs on cs.classid=gs.classid and cs.studentid=gs.studentid
49
+        where cs.classid=#{zbclassid} and cs2.classid=#{classid} and cs.xzed=0
50
+    </delete>
43 51
 </mapper>

+ 14
- 0
slive/src/main/resources/mapper/liveplay/CourseClassMapper.xml View File

@@ -0,0 +1,14 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.slive.mapper.liveplay.CourseClassMapper">
4
+
5
+    <!--获取课程关联指定班级外的其他班级数量-->
6
+    <select id="getOtherClassnumByCourseid" resultType="java.lang.Integer">
7
+        select count(*) from l_course_class where courseid=#{courseid} and classid!=#{classid}
8
+    </select>
9
+
10
+    <!--根据课程id和班级id删除关联关系-->
11
+    <delete id="deleteByCourseidAndClassid">
12
+        delete from l_course_class where courseid=#{courseid} and classid=#{classid}
13
+    </delete>
14
+</mapper>

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

@@ -18,7 +18,7 @@
18 18
         <if test="course.classid!=null and course.classid!=0">
19 19
             left join l_course_class cc on cc.courseid=c.courseid
20 20
         </if>
21
-        where c.schoolid=#{course.schoolid} and c.deleted=1
21
+        where c.schoolid=#{course.schoolid} and c.deleted=1 and c.courseclass=0
22 22
         <if test="course.gradeid!=null and course.gradeid!=0">
23 23
             and c.gradeid=#{course.gradeid}
24 24
         </if>
@@ -501,4 +501,9 @@
501 501
         update l_course c ,l_course_section s set c.comm=#{course.comm},s.comm=#{course.comm}
502 502
         where c.courseid=s.courseid and c.courseid=#{course.courseid}
503 503
     </update>
504
+
505
+    <!--根据课程id删除关联课程关联信息-->
506
+    <delete id="deleteCourseClassByCourseid">
507
+        delete c,tc from l_course c,t_class tc where c.classid=tc.classid and c.courseid=#{courseid}
508
+    </delete>
504 509
 </mapper>

+ 1
- 1
slive/src/main/resources/mapper/xz/XzKjMapper.xml View File

@@ -3,7 +3,7 @@
3 3
 <mapper namespace="com.xhkjedu.slive.mapper.xz.XzKjMapper">
4 4
 
5 5
     <!--获取行政直播课节详情-->
6
-    <select id="listXzKjsByXzid" resultType="java.util.Map">
6
+    <select id="listXzKjsByXzid" resultType="com.xhkjedu.slive.vo.xz.XzDateKjVo">
7 7
         select * from l_xz_kj where xzid=#{xzid} order by kjorder asc
8 8
     </select>
9 9
 

+ 8
- 11
slive/src/main/resources/mapper/xz/XzMapper.xml View File

@@ -13,11 +13,10 @@
13 13
         order by x.begindate desc
14 14
     </select>
15 15
 
16
-    <!--行政直播课对应的课节进行中或已结束数量-->
16
+    <!--行政直播课对应的课程已开课数量-->
17 17
     <select id="getXzSectionKsNum" resultType="java.lang.Integer">
18
-        select count(*) from l_course_section s left join l_course c on c.courseid = s.courseid
19
-        left join l_xz_kj k on c.kjid = k.kjid
20
-        where k.xzid = #{xzid} and s.sectionstate BETWEEN 2 and 3
18
+        select count(*) from l_course c left join l_xz_kj k on c.kjid = k.kjid
19
+        where k.xzid = #{xzid} and c.coursestate>0
21 20
     </select>
22 21
 
23 22
     <!--删除行政直播下所有的直播课程和直播班级-->
@@ -28,14 +27,12 @@
28 27
     </delete>
29 28
     <!--删除行政直播和课节详情-->
30 29
     <delete id="deleteXzAndKjByXzid">
31
-        delete
32
-        x,k from l_xz as x left join l_xz_kj as k on x.xzid=k.xzid where x.xzid=
30
+        delete x,k from l_xz as x left join l_xz_kj as k on x.xzid=k.xzid where x.xzid=
33 31
         #{xzid}
34 32
     </delete>
35 33
     <!--删除行政直播下未开始的直播课、班级、课节详情-->
36 34
     <delete id="deleteCourseClassKjByXzid">
37
-        delete
38
-        c,lc,k from t_class as c left join l_course as lc on c.classid=lc.classid
35
+        delete c,lc,k from t_class as c left join l_course as lc on c.classid=lc.classid
39 36
         left join l_course_section ls on ls.courseid=lc.courseid
40 37
         left join l_xz_kj k on k.kjid=lc.kjid where k.xzid=#{xzid}
41 38
         and ls.sectionstate = 0
@@ -75,13 +72,13 @@
75 72
 
76 73
     <resultMap id="xzkjDate" type="java.util.Map">
77 74
         <result property="selectdate" column="selectdate"></result>
78
-        <collection property="kjs" ofType="com.xhkjedu.slive.vo.xz.XzDateXjVo" javaType="java.util.List">
75
+        <collection property="kjs" ofType="com.xhkjedu.slive.vo.xz.XzDateKjVo" javaType="java.util.List">
79 76
             <result property="kjid" column="kjid"></result>
80 77
             <result property="kjname" column="kjname"></result>
81 78
             <result property="kjorder" column="kjorder"></result>
82 79
             <result property="begintime" column="begintime"></result>
83 80
             <result property="endtime" column="endtime"></result>
84
-            <collection property="kjteas" ofType="com.xhkjedu.slive.vo.xz.XzDateXjTeaVo"
81
+            <collection property="kjteas" ofType="com.xhkjedu.slive.vo.xz.XzDateKjTeaVo"
85 82
                         javaType="java.util.List" select="listKjClassTea" column="{kjid=kjid,selectdate=selectdate}">
86 83
                 <result property="classid" column="classid"></result>
87 84
                 <result property="classname" column="classname"></result>
@@ -105,7 +102,7 @@
105 102
         group by c.begindate,k.kjid
106 103
     </select>
107 104
     <!--获取指定课节指定日期所有班级的课程和教师-->
108
-    <select id="listKjClassTea" resultType="com.xhkjedu.slive.vo.xz.XzDateXjTeaVo">
105
+    <select id="listKjClassTea" resultType="com.xhkjedu.slive.vo.xz.XzDateKjTeaVo">
109 106
         select c.classid,lc.classname,c.teacherid,u.username as teachername,
110 107
                c.subjectid,s.subjectname,c.kjid,c.courseid,c.coursestate
111 108
         from l_course c left join l_course_class cc on c.courseid=cc.courseid

Loading…
Cancel
Save