From c42f094aca942f8aa4d796062e15f5db36c4f9f4 Mon Sep 17 00:00:00 2001 From: wangqing Date: Thu, 25 Mar 2021 10:39:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=20=20=20=E8=A1=A8=E5=8D=95=E6=97=A0?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=97=B6=E4=B8=8D=E5=85=81=E8=AE=B8=E5=8F=91?= =?UTF-8?q?=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cloud/api/web/controller/UserProjectController.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tduck-api/src/main/java/com/tduck/cloud/api/web/controller/UserProjectController.java b/tduck-api/src/main/java/com/tduck/cloud/api/web/controller/UserProjectController.java index f2fe34d..204acd2 100644 --- a/tduck-api/src/main/java/com/tduck/cloud/api/web/controller/UserProjectController.java +++ b/tduck-api/src/main/java/com/tduck/cloud/api/web/controller/UserProjectController.java @@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Sets; import com.tduck.cloud.api.annotation.Login; import com.tduck.cloud.api.util.HttpUtils; +import com.tduck.cloud.common.constant.CommonConstants; import com.tduck.cloud.common.entity.BaseEntity; import com.tduck.cloud.common.util.JsonUtils; import com.tduck.cloud.common.util.RedisUtils; @@ -172,6 +173,11 @@ public class UserProjectController { @Login @PostMapping("/user/project/publish") public Result publishProject(@RequestBody UserProjectEntity request) { + int count = projectItemService + .count(Wrappers.lambdaQuery().eq(UserProjectItemEntity::getProjectKey, request.getKey())); + if (count == CommonConstants.ConstantNumber.ZERO) { + return Result.failed("无有效表单项,无法发布"); + } UserProjectEntity entity = projectService.getByKey(request.getKey()); entity.setStatus(ProjectStatusEnum.RELEASE); return Result.success(projectService.updateById(entity)); @@ -536,7 +542,7 @@ public class UserProjectController { */ @Login @PostMapping("/user/project/recycle/delete") - public Result deleteRecycleProject(@RequestAttribute Long userId,@RequestBody UserProjectEntity projectEntity) { + public Result deleteRecycleProject(@RequestAttribute Long userId, @RequestBody UserProjectEntity projectEntity) { boolean remove = projectService.remove(Wrappers.lambdaQuery().eq(UserProjectEntity::getUserId, userId) .eq(UserProjectEntity::getKey, projectEntity.getKey())); if (remove) {