1、防护对象新增批量查询
This commit is contained in:
@@ -118,6 +118,17 @@ public class ProtectObjectController implements ProtectObjectControllerApi {
|
|||||||
return ResponseResult.ok().setData("protect_object", protectObject);
|
return ResponseResult.ok().setData("protect_object", protectObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GetMapping("/{protectObjectIds}/querybatch")
|
||||||
|
public ResponseResult queryProtectObject(@PathVariable List<Integer> protectObjectIds) {
|
||||||
|
List<ProtectObject> protectObjects = protectObjectService.queryProtectObjectByIds(protectObjectIds);
|
||||||
|
if (protectObjects == null) {
|
||||||
|
return ResponseResult.invalid()
|
||||||
|
.setMessage("无效的防护对象ID,也许该ID指定的防护对象不存在?");
|
||||||
|
}
|
||||||
|
return ResponseResult.ok().setData("protect_object", protectObjects);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@PostMapping("/{protectObjectId}/update")
|
@PostMapping("/{protectObjectId}/update")
|
||||||
public ResponseResult updateProtectObject(@PathVariable Integer protectObjectId,
|
public ResponseResult updateProtectObject(@PathVariable Integer protectObjectId,
|
||||||
|
|||||||
@@ -251,6 +251,25 @@ public interface ProtectObjectControllerApi {
|
|||||||
)
|
)
|
||||||
ResponseResult queryProtectObject(@PathVariable Integer protectObjectId) throws IllegalAccessException;
|
ResponseResult queryProtectObject(@PathVariable Integer protectObjectId) throws IllegalAccessException;
|
||||||
|
|
||||||
|
@Operation(
|
||||||
|
summary = "批量查询多个防护对象",
|
||||||
|
description = "查询多个防护对象,接收多个id",
|
||||||
|
responses = {
|
||||||
|
@io.swagger.v3.oas.annotations.responses.ApiResponse(
|
||||||
|
description = "返回是否成功",
|
||||||
|
content = @Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = ResponseResult.class)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
parameters = {
|
||||||
|
@Parameter(name = "ids", description = "查询的多个ID", example = "2, 3"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@GetMapping("/{protectObjectIds}/query")
|
||||||
|
ResponseResult queryProtectObject(@PathVariable List<Integer> protectObjectIds);
|
||||||
|
|
||||||
@PostMapping("/{protectObjectId}/update")
|
@PostMapping("/{protectObjectId}/update")
|
||||||
@Operation(
|
@Operation(
|
||||||
summary = "更新防护对象",
|
summary = "更新防护对象",
|
||||||
@@ -526,7 +545,23 @@ public interface ProtectObjectControllerApi {
|
|||||||
)
|
)
|
||||||
@GetMapping("/auditInfo/{id}")
|
@GetMapping("/auditInfo/{id}")
|
||||||
ResponseResult queryAuditInfo(@PathVariable Integer id);
|
ResponseResult queryAuditInfo(@PathVariable Integer id);
|
||||||
|
@Operation(
|
||||||
|
summary = "查询历史变化",
|
||||||
|
description = "查询历史变化,只接收一个id",
|
||||||
|
responses = {
|
||||||
|
@io.swagger.v3.oas.annotations.responses.ApiResponse(
|
||||||
|
description = "返回是否成功",
|
||||||
|
content = @Content(
|
||||||
|
mediaType = "application/json",
|
||||||
|
schema = @Schema(implementation = ResponseResult.class)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
parameters = {
|
||||||
|
@Parameter(name = "page", description = "页数", example = "2"),
|
||||||
|
@Parameter(name = "page_size", description = "每页个数", example = "10"),
|
||||||
|
}
|
||||||
|
)
|
||||||
@GetMapping("/{id}/history")
|
@GetMapping("/{id}/history")
|
||||||
ResponseResult queryHistory(@PathVariable Integer id,
|
ResponseResult queryHistory(@PathVariable Integer id,
|
||||||
@RequestParam(value = "page", required = true) Integer page,
|
@RequestParam(value = "page", required = true) Integer page,
|
||||||
|
|||||||
@@ -71,4 +71,6 @@ public interface ProtectObjectMapper {
|
|||||||
void updateStaticRuleStatusLogExpireTimeBatch(List<Integer> ids);
|
void updateStaticRuleStatusLogExpireTimeBatch(List<Integer> ids);
|
||||||
|
|
||||||
List<ProtectObject> queryHistory(Integer id, Integer page, Integer pageSize);
|
List<ProtectObject> queryHistory(Integer id, Integer page, Integer pageSize);
|
||||||
|
|
||||||
|
List<ProtectObject> queryProtectObjectByIds(List<Integer> protectObjectIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,4 +250,8 @@ public class ProtectObjectService {
|
|||||||
public List<ProtectObject> queryHistory(Integer id, Integer page, Integer pageSize) {
|
public List<ProtectObject> queryHistory(Integer id, Integer page, Integer pageSize) {
|
||||||
return protectObjectMapper.queryHistory(id, page, pageSize);
|
return protectObjectMapper.queryHistory(id, page, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ProtectObject> queryProtectObjectByIds(List<Integer> protectObjectIds) {
|
||||||
|
return protectObjectMapper.queryProtectObjectByIds(protectObjectIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,6 +280,15 @@
|
|||||||
ORDER BY effective_time DESC
|
ORDER BY effective_time DESC
|
||||||
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
LIMIT ${(page - 1) * pageSize}, #{pageSize}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="queryProtectObjectByIds"
|
||||||
|
resultMap="protectObjectMap">
|
||||||
|
SELECT *
|
||||||
|
FROM t_protect_object
|
||||||
|
WHERE protect_object_id IN
|
||||||
|
<foreach collection="protectObjectIds" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="updateProtectObject">
|
<update id="updateProtectObject">
|
||||||
UPDATE t_protect_object
|
UPDATE t_protect_object
|
||||||
|
|||||||
Reference in New Issue
Block a user