Procházet zdrojové kódy

通知代码提交

pans před 6 měsíci
rodič
revize
abf70175a4

+ 1 - 1
snowy-plugin/snowy-plugin-disk/snowy-plugin-disk-func/src/main/java/vip/xiaonuo/disk/mapper/mapping/CourseOpenMapper.xml

@@ -95,7 +95,7 @@
     </select>
   <select id="selectAccount" resultType="string">
       SELECT
-         distinct b.ACCOUNT
+          b.ACCOUNT
       FROM
           COURSE_OPEN a
       LEFT JOIN SYS_USER b ON  a.GRADES_ID = b.GRADES_ID

+ 5 - 2
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/controller/student/ExamPaperAnswerController.java

@@ -31,6 +31,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 @RestController("StudentExamPaperAnswerController")
@@ -53,8 +54,10 @@ public class ExamPaperAnswerController extends BaseApiController {
 
     @RequestMapping(value = "/pageList", method = RequestMethod.POST)
     public CommonResult<Page<ExamPaperAnswer>> pageList(@RequestBody @Valid ExamPaperAnswerPageVM model) {
-        model.setCreateUser(getCurrentUser().getId());
-        Page<ExamPaperAnswer> pageInfo = examPaperAnswerService.studentPage(model);
+        //根据老师id查询对应的学生
+        List<String> studentIds=examPaperAnswerService.studentIds(StpLoginUserUtil.getLoginUser().getId());
+        //查出对应学生的试卷
+        Page<ExamPaperAnswer> pageInfo = examPaperAnswerService.studentPage(model,studentIds);
         pageInfo.getRecords().forEach(vm -> {
             if(ObjectUtil.isNotEmpty(vm.getSubjectId()))
             {

+ 5 - 4
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/ExamPaperAnswerMapper.java

@@ -1,12 +1,11 @@
 package vip.xiaonuo.exam.mapper;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import vip.xiaonuo.exam.domain.ExamPaperAnswer;
 import vip.xiaonuo.exam.domain.other.KeyValue;
 import vip.xiaonuo.exam.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM;
-import vip.xiaonuo.exam.viewmodel.student.exampaper.ExamPaperAnswerPageVM;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
 import java.util.List;
@@ -15,7 +14,7 @@ import java.util.Map;
 @Mapper
 public interface ExamPaperAnswerMapper extends BaseMapper<ExamPaperAnswer> {
 
-    Page<ExamPaperAnswer> studentPage(@Param("bo") ExamPaperAnswerPageVM requestVM , @Param("page") Page<ExamPaperAnswer> page);
+    Page<ExamPaperAnswer> studentPage(@Param("studentIds") List<String> studentIds , @Param("page") Page<ExamPaperAnswer> page);
 
     Integer selectAllCount();
 
@@ -29,4 +28,6 @@ public interface ExamPaperAnswerMapper extends BaseMapper<ExamPaperAnswer> {
      * 获取该试卷的完成状态
      * */
     Map<String,Object> getStatus(Map param);
+
+    List<String> studentIds(String id);
 }

+ 10 - 4
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/ExamPaperAnswerMapper.xml

@@ -220,10 +220,10 @@
     <include refid="Base_Column_List"/>
     FROM t_exam_paper_answer
     <where>
-        and create_user = #{bo.createUser}
-     <if test="bo.subjectId != null">
-         and subject_id = #{bo.subjectId}
-     </if>
+        and create_user in
+        <foreach item="item" collection="studentIds" open="(" separator="," close=")">
+            #{item}
+        </foreach>
     </where>
     ORDER BY create_time DESC
   </select>
@@ -279,4 +279,10 @@
     LIMIT 1
   </select>
 
+  <select id="studentIds" resultType="string">
+    SELECT DISTINCT id FROM SYS_USER su WHERE GRADES_ID in(
+      SELECT  GRADES_ID  FROM course_open WHERE teacher_id=#{id}
+    ) AND EDU_IDENTITY=2
+  </select>
+
 </mapper>

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/mapper/mapping/TExamMapper.xml

@@ -28,7 +28,7 @@
        <if test="tExamPageParam.examName != null and tExamPageParam.examName != ''">
            a.EXAM_NAME like '%'||#{tExamPageParam.examName}||'%'
        </if>
-        <if test="tExamPageParam.examStatus != null and tExamPageParam.examStatus != ''">
+        <if test="tExamPageParam.examStatus != null">
             and a.EXAM_STATUS = #{tExamPageParam.examStatus}
         </if>
         <if test="tExamPageParam.semesterId != null and tExamPageParam.semesterId != ''">

+ 3 - 2
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/ExamPaperAnswerService.java

@@ -1,7 +1,6 @@
 package vip.xiaonuo.exam.service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.github.pagehelper.PageInfo;
 import vip.xiaonuo.auth.core.pojo.SaBaseLoginUser;
 import vip.xiaonuo.exam.domain.ExamPaperAnswer;
 import vip.xiaonuo.exam.domain.ExamPaperAnswerInfo;
@@ -20,7 +19,7 @@ public interface ExamPaperAnswerService extends BaseService<ExamPaperAnswer> {
      * @param requestVM 过滤条件
      * @return PageInfo<ExamPaperAnswer>
      */
-    Page<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVM requestVM);
+    Page<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVM model,List<String> studentIds);
 
     /**
      * 计算试卷提交结果
@@ -58,4 +57,6 @@ public interface ExamPaperAnswerService extends BaseService<ExamPaperAnswer> {
      * 获取该试卷的完成状态
      * */
     Map<String,Object> getStatus(Map param);
+
+    List<String> studentIds(String id);
 }

+ 27 - 23
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/ExamPaperAnswerServiceImpl.java

@@ -15,7 +15,6 @@ import vip.xiaonuo.exam.domain.enums.QuestionTypeEnum;
 import vip.xiaonuo.exam.domain.exam.ExamPaperTitleItemObject;
 import vip.xiaonuo.exam.domain.other.ExamPaperAnswerUpdate;
 import vip.xiaonuo.exam.domain.other.KeyValue;
-import vip.xiaonuo.exam.domain.task.TaskItemAnswerObject;
 import vip.xiaonuo.exam.mapper.ExamPaperAnswerMapper;
 import vip.xiaonuo.exam.mapper.ExamPaperMapper;
 import vip.xiaonuo.exam.mapper.QuestionMapper;
@@ -61,10 +60,10 @@ public class ExamPaperAnswerServiceImpl extends BaseServiceImpl<ExamPaperAnswer>
     }
 
     @Override
-    public Page<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVM requestVM) {
+    public Page<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVM requestVM,List<String> studentIds) {
         Page<ExamPaperAnswer> page = new Page<ExamPaperAnswer>(requestVM.getCurrent(), requestVM.getSize());
         page.setSearchCount(true); // 设置计算总记录数
-        return examPaperAnswerMapper.studentPage(requestVM,page);
+        return examPaperAnswerMapper.studentPage(studentIds,page);
     }
 
 
@@ -161,26 +160,26 @@ public class ExamPaperAnswerServiceImpl extends BaseServiceImpl<ExamPaperAnswer>
         examPaperAnswerMapper.updateByPrimaryKeySelective(examPaperAnswer);
         examPaperQuestionCustomerAnswerService.updateScore(examPaperAnswerUpdates);
 
-        ExamPaperTypeEnum examPaperTypeEnum = ExamPaperTypeEnum.fromCode(examPaperAnswer.getPaperType());
-        switch (examPaperTypeEnum) {
-            case Task:
-                //任务试卷批改完成后,需要更新任务的状态
-                ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(examPaperAnswer.getExamPaperId());
-                Integer taskId = examPaper.getTaskExamId();
-                String userId = examPaperAnswer.getCreateUser();
-                TaskExamCustomerAnswer taskExamCustomerAnswer = taskExamCustomerAnswerMapper.getByTUid(taskId, userId);
-                TextContent textContent = textContentService.selectById(taskExamCustomerAnswer.getTextContentId());
-                List<TaskItemAnswerObject> taskItemAnswerObjects = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemAnswerObject.class);
-
-                taskItemAnswerObjects.stream()
-                        .filter(d -> d.getExamPaperAnswerId().equals(examPaperAnswer.getId()))
-                        .findFirst().ifPresent(taskItemAnswerObject -> taskItemAnswerObject.setStatus(examPaperAnswer.getStatus()));
-                textContentService.jsonConvertUpdate(textContent, taskItemAnswerObjects, null);
-                textContentService.updateByIdFilter(textContent);
-                break;
-            default:
-                break;
-        }
+//        ExamPaperTypeEnum examPaperTypeEnum = ExamPaperTypeEnum.fromCode(examPaperAnswer.getPaperType());
+//        switch (examPaperTypeEnum) {
+//            case Task:
+//                //任务试卷批改完成后,需要更新任务的状态
+//                ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(examPaperAnswer.getExamPaperId());
+//                Integer taskId = examPaper.getTaskExamId();
+//                String userId = examPaperAnswer.getCreateUser();
+//                TaskExamCustomerAnswer taskExamCustomerAnswer = taskExamCustomerAnswerMapper.getByTUid(taskId, userId);
+//                TextContent textContent = textContentService.selectById(taskExamCustomerAnswer.getTextContentId());
+//                List<TaskItemAnswerObject> taskItemAnswerObjects = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemAnswerObject.class);
+//
+//                taskItemAnswerObjects.stream()
+//                        .filter(d -> d.getExamPaperAnswerId().equals(examPaperAnswer.getId()))
+//                        .findFirst().ifPresent(taskItemAnswerObject -> taskItemAnswerObject.setStatus(examPaperAnswer.getStatus()));
+//                textContentService.jsonConvertUpdate(textContent, taskItemAnswerObjects, null);
+//                textContentService.updateByIdFilter(textContent);
+//                break;
+//            default:
+//                break;
+//        }
         return ExamUtil.scoreToVM(customerScore);
     }
 
@@ -324,4 +323,9 @@ public class ExamPaperAnswerServiceImpl extends BaseServiceImpl<ExamPaperAnswer>
     {
         return examPaperAnswerMapper.getStatus(param);
     }
+
+    @Override
+    public List<String> studentIds(String id) {
+        return examPaperAnswerMapper.studentIds(id);
+    }
 }

+ 1 - 1
snowy-plugin/snowy-plugin-exam/snowy-plugin-exam-func/src/main/java/vip/xiaonuo/exam/service/impl/TExamServiceImpl.java

@@ -133,7 +133,7 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
                 String studentIdsStr = String.join(",", studentAccounts);
                 tExam.setStudentIds(studentIdsStr);
             }else{
-               return CommonResult.error("没有查询到学生信息!!!");
+               return CommonResult.error("根据学期和课程没有查询到学生信息!!!");
             }
         }