瀏覽代碼

代码更新

wangliang 3 月之前
父節點
當前提交
7d13dc654c

+ 8 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamCardModelFourMapper.java

@@ -33,4 +33,12 @@ public interface ExamCardModelFourMapper extends BaseMapper<ExamCardModelFour> {
      * @return
      * @return
      */
      */
     IPage<ExamCardModelFour> listPage(IPage<Map> iPage, @Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("courseId") Long courseId, @Param("collegeId") Long collegeId, @Param("title") String title, @Param("paperNumber") String paperNumber, @Param("dpr") DataPermissionRule dpr);
     IPage<ExamCardModelFour> listPage(IPage<Map> iPage, @Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("courseId") Long courseId, @Param("collegeId") Long collegeId, @Param("title") String title, @Param("paperNumber") String paperNumber, @Param("dpr") DataPermissionRule dpr);
+
+    /**
+     * 根据id countCardNumber
+     *
+     * @param id
+     * @return
+     */
+    int countByCardNumber(@Param("id") Long id);
 }
 }

+ 4 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamCardModelFourServiceImpl.java

@@ -308,6 +308,10 @@ public class ExamCardModelFourServiceImpl extends ServiceImpl<ExamCardModelFourM
     @Override
     @Override
     @Transactional
     @Transactional
     public Boolean deleteGeneric(Long id) {
     public Boolean deleteGeneric(Long id) {
+        int count = this.baseMapper.countByCardNumber(id);
+        if (count > 0) {
+            throw ExceptionResultEnum.ERROR.exception("已扫描的题卡不允许删除");
+        }
         return this.removeById(id);
         return this.removeById(id);
     }
     }
 
 

+ 7 - 0
distributed-print-business/src/main/resources/mapper/ExamCardModelFourMapper.xml

@@ -42,4 +42,11 @@
         </where>
         </where>
         order by create_time desc
         order by create_time desc
     </select>
     </select>
+
+    <select id="countByCardNumber" resultType="java.lang.Integer">
+        select count(1) from mark_student ms
+         left join scan_answer_card sac on sac.exam_id = ms.exam_id and sac.`number` = ms.card_number
+         left join exam_card_model_four ecmf on ecmf.id = sac.card_id and ecmf.course_id  = ms.course_id
+        where ecmf.id = #{id} and ms.card_number is not null
+    </select>
 </mapper>
 </mapper>