Quellcode durchsuchen

调课顶课课程查询,不包含已完整或者正在进行中的调课和顶课

dzx vor 4 Monaten
Ursprung
Commit
bcfbe966b3

+ 4 - 0
src/main/java/com/xjrsoft/module/courseTable/mapper/CourseTableMapper.java

@@ -3,6 +3,7 @@ package com.xjrsoft.module.courseTable.mapper;
 import com.github.yulichang.base.MPJBaseMapper;
 import com.xjrsoft.module.schedule.dto.ClassOptionDto;
 import com.xjrsoft.module.courseTable.entity.CourseTable;
+import com.xjrsoft.module.schedule.entity.WfCourseAdjust;
 import com.xjrsoft.module.schedule.vo.ClassOptionVo;
 import com.xjrsoft.module.schedule.dto.CourseTableAdjustDto;
 import com.xjrsoft.module.schedule.dto.CourseTableDto;
@@ -28,4 +29,7 @@ public interface CourseTableMapper extends MPJBaseMapper<CourseTable> {
     List<CourseListVo> getAdjustList(@Param("dto") CourseTableAdjustDto dto);
 
     List<ClassOptionVo> getClassListByTeacherId(@Param("dto") ClassOptionDto dto);
+
+    //查询流程正在进行中或者已经完成的调课或者顶课申请
+    List<WfCourseAdjust> getExceptCourseList(@Param("userId") Long userId);
 }

+ 11 - 2
src/main/java/com/xjrsoft/module/courseTable/service/impl/CourseTableServiceImpl.java

@@ -70,6 +70,7 @@ import org.apache.poi.xwpf.usermodel.XWPFParagraph;
 import org.apache.poi.xwpf.usermodel.XWPFTable;
 import org.apache.poi.xwpf.usermodel.XWPFTableCell;
 import org.apache.poi.xwpf.usermodel.XWPFTableRow;
+import org.camunda.bpm.engine.history.HistoricProcessInstance;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -299,7 +300,16 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
             dto.setTeacherId(Long.parseLong(teacherId));
         }
         dto.setAdjustType(adjustType);
-
+        //查询正在进行中或者已经完成
+        List<WfCourseAdjust> exceptCourseList = courseTableMapper.getExceptCourseList(dto.getTeacherId());
+        List<Long> courseIds = new ArrayList<>();
+        for (WfCourseAdjust courseAdjust : exceptCourseList) {
+            String[] split = courseAdjust.getCourseId().split(",");
+            for (String s : split) {
+                courseIds.add(Long.parseLong(s));
+            }
+        }
+        dto.setExceptCourseList(courseIds);
         List<CourseListVo> list = courseTableMapper.getAdjustList(dto);
         for (CourseListVo courseListVo : list) {
             if (courseListVo.getTimePeriod() == 1) {
@@ -310,7 +320,6 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
                 courseListVo.setTimePeriodCn("晚上");
             }
         }
-
         return list;
     }
 

+ 4 - 0
src/main/java/com/xjrsoft/module/schedule/dto/CourseTableAdjustDto.java

@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.List;
 
 
 /**
@@ -30,4 +31,7 @@ public class CourseTableAdjustDto implements Serializable {
     @ApiModelProperty("调课类型")
     private String adjustType;
 
+    @ApiModelProperty("除外的id")
+    private List<Long> exceptCourseList;
+
 }

+ 13 - 0
src/main/resources/mapper/courseTable/CourseTable.xml

@@ -44,6 +44,12 @@
         <if test="dto.classId != null">
             and t5.id = #{dto.classId}
         </if>
+        <if test="exceptCourseList != null">
+            AND t1.id in
+            <foreach item="courseId" collection="exceptCourseList" open="(" separator="," close=")">
+                #{courseId}
+            </foreach>
+        </if>
     </select>
     <select id="getAdjustList" parameterType="com.xjrsoft.module.schedule.dto.CourseTableAdjustDto" resultType="com.xjrsoft.module.schedule.vo.CourseListVo">
         SELECT t1.time_period,t4.short_name as time_number,t1.course_name,t2.name AS class_name,t3.name AS classroom_name,t1.id,t2.id as class_id FROM course_table t1
@@ -62,6 +68,13 @@
             and t1.class_id = #{dto.classId}
         </if>
     </select>
+    <select id="getExceptCourseList" parameterType="java.lang.Long" resultType="com.xjrsoft.module.schedule.entity.WfCourseAdjust">
+        SELECT a1.* FROM wf_course_adjust a1
+        INNER JOIN xjr_workflow_form_relation a2 ON a1.id = a2.form_key_value
+        WHERE a1.delete_mark = 0 AND a2.current_state IN ('COMPLETED','ACTIVE')
+        and a1.user_id = #{userId}
+    </select>
+
     <select id="getClassListByTeacherId" parameterType="com.xjrsoft.module.schedule.dto.ClassOptionDto" resultType="com.xjrsoft.module.schedule.vo.ClassOptionVo">
         SELECT id,name FROM base_class WHERE delete_mark = 0 AND id IN (
             SELECT DISTINCT class_id FROM course_table WHERE teacher_id like concat('%', #{dto.userId},'%')