Skip to content

Commit debe4fb

Browse files
committed
feat: update code
1 parent cab7b53 commit debe4fb

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

base/src/main/java/com/tinyengine/it/mcp/tools/GitFileReaderService.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -384,16 +384,17 @@ public FileResult bulkCreate(List<Component> componentList) {
384384
if (queryComponent.isEmpty()) {
385385
// 插入新记录
386386
Integer result = baseMapper.createComponent(component);
387-
if (result == 1) {
388-
MaterialComponent materialComponent = new MaterialComponent();
389-
materialComponent.setMaterialId(1);
390-
materialComponent.setComponentId(component.getId());
391-
baseMapper.createMaterialComponent(materialComponent);
392-
MaterialHistoryComponent materialHistoryComponent = new MaterialHistoryComponent();
393-
materialHistoryComponent.setComponentId(component.getId());
394-
materialHistoryComponent.setMaterialHistoryId(1);
395-
baseMapper.createMaterialHistoryComponent(materialHistoryComponent);
387+
if (result != 1) {
388+
throw new IllegalStateException("createComponent failed: " + result);
396389
}
390+
MaterialComponent materialComponent = new MaterialComponent();
391+
materialComponent.setMaterialId(1);
392+
materialComponent.setComponentId(component.getId());
393+
baseMapper.createMaterialComponent(materialComponent);
394+
MaterialHistoryComponent materialHistoryComponent = new MaterialHistoryComponent();
395+
materialHistoryComponent.setComponentId(component.getId());
396+
materialHistoryComponent.setMaterialHistoryId(1);
397+
baseMapper.createMaterialHistoryComponent(materialHistoryComponent);
397398
addNum = addNum + 1;
398399
} else {
399400
// 更新记录

0 commit comments

Comments
 (0)