he2802 3 лет назад
Родитель
Сommit
bf44b85c76

+ 12 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/exam/ExamApplyController.java

@@ -142,6 +142,18 @@ public class ExamApplyController extends BaseController {
         return  AjaxResult.success(examApplyVos);
     }
 
+
+    /**
+     * 查看考试安排被预约数量
+     */
+    @ApiOperation("查看考试安排被预约数量")
+    @PreAuthorize("@ss.hasPermi('system:apply:query')")
+    @GetMapping("/countApplySubscribe")
+    public AjaxResult<Integer> countApplySubscribe(ExamApplyQueryBo bo) {
+        Integer subNum = iExamApplyService.countApplySubscribe(bo);
+        return  AjaxResult.success(subNum);
+    }
+
     /**
      * 查询考试配置绑定商品列表
      */

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseChapterSectionVo.java

@@ -81,4 +81,5 @@ public class CourseChapterSectionVo {
 	/** 直播结束时间 */
 	@ApiModelProperty("直播结束时间")
 	private Long liveEndTime;
+
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/mapper/ExamApplyMapper.java

@@ -37,6 +37,8 @@ public interface ExamApplyMapper extends BaseMapper<ExamApply> {
 
     Integer countSubscribe(ExamApplyQueryBo bo);
 
+    Integer countApplySubscribe(ExamApplyQueryBo bo);
+
     Integer countHaveSubscribe(ExamApplyQueryBo bo);
 
     ExamUserApplyVo selectExamUserApplyVo(ExamApplyQueryBo bo);

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/mapper/ExamBeforeMapper.java

@@ -34,4 +34,6 @@ public interface ExamBeforeMapper extends BaseMapper<ExamBefore> {
     ExamBeforeVo verifyExamBeforeVo(ExamBeforeQueryBo examBeforeQueryBo);
 
     List<ExamBeforeVo> queryBindBefore(ExamBeforeQueryBo examBeforeQueryBo);
+
+    Integer countBeforeSubscribe(ExamBeforeQueryBo bo);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/IExamApplyService.java

@@ -64,4 +64,6 @@ public interface IExamApplyService extends IService<ExamApply> {
     List<ExamUserApplySiteVo> subscribeApplySite(ExamApplyQueryBo bo);
 
 	List<ExamUserApplySiteVo> subscribeApplySiteTrain(ExamApplyQueryBo bo);
+
+	Integer countApplySubscribe(ExamApplyQueryBo bo);
 }

+ 12 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java

@@ -135,6 +135,13 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
                 throw new RuntimeException(goodsName+"已被其他进行中的考试计划使用,请修改,再启用");
             }
         }
+        if(bo.getStatus()==-1){
+            ExamApplyQueryBo queryBo = new ExamApplyQueryBo();
+            queryBo.setApplyId(bo.getApplyId());
+            if(countApplySubscribe(queryBo)>0){
+                throw new RuntimeException("该考试计划存在预约数据,无法删除");
+            }
+        }
         validEntityBeforeSave(update);
         update.setUpdateTime(DateUtils.getNowTime());
         return this.updateById(update);
@@ -283,6 +290,11 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         return examUserApplySiteVos;
     }
 
+    @Override
+    public Integer countApplySubscribe(ExamApplyQueryBo bo) {
+        return baseMapper.countApplySubscribe(bo);
+    }
+
     private boolean checkNameUnique(ExamApply entity) {
         ExamApply info = getOne(new LambdaQueryWrapper<ExamApply>()
                 .eq(ExamApply::getApplyName,entity.getApplyName()).ne(ExamApply::getStatus,-1).last("limit 1"));

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamBeforeServiceImpl.java

@@ -130,6 +130,13 @@ public class ExamBeforeServiceImpl extends ServiceImpl<ExamBeforeMapper, ExamBef
                 }
             }
         }
+        if (bo.getStatus() == -1){
+            ExamBeforeQueryBo queryBo = new ExamBeforeQueryBo();
+            queryBo.setBeforeId(bo.getBeforeId());
+            if(baseMapper.countBeforeSubscribe(queryBo)>0){
+                throw new RuntimeException("该前培计划存在预约数据,无法删除");
+            }
+        }
         validEntityBeforeSave(update);
         update.setUpdateTime(DateUtils.getNowTime());
         return this.updateById(update);

+ 12 - 1
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamApplyMapper.xml

@@ -236,7 +236,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           and cg.`status` =1
           and cgu.`status` =1
     </select>
-    <select id="countSubscribe" parameterType="long" resultType="integer">
+    <select id="countSubscribe" parameterType="com.zhongzheng.modules.exam.bo.ExamApplyQueryBo" resultType="integer">
         SELECT
             COUNT(1)
         FROM
@@ -248,6 +248,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           and us.goods_id = #{goodsId}
     </select>
 
+    <select id="countApplySubscribe" parameterType="com.zhongzheng.modules.exam.bo.ExamApplyQueryBo" resultType="integer">
+        SELECT
+            COUNT(1)
+        FROM
+            user_subscribe us
+        WHERE
+            1 =1
+          and us.subscribe_status = 1
+          and us.apply_id = #{applyId}
+    </select>
+
     <select id="countHaveSubscribe" parameterType="com.zhongzheng.modules.exam.bo.ExamApplyQueryBo" resultType="integer">
         SELECT
             COUNT(1)

+ 11 - 0
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamBeforeMapper.xml

@@ -175,6 +175,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by eb.create_time desc
     </select>
 
+    <select id="countBeforeSubscribe" parameterType="com.zhongzheng.modules.exam.bo.ExamBeforeQueryBo" resultType="integer">
+        SELECT
+            COUNT(1)
+        FROM
+            user_subscribe us
+        WHERE
+            1 =1
+          and us.subscribe_status = 1
+          and us.before_id = #{beforeId}
+    </select>
+
     <select id="queryBindBefore" parameterType="com.zhongzheng.modules.exam.bo.ExamBeforeQueryBo" resultMap="ExamBeforeVo">
         SELECT
             us.subscribe_id,