feat: ASW-175 package修改接口开发

This commit is contained in:
zhangshuai
2024-11-15 16:31:59 +08:00
parent d8aed83e7b
commit 19369da30b
3 changed files with 26 additions and 0 deletions

View File

@@ -50,6 +50,16 @@ public class PackageController {
return R.ok().putData("record", entity);
}
@PutMapping("/{workspaceId}/package")
public R update(@PathVariable(value = "workspaceId", required = true) String workspaceId,
@RequestParam(value = "packageId", required = true) String packageId,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "name", required = false) String name) {
PackageEntity entity = packageService.updatePackage(workspaceId, packageId, name, description);
return R.ok().putData("record", entity);
}
@DeleteMapping("/{workspaceId}/package")
public R delete(String[] ids) {
T.VerifyUtil.is(ids).notEmpty();

View File

@@ -17,4 +17,6 @@ public interface IPackageService extends IService<PackageEntity>{
PackageEntity savePackage(String workspaceId, String description, Resource fileResource);
void removePackage(List<String> ids);
PackageEntity updatePackage(String workspaceId, String packageId, String name, String description);
}

View File

@@ -151,4 +151,18 @@ public class PackageServiceImpl extends ServiceImpl<PackageDao, PackageEntity> i
workbookResourceService.removeResource(ids, WorkbookConstant.ResourceType.PACKAGE.getValue());
}
@Override
public PackageEntity updatePackage(String workspaceId, String packageId, String name, String description) {
PackageEntity entity = this.getById(packageId);
if (T.StrUtil.isNotEmpty(name)){
entity.setName(name);
}
if (T.StrUtil.isNotEmpty(description)){
entity.setDescription(description);
}
entity.setUpdateTimestamp(System.currentTimeMillis());
entity.setUpdateUserId(StpUtil.getLoginIdAsString());
this.updateById(entity);
return entity;
}
}