소스 검색

管乐迷课件新增老师和学员的课件权限配置

zouxuan 1 년 전
부모
커밋
87b31c41aa

+ 0 - 1
mec-application/src/main/java/com/ym/mec/teacher/controller/LessonCoursewareController.java

@@ -17,7 +17,6 @@ import com.ym.mec.common.page.PageUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.collections.CollectionUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;

+ 1 - 1
mec-application/src/main/java/com/ym/mec/teacher/controller/TeacherCourseScheduleController.java

@@ -106,7 +106,7 @@ public class TeacherCourseScheduleController extends BaseController {
                     if (!voR.getCode().equals(200)){
                         LessonCourseware lessonCourseware = lessonCoursewareService.lambdaQuery()
                                 .eq(LessonCourseware::getLessonCourseId, voR.getData().getLessonCoursewareId()).last("LIMIT 1").one();
-                        if (Objects.isNull(lessonCourseware)){
+                        if (Objects.isNull(lessonCourseware) || StringUtils.equals(lessonCourseware.getTeacherRangeType(),"DISABLE")){
                             courseScheduleDto.setCoursewareEnable(false);
                             continue;
                         }

+ 3 - 4
mec-application/src/main/java/com/ym/mec/web/controller/LessonCoursewareController.java

@@ -1,6 +1,5 @@
 package com.ym.mec.web.controller;
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.dayaedu.cbs.openfeign.client.CoursewareFeignService;
 import com.dayaedu.cbs.openfeign.wrapper.courseware.CbsLessonCoursewareWrapper;
 import com.google.common.collect.Lists;
@@ -66,9 +65,9 @@ public class LessonCoursewareController extends BaseController {
 	@ApiOperation(value = "分页查询已添加的课件")
 	@PostMapping("/queryLessonCourseware")
 	@PreAuthorize("@pcs.hasPermissions('lessonCourseware/queryLessonCourseware')")
-	public HttpResponseResult<PageInfo<LessonCoursewareWrapper.LessonCoursewareDto>> queryLessonCourseware(@RequestBody LessonCoursewareWrapper.LessonCoursewareQuery query){
-		IPage<LessonCoursewareWrapper.LessonCoursewareDto> pages = lessonCoursewareService.selectPage(QueryInfo.getPage(query), query);
-		return succeed(PageUtil.pageInfo(pages));
+	public HttpResponseResult<PageInfo<LessonCoursewareWrapper.LessonCoursewareDto>>
+	queryLessonCourseware(@RequestBody LessonCoursewareWrapper.LessonCoursewareQuery query){
+		return succeed(PageUtil.pageInfo(lessonCoursewareService.selectPage(QueryInfo.getPage(query), query)));
 	}
 
 	@ApiOperation(value = "添加课件")

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/LessonCourseware.java

@@ -24,11 +24,11 @@ public class LessonCourseware{
 	@TableField(value = "lesson_course_id_")
 	private Long lessonCourseId;
 
-	@ApiModelProperty(value = "学员适用范围")
+	@ApiModelProperty(value = "学员适用范围ALL,RANGE,DISABLE")
 	@TableField(value = "student_range_type_")
 	private String studentRangeType;
 
-	@ApiModelProperty(value = "老师适用范围")
+	@ApiModelProperty(value = "老师适用范围ALL,RANGE,DISABLE")
 	@TableField(value = "teacher_range_type_")
 	private String teacherRangeType;
 

+ 10 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/wrapper/LessonCoursewareWrapper.java

@@ -37,6 +37,12 @@ public class LessonCoursewareWrapper {
         @ApiModelProperty("启用状态")
         private Boolean enable;
 
+        @ApiModelProperty(value = "学员适用范围ALL,RANGE,DISABLE")
+        private String studentRangeType;
+
+        @ApiModelProperty(value = "老师适用范围ALL,RANGE,DISABLE")
+        private String teacherRangeType;
+
         private Integer teacherId;
 
         private Integer studentId;
@@ -114,13 +120,13 @@ public class LessonCoursewareWrapper {
         @ApiModelProperty(value = "课件编号")
         private Integer lessonCoursewareId;
 
-        @ApiModelProperty(value = "学员适用范围")
+        @ApiModelProperty(value = "学员适用范围ALL,RANGE,DISABLE")
         private String studentRangeType;
 
         @ApiModelProperty(value = "学员编号")
         private List<Integer> studentIds;
 
-        @ApiModelProperty(value = "老师适用范围")
+        @ApiModelProperty(value = "老师适用范围ALL,RANGE,DISABLE")
         private String teacherRangeType;
 
         @ApiModelProperty(value = "老师编号")
@@ -140,10 +146,10 @@ public class LessonCoursewareWrapper {
         @ApiModelProperty(value = "课件名称")
         private String name;
 
-        @ApiModelProperty(value = "学员适用范围")
+        @ApiModelProperty(value = "学员适用范围ALL,RANGE,DISABLE")
         private String studentRangeType;
 
-        @ApiModelProperty(value = "老师适用范围")
+        @ApiModelProperty(value = "老师适用范围ALL,RANGE,DISABLE")
         private String teacherRangeType;
 
         @ApiModelProperty(value = "适用学员列表")

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/LessonCoursewareServiceImpl.java

@@ -94,7 +94,7 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
         this.updateById(lessonCourseware);
         lessonCoursewareUserMapperService.lambdaUpdate()
                 .eq(LessonCoursewareUserMapper::getLessonCoursewareId, updateRange.getLessonCoursewareId()).remove();
-        if(!StringUtils.equals(updateRange.getStudentRangeType(), "ALL") && CollectionUtils.isNotEmpty(updateRange.getStudentIds())){
+        if(StringUtils.equals(updateRange.getStudentRangeType(), "RANGE") && CollectionUtils.isNotEmpty(updateRange.getStudentIds())){
             List<LessonCoursewareUserMapper> list = updateRange.getStudentIds().stream().map(e -> {
                 LessonCoursewareUserMapper mapper = new LessonCoursewareUserMapper();
                 mapper.setLessonCoursewareId(updateRange.getLessonCoursewareId());
@@ -104,7 +104,7 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
             }).collect(Collectors.toList());
             lessonCoursewareUserMapperService.saveBatch(list);
         }
-        if(!StringUtils.equals(updateRange.getTeacherRangeType(), "ALL") && CollectionUtils.isNotEmpty(updateRange.getTeacherIds())){
+        if(StringUtils.equals(updateRange.getTeacherRangeType(), "RANGE") && CollectionUtils.isNotEmpty(updateRange.getTeacherIds())){
             List<LessonCoursewareUserMapper> list = updateRange.getTeacherIds().stream().map(e -> {
                 LessonCoursewareUserMapper mapper = new LessonCoursewareUserMapper();
                 mapper.setLessonCoursewareId(updateRange.getLessonCoursewareId());
@@ -129,7 +129,7 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
         LessonCoursewareWrapper.UpdateRangeDetail detail = new LessonCoursewareWrapper.UpdateRangeDetail();
         detail.setName(lessonCoursewareR.getData().getName());
         detail.setLessonCoursewareId(lessonCoursewareId);
-        if(!lessonCourseware.getStudentRangeType().equals("ALL")){
+        if(lessonCourseware.getStudentRangeType().equals("RANGE")){
             List<LessonCoursewareUserMapper> studentList = lessonCoursewareUserMapperService.lambdaQuery()
                     .eq(LessonCoursewareUserMapper::getLessonCoursewareId, lessonCoursewareId)
                     .eq(LessonCoursewareUserMapper::getUserType, "STUDENT").list();
@@ -144,7 +144,7 @@ public class LessonCoursewareServiceImpl extends ServiceImpl<LessonCoursewareMap
                 detail.setStudentList(userDtoList);
             }
         }
-        if(!lessonCourseware.getTeacherRangeType().equals("ALL")){
+        if(lessonCourseware.getTeacherRangeType().equals("RANGE")){
             List<LessonCoursewareUserMapper> teacherList = lessonCoursewareUserMapperService.lambdaQuery()
                     .eq(LessonCoursewareUserMapper::getLessonCoursewareId, lessonCoursewareId)
                     .eq(LessonCoursewareUserMapper::getUserType, "TEACHER").list();

+ 9 - 3
mec-biz/src/main/resources/config/mybatis/LessonCoursewareMapper.xml

@@ -13,14 +13,20 @@
                 AND (lc.teacher_range_type_ == 'ALL' OR (lcum.user_id_ = #{param.teacherId} AND lcum.user_type_ = 'TEACHER'))
             </if>
             <if test="param.subjectId != null">
-                and .id_subject_id_ = #{param.subjectId}
+                and lc.id_subject_id_ = #{param.subjectId}
+            </if>
+            <if test="param.studentRangeType != null and param.studentRangeType != ''">
+                and lc.student_range_type_ = #{param.studentRangeType}
+            </if>
+            <if test="param.teacherRangeType != null and param.teacherRangeType != ''">
+                and lc.teacher_range_type_ = #{param.teacherRangeType}
             </if>
             <if test="param.enable != null">
-                and .id_enable_ = #{param.enable}
+                and lc.id_enable_ = #{param.enable}
             </if>
         </where>
         GROUP BY lc.id_
-        order by create_time_ desc
+        order by lc.create_time_ desc
 	</select>
     <select id="getLessonCoursewareSubjectList" resultMap="com.ym.mec.biz.dal.dao.SubjectDao.Subject">
         select s.* from lesson_courseware lc