update - 调整模型创建和更新逻辑中验重的逻辑

This commit is contained in:
wangli 2023-11-29 21:59:59 +08:00
parent f714b4b0f8
commit 9efc5aa5a2

View File

@ -189,10 +189,9 @@ public class BpmnProcessModelServiceImpl implements BpmnProcessModelService {
@Transactional(rollbackFor = Exception.class)
public String createBpmModel(@Valid BpmnModelCreateDTO dto) {
ModelQuery modelQuery = repositoryService.createModelQuery()
.modelTenantId(dto.getTenantId())
.modelKey(dto.getCategory());
if (StringUtils.hasLength(dto.getTenantId())) {
modelQuery.modelTenantId(dto.getTenantId());
}
Model existModel = modelQuery.singleResult();
if (!ObjectUtils.isEmpty(existModel)) {
throw new WorkflowEngineException(MODEL_KEY_EXISTS, dto.getCategory());
@ -281,10 +280,9 @@ public class BpmnProcessModelServiceImpl implements BpmnProcessModelService {
public void updateBpmModel(BpmnModelUpdateDTO dto) {
ModelQuery query = repositoryService.createModelQuery()
.modelId(dto.getProcessModelId())
.modelTenantId(dto.getTenantId())
.modelKey(dto.getCategory());
if (StringUtils.hasLength(dto.getTenantId())) {
query.modelTenantId(dto.getTenantId());
}
Model originModel = query.singleResult();
if (ObjectUtils.isEmpty(originModel)) {
throw new WorkflowEngineException(MODEL_ID_NOT_EXISTS, dto.getProcessModelId());