1、解决指令按条件查询总数bug

2、动态、静态规则新增批量查询功能
This commit is contained in:
Hao Miao
2024-01-23 23:26:15 +08:00
parent 389483989c
commit 31277b7246
11 changed files with 104 additions and 36 deletions

View File

@@ -81,7 +81,6 @@ public class DynamicRuleController implements DynamicRuleControllerApi {
@Override
@GetMapping("/{id}/query")
public ResponseResult queryDynamicRuleObjectById(@PathVariable Integer id) {
log.info("查询动态规则: {}", id);
DynamicRuleObject dynamicRuleObject = dynamicRuleService.queryDynamicRuleById(id);
//调用service查询
return ResponseResult.ok()
@@ -89,6 +88,16 @@ public class DynamicRuleController implements DynamicRuleControllerApi {
.setData("dynamic_rule", dynamicRuleObject);
}
@Override
@GetMapping("/query/{ids}")
public ResponseResult queryDynamicRuleObjectByIds(@PathVariable List<Integer> ids) {
List<DynamicRuleObject> dynamicRuleObjects = dynamicRuleService.queryDynamicRuleByIds(ids);
//调用service查询
return ResponseResult.ok()
.setData("success", true)
.setData("dynamic_rule", dynamicRuleObjects);
}
//分页查询
@Override
@GetMapping("/query")

View File

@@ -10,6 +10,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
@@ -186,6 +187,24 @@ public interface DynamicRuleControllerApi {
)
public ResponseResult queryDynamicRuleObjectById(@PathVariable Integer id) ;
@Operation(
summary = "查询多个动态规则",
description = "根据条件查询多个动态规则",
responses = {
@ApiResponse(
description = "返回查询到的多个动态规则",
content = @Content(
mediaType = "application/json",
schema = @Schema(
title = "ResponseResult和DynamicRule的组合模型",
description = "ResponseResult的data内DynamicRule",
anyOf = {ResponseResult.class, DynamicRuleObject.class})
))},
parameters = {@Parameter(name = "ids", description = "动态规则ID列表", example = "dynamicrule/query/5,11")}
)
@GetMapping("/query/{ids}")
ResponseResult queryDynamicRuleObjectByIds(@PathVariable List<Integer> ids);
@Operation(
summary = "根据条件查询多个动态规则",
description = "根据查询条件和页码等,查询多个对象并以列表返回",

View File

@@ -43,4 +43,6 @@ public interface DynamicRuleMapper {
Integer queryDynamicRuleTotalNum(String dynamicRuleName, Integer dynamicRuleId,
String sourceSystem, String creator);
List<DynamicRuleObject> queryDynamicRuleByIds(List<Integer> ids);
}

View File

@@ -166,4 +166,8 @@ public class DynamicRuleService {
return dynamicRuleMapper.queryDynamicRuleTotalNum(dynamicRuleName, dynamicRuleId,
protectObjectSourceSystem, creator);
}
public List<DynamicRuleObject> queryDynamicRuleByIds(List<Integer> ids) {
return dynamicRuleMapper.queryDynamicRuleByIds(ids);
}
}