|
|
@ -48,15 +48,10 @@ public class CraftsController { |
|
|
|
@Operation(summary = "更新工艺") |
|
|
|
@PutMapping("/{id}") |
|
|
|
public Result<String> updateCrafts(@PathVariable Long id, @RequestBody Crafts crafts) { |
|
|
|
Crafts existingCrafts = craftsService.findByName(crafts.getName()); |
|
|
|
if (existingCrafts == null) { |
|
|
|
crafts.setId(id); |
|
|
|
boolean isSuccess = craftsService.updateCrafts(crafts); |
|
|
|
if (isSuccess) { |
|
|
|
return Result.success(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
return Result.failed(ResultCode.DATA_ALREADY_EXISTS); |
|
|
|
crafts.setId(id); |
|
|
|
boolean isSuccess = craftsService.updateCrafts(crafts); |
|
|
|
if (isSuccess) { |
|
|
|
return Result.success(); |
|
|
|
} |
|
|
|
return Result.failed(); |
|
|
|
} |
|
|
|