| | |
| | | return insertId > 0 ? file.getId() : insertId; |
| | | } |
| | | |
| | | public Integer updateWaylineFile(String workspaceId, String newName, String id) { |
| | | String objectKey = "/" + newName; |
| | | LambdaUpdateWrapper<WaylineFileEntity> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(WaylineFileEntity::getWaylineId, id) |
| | | .eq(WaylineFileEntity::getWorkspaceId, workspaceId) |
| | | .set(WaylineFileEntity::getObjectKey, objectKey); |
| | | |
| | | // 使用 mapper 执行更新操作 |
| | | boolean updated = mapper.update(null, updateWrapper) > 0; |
| | | if (!updated) { |
| | | throw new RuntimeException("更新 objectKey 失败"); |
| | | } |
| | | |
| | | return updated ? 1 : 0; // 返回更新结果 |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Integer saveWaylineFiles(String workspaceId, WaylineFileDTO metadata, String patchesId,String isTemp) { |
| | | metadata.setPatchesId(patchesId); |
| | |
| | | waylineFile.setWaylineId(workspaceId); |
| | | waylineFile.setUsername(creator); |
| | | ossService.putObject(OssConfiguration.bucket, waylineFile.getObjectKey(), file.getInputStream()); |
| | | this.updateWaylineFile(workspaceId,newName,id); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |