|
@@ -143,7 +143,7 @@ public class ExamNumberServiceImpl extends ServiceImpl<ExamNumberMapper, ExamNum
|
|
|
if (bo.getStatus() == 1 && integer > 0) {
|
|
|
throw new IllegalArgumentException("当前商品已启用考次配置,不可开启,请重新创建新的配置考试次数和前培次数商品");
|
|
|
}
|
|
|
- if (bo.getStatus() == -1 || bo.getStatus()==0){
|
|
|
+ if (bo.getStatus()==0){
|
|
|
Integer apply = baseMapper.selectApply(goodsId);
|
|
|
if (apply > 0) {
|
|
|
throw new IllegalArgumentException("当前商品已启用考试安排,不可关闭");
|
|
@@ -151,6 +151,15 @@ public class ExamNumberServiceImpl extends ServiceImpl<ExamNumberMapper, ExamNum
|
|
|
}
|
|
|
LambdaQueryWrapper<ExamNumberGoods> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.eq(ExamNumberGoods::getExamNumberId, bo.getExamNumberId());
|
|
|
+ List<ExamNumberGoods> list = examNumberGoodsService.list(lqw);
|
|
|
+ if (bo.getStatus() == -1) {
|
|
|
+ for (ExamNumberGoods examNumberGoods : list) {
|
|
|
+ Integer apply = baseMapper.selectApply(goodsId);
|
|
|
+ if (apply > 0) {
|
|
|
+ throw new IllegalArgumentException("当前商品已启用考试安排,不可删除");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
examNumberGoodsService.remove(lqw);
|
|
|
ExamNumberGoodsAddBo examNumberGoodsAddBo = new ExamNumberGoodsAddBo();
|
|
|
examNumberGoodsAddBo.setGoodsId(goodsId);
|
|
@@ -160,6 +169,17 @@ public class ExamNumberServiceImpl extends ServiceImpl<ExamNumberMapper, ExamNum
|
|
|
examNumberGoodsService.insertByAddBo(examNumberGoodsAddBo);
|
|
|
}
|
|
|
}
|
|
|
+ LambdaQueryWrapper<ExamNumberGoods> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(ExamNumberGoods::getExamNumberId, bo.getExamNumberId());
|
|
|
+ List<ExamNumberGoods> list = examNumberGoodsService.list(lqw);
|
|
|
+ if (bo.getStatus() == -1) {
|
|
|
+ for (ExamNumberGoods examNumberGoods : list) {
|
|
|
+ Integer apply = baseMapper.selectApply(examNumberGoods.getGoodsId());
|
|
|
+ if (apply > 0) {
|
|
|
+ throw new IllegalArgumentException("当前商品已启用考试安排,不可删除");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return this.updateById(update);
|
|
|
}
|
|
|
|