fix(功能用例): 修复功能用例保存未传blob字段会报错问题

This commit is contained in:
guoyuqi 2024-06-21 11:57:01 +08:00 committed by Craftsman
parent 83125c5722
commit cf5213140c
1 changed files with 24 additions and 7 deletions

View File

@ -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<CaseCustomFieldDTO> customFields = request.getCustomFields();
if (CollectionUtils.isNotEmpty(customFields)) {