1. 修改setDataMap函数为addDataMap以防止swagger将DataMap视为一种属性

2. 当任务未通过审核时,现在会立刻报错而不是返回false
This commit is contained in:
EnderByEndera
2024-01-19 15:09:23 +08:00
parent 1d317eb10f
commit 449c320261
22 changed files with 176 additions and 75 deletions

View File

@@ -83,14 +83,13 @@ public class ProtectObjectController implements ProtectObjectControllerApi {
@Override
@GetMapping("/{protectObjectId}/query")
public ResponseResult queryProtectObject(@PathVariable Integer protectObjectId) throws IllegalAccessException {
public ResponseResult queryProtectObject(@PathVariable Integer protectObjectId) {
ProtectObject protectObject = protectObjectService.queryProtectObject(protectObjectId);
if (protectObject == null) {
return ResponseResult.invalid()
.setMessage("无效的防护对象ID也许该ID指定的防护对象不存在");
}
return ResponseResult.ok()
.setDataMap(EntityUtils.entityToMap(protectObject));
return ResponseResult.ok().setData("protect_object", protectObject);
}
@Override
@@ -124,7 +123,7 @@ public class ProtectObjectController implements ProtectObjectControllerApi {
public ResponseResult changeProtectObjectAuditStatus(@PathVariable Integer protectObjectId,
@PathVariable Integer auditStatus) {
return ResponseResult.ok()
.setDataMap(protectObjectService.changeProtectObjectAuditStatus(protectObjectId, auditStatus))
.addDataMap(protectObjectService.changeProtectObjectAuditStatus(protectObjectId, auditStatus))
.setData("proobj_id", protectObjectId);
}
}

View File

@@ -55,8 +55,7 @@ public class TemplateController implements TemplateControllerApi {
return ResponseResult.invalid()
.setMessage("无效的策略模板ID也许该模板不存在");
}
return ResponseResult.ok()
.setDataMap(EntityUtils.entityToMap(template));
return ResponseResult.ok().setData("template", template);
}
@Override