wangliang преди 4 години
родител
ревизия
f9d0fa9625

+ 10 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/mapper/TBExamStudentMapper.java

@@ -41,6 +41,16 @@ public interface TBExamStudentMapper extends BaseMapper<TBExamStudent> {
      */
     List<TBExamStudentResult> selectInspectCollegeList(@Param("schoolId") Long schoolId, @Param("examId") Long examId, @Param("courseCode") String courseCode);
 
+    /**
+     * 查询考查学院列表(任课老师)
+     *
+     * @param schoolId
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    List<TBExamStudentResult> selectInspectCollegeListByTeacher(@Param("schoolId") Long schoolId, @Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("collegeIds") List<Long> collegeIds);
+
     /**
      * 开课课程考试分析-考查学院列表
      *

+ 21 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TBExamStudentServiceImpl.java

@@ -7,12 +7,17 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.Lists;
+import com.qmth.teachcloud.common.bean.auth.AuthBean;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicCourse;
+import com.qmth.teachcloud.common.entity.SysRole;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.common.enums.RoleTypeEnum;
 import com.qmth.teachcloud.common.service.BasicCourseService;
+import com.qmth.teachcloud.common.service.CacheService;
 import com.qmth.teachcloud.common.service.SysOrgService;
+import com.qmth.teachcloud.common.service.SysRoleService;
 import com.qmth.teachcloud.common.util.ExcelUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.common.util.excel.ExcelError;
@@ -32,7 +37,6 @@ import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.*;
@@ -83,6 +87,12 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
     @Resource
     SysOrgService sysOrgService;
 
+    @Resource
+    SysRoleService sysRoleService;
+
+    @Resource
+    CacheService cacheService;
+
     /**
      * 查询开课学院列表
      *
@@ -106,6 +116,16 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
      */
     @Override
     public List<TBExamStudentResult> selectInspectCollegeList(Long schoolId, Long examId, String courseCode) {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        AuthBean authBean = cacheService.userAuthCache(sysUser.getId());
+        if (Objects.nonNull(authBean) && Objects.nonNull(authBean.getRoleList()) && authBean.getRoleList().get(0).getType() == RoleTypeEnum.TEACHER) {
+            List<Long> collegeIds = sysOrgService.findCollegeIds(sysUser.getOrgId());
+            if (Objects.nonNull(collegeIds) && collegeIds.size() > 0) {
+                return tbExamStudentMapper.selectInspectCollegeListByTeacher(schoolId, examId, courseCode, collegeIds);
+            } else {
+                return tbExamStudentMapper.selectInspectCollegeListByTeacher(schoolId, examId, courseCode, Objects.nonNull(sysUser.getOrgId()) ? Arrays.asList(sysUser.getOrgId()) : null);
+            }
+        }
         return tbExamStudentMapper.selectInspectCollegeList(schoolId, examId, courseCode);
     }
 

+ 21 - 0
teachcloud-report-business/src/main/resources/mapper/TBExamStudentMapper.xml

@@ -44,6 +44,27 @@
         </where>
     </select>
 
+    <select id="selectInspectCollegeListByTeacher"
+            resultType="com.qmth.teachcloud.report.business.bean.result.TBExamStudentResult">
+        select
+        DISTINCT tbes.inspect_college_id as inspectCollegeId,
+        so.name as inspectCollegeName,
+        so.code as inspectCollegeCode
+        from
+        t_b_exam_student tbes
+        join sys_org so on
+        so.id = tbes.inspect_college_id
+        <where>
+            <include refid="conditionSql"/>
+            <if test="collegeIds != null and collegeIds != ''">
+                and tbes.inspect_college_id in
+                <foreach collection="collegeIds" item="collegeId" index="index" open="(" separator="," close=")">
+                    #{collegeId}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
     <select id="selectInspectCollegeListNotAbsent"
             resultType="com.qmth.teachcloud.report.business.bean.result.TBExamStudentResult">
         select