From cf5213140c5ef298729a6141ef967fb5519b2dfe Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 21 Jun 2024 11:57:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E6=9C=AA=E4=BC=A0blob=E5=AD=97=E6=AE=B5=E4=BC=9A?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/FunctionalCaseService.java | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java index 7dda7fe630..7c5890ad3f 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java @@ -608,13 +608,30 @@ public class FunctionalCaseService { //更新附属表信息 FunctionalCaseBlob functionalCaseBlob = new FunctionalCaseBlob(); functionalCaseBlob.setId(request.getId()); - functionalCaseBlob.setSteps(StringUtils.defaultIfBlank(request.getSteps(), StringUtils.EMPTY).getBytes(StandardCharsets.UTF_8)); - functionalCaseBlob.setTextDescription(StringUtils.defaultIfBlank(request.getTextDescription(), StringUtils.EMPTY).getBytes(StandardCharsets.UTF_8)); - functionalCaseBlob.setExpectedResult(StringUtils.defaultIfBlank(request.getExpectedResult(), StringUtils.EMPTY).getBytes(StandardCharsets.UTF_8)); - functionalCaseBlob.setPrerequisite(StringUtils.defaultIfBlank(request.getPrerequisite(), StringUtils.EMPTY).getBytes(StandardCharsets.UTF_8)); - functionalCaseBlob.setDescription(StringUtils.defaultIfBlank(request.getDescription(), StringUtils.EMPTY).getBytes(StandardCharsets.UTF_8)); - functionalCaseBlobMapper.updateByPrimaryKeyWithBLOBs(functionalCaseBlob); - + boolean hasUpdate = false; + if (request.getSteps() != null) { + hasUpdate=true; + functionalCaseBlob.setSteps(StringUtils.defaultIfEmpty(request.getSteps(), StringUtils.EMPTY).getBytes(StandardCharsets.UTF_8)); + } + if (request.getTextDescription()!=null) { + hasUpdate=true; + functionalCaseBlob.setTextDescription(StringUtils.defaultIfEmpty(request.getTextDescription(), StringUtils.EMPTY).getBytes(StandardCharsets.UTF_8)); + } + if (request.getExpectedResult()!=null) { + hasUpdate=true; + functionalCaseBlob.setTextDescription(StringUtils.defaultIfEmpty(request.getExpectedResult(), StringUtils.EMPTY).getBytes(StandardCharsets.UTF_8)); + } + if (request.getPrerequisite()!=null) { + hasUpdate=true; + functionalCaseBlob.setTextDescription(StringUtils.defaultIfEmpty(request.getPrerequisite(), StringUtils.EMPTY).getBytes(StandardCharsets.UTF_8)); + } + if (request.getDescription()!=null) { + hasUpdate=true; + functionalCaseBlob.setTextDescription(StringUtils.defaultIfEmpty(request.getDescription(), StringUtils.EMPTY).getBytes(StandardCharsets.UTF_8)); + } + if (hasUpdate) { + functionalCaseBlobMapper.updateByPrimaryKeySelective(functionalCaseBlob); + } //更新自定义字段 List customFields = request.getCustomFields(); if (CollectionUtils.isNotEmpty(customFields)) {