From 5726a63ec792ae738f2bd44b7577edeacfac1b48 Mon Sep 17 00:00:00 2001 From: Diyu0904 <1819728964@qq.com> Date: Tue, 18 Mar 2025 14:28:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BF=AE=E6=94=B9=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81/=E6=A8=A1=E5=9E=8B=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resource/MallProductController.java | 24 ++++++++++++++++--- .../resource/WorkFlowController.java | 23 ++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java index 96b55ac..4d2bdfc 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java @@ -2,20 +2,20 @@ package com.mcwl.web.controller.resource; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.github.pagehelper.PageInfo; +import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.domain.R; -import com.mcwl.common.core.page.PageDomain; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.utils.SecurityUtils; import com.mcwl.resource.domain.ModelProduct; import com.mcwl.resource.domain.ModelVersion; import com.mcwl.resource.domain.dto.ModelImagePageRes; -import com.mcwl.resource.domain.response.ResponseModelProduct; import com.mcwl.resource.domain.request.RequestModel; +import com.mcwl.resource.domain.response.ResponseModelProduct; import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.mapper.ModelVersionMapper; -import com.mcwl.resource.service.*; +import com.mcwl.resource.service.ModelService; import com.mcwl.system.service.impl.SysUserServiceImpl; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -95,6 +95,24 @@ public class MallProductController extends BaseController { @ApiOperation(value = "修改模型") @PostMapping("/update") public AjaxResult updateModel(@RequestBody RequestModel requestModel) { + + + for (ModelVersion modelVersion : requestModel.getModelVersionList()) { + + //校验名字 + ModelVersion modelVersion1 = modelVersionMapper.selectByFileName(modelVersion.getFileName()); + if (modelVersion1 != null) { + + return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"文件名字重复"); + } + //校验hash + ModelVersion modelVersion2 = modelVersionMapper.selectByHash(modelVersion.getFileHash()); + if (modelVersion2 != null){ + + return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"文件内容重复"); + } + } + ModelProduct modelProduct = requestModel.getModelProduct(); Long userId = SecurityUtils.getUserId(); diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java index 6e14f24..6af5e3b 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java @@ -2,13 +2,16 @@ package com.mcwl.web.controller.resource; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.pagehelper.PageInfo; +import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.domain.R; import com.mcwl.resource.domain.WorkFlow; +import com.mcwl.resource.domain.WorkFlowVersion; import com.mcwl.resource.domain.dto.AddRequestWorkFlow; import com.mcwl.resource.domain.request.RequestWorkFlow; import com.mcwl.resource.domain.response.ResponseWorkFlow; import com.mcwl.resource.domain.vo.PageVo; +import com.mcwl.resource.mapper.WorkFlowVersionMapper; import com.mcwl.resource.service.WorkFlowService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -40,6 +43,9 @@ public class WorkFlowController extends BaseController { @Autowired private WorkFlowService workFlowService; + @Autowired + private WorkFlowVersionMapper workFlowVersionMapper; + /** * 设置工作流的置顶状态 @@ -94,6 +100,23 @@ public class WorkFlowController extends BaseController { @PostMapping("/updateWorkFlow") public R updateWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow) { + + for (WorkFlowVersion workFlowVersion : requestWorkFlow.getWorkFlowVersionList()) { + + //校验名字 + WorkFlowVersion workFlowVersion1 = workFlowVersionMapper.selectByFileName(workFlowVersion.getFileName()); + if (workFlowVersion1 != null) { + + return R.fail(HttpStatus.SHOW_ERROR_MSG,"文件名字重复"); + } + //校验hash + WorkFlowVersion workFlowVersion2 = workFlowVersionMapper.selectByHash(workFlowVersion.getFileHash()); + if (workFlowVersion2 != null){ + + return R.fail(HttpStatus.SHOW_ERROR_MSG,"文件内容重复"); + } + } + workFlowService.updateWorkFlow(requestWorkFlow); return R.ok();