Browse Source

学习计划

change 3 years ago
parent
commit
dfd13a1eb6

+ 11 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamNumberServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.modules.course.domain.MajorCategory;
 import com.zhongzheng.modules.exam.bo.*;
 import com.zhongzheng.modules.exam.domain.ExamNumberGoods;
 import com.zhongzheng.modules.exam.mapper.ExamApplyMapper;
@@ -126,6 +127,16 @@ public class ExamNumberServiceImpl extends ServiceImpl<ExamNumberMapper, ExamNum
         ExamNumber update = BeanUtil.toBean(bo, ExamNumber.class);
         validEntityBeforeSave(update);
         update.setUpdateTime(DateUtils.getNowTime());
+        ExamNumber info = getOne(new LambdaQueryWrapper<ExamNumber>()
+                .eq(ExamNumber::getExamNumberId,bo.getExamNumberId())
+                .last("limit 1"));
+        if (info.getExamNumber() > bo.getExamNumber()){
+            throw new IllegalArgumentException("考试次数不能小于更改前");
+        }
+
+        if (info.getDoNumber() > bo.getDoNumber()){
+            throw new IllegalArgumentException("前培次数不能小于更改前");
+        }
         if (bo.getGoodsId() != null){
             LambdaQueryWrapper<ExamNumberGoods> lqw = Wrappers.lambdaQuery();
             lqw.eq(ExamNumberGoods::getExamNumberId, bo.getExamNumberId());