|
|
@@ -2,8 +2,10 @@ package com.zhongzheng.modules.exam.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
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.collect.domain.CollectBank;
|
|
|
import com.zhongzheng.modules.exam.bo.*;
|
|
|
import com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -66,6 +68,12 @@ public class ExamBeforeServiceImpl extends ServiceImpl<ExamBeforeMapper, ExamBef
|
|
|
@Override
|
|
|
public Boolean insertByAddBo(ExamBeforeAddBo bo) {
|
|
|
ExamBefore add = BeanUtil.toBean(bo, ExamBefore.class);
|
|
|
+ List<ExamBefore> list = this.list(new LambdaQueryWrapper<ExamBefore>()
|
|
|
+ .eq(ExamBefore::getBeforeName, add.getBeforeName())
|
|
|
+ .eq(ExamBefore::getStatus, 1));
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ throw new IllegalArgumentException("前培标题不可重复");
|
|
|
+ }
|
|
|
validEntityBeforeSave(add);
|
|
|
add.setCode(ServletUtils.getEncoded("QP"));
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
|
@@ -84,6 +92,19 @@ public class ExamBeforeServiceImpl extends ServiceImpl<ExamBeforeMapper, ExamBef
|
|
|
throw new IllegalArgumentException("该商品已启用考培,请重新创建");
|
|
|
}
|
|
|
}
|
|
|
+ if (bo.getStatus() != -1){
|
|
|
+ List<ExamBefore> list = this.list(new LambdaQueryWrapper<ExamBefore>()
|
|
|
+ .eq(ExamBefore::getBeforeName, bo.getBeforeName())
|
|
|
+ .eq(ExamBefore::getBeforeId, update.getBeforeId()));
|
|
|
+ if (CollectionUtils.isEmpty(list)){
|
|
|
+ List<ExamBefore> examBefore = this.list(new LambdaQueryWrapper<ExamBefore>()
|
|
|
+ .eq(ExamBefore::getBeforeName, update.getBeforeName())
|
|
|
+ .eq(ExamBefore::getStatus, 1));
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ throw new IllegalArgumentException("前培标题不可重复");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
validEntityBeforeSave(update);
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
|
return this.updateById(update);
|