feat: ASW-175 package修改接口开发
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user