创建检查套餐时验证套餐ID

This commit is contained in:
lxd 2025-02-17 10:44:36 +08:00
parent 0c2c8e84a8
commit 12025f2d4e

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.inspect.service.exammodule;
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectitems.InspectitemsDO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@ -31,6 +32,15 @@ public class ExammoduleServiceImpl implements ExammoduleService {
@Override
public Integer createExammodule(ExammoduleSaveReqVO createReqVO) {
//验证itemCode是否存在
QueryWrapper<ExammoduleDO> wrapper = new QueryWrapper<>();
wrapper.eq("examModuleID", createReqVO.getExamModuleID());
boolean exists = exammoduleMapper.selectCount(wrapper) > 0;
if(exists)
{
return 999;
}
// 插入
ExammoduleDO exammodule = BeanUtils.toBean(createReqVO, ExammoduleDO.class);
exammoduleMapper.insert(exammodule);