From fd58b17dfef6ec0f4a8c30841a63279555063dcf Mon Sep 17 00:00:00 2001 From: luogw <3132758203@qq.com> Date: Wed, 4 Mar 2026 17:50:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E8=AF=95=E5=90=8D=E7=A7=B0=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SaveOrUpdateTaskDomainServiceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/project/task/domain/service/impl/SaveOrUpdateTaskDomainServiceImpl.java b/src/main/java/com/project/task/domain/service/impl/SaveOrUpdateTaskDomainServiceImpl.java index 0eb8101..d51ef9d 100644 --- a/src/main/java/com/project/task/domain/service/impl/SaveOrUpdateTaskDomainServiceImpl.java +++ b/src/main/java/com/project/task/domain/service/impl/SaveOrUpdateTaskDomainServiceImpl.java @@ -126,6 +126,12 @@ public class SaveOrUpdateTaskDomainServiceImpl implements SaveOrUpdateTaskDomain if (StrUtil.isBlank(dto.getName())) { throw new BusinessErrorException("考试任务名称不能为空"); } + //校验考试名称是否存在 + long count = taskBaseService.count(new LambdaQueryWrapper().eq(TaskEntity::getName, dto.getName())); + if (count > 0){ + throw new BusinessErrorException("考试任务名称已存在"); + } + if (StrUtil.length(dto.getName()) > 10) { throw new BusinessErrorException("考试任务名称过长"); }