Spring boot 如何从POJO自定义和覆盖参数值?

Spring boot 如何从POJO自定义和覆盖参数值?,spring-boot,springdoc,springdoc-openui,Spring Boot,Springdoc,Springdoc Openui,我正在研究SpringBootV2.2.6.RELEASE和OpenAPI集成示例。此示例能够使用20个不同的参数进行搜索。因此,这个POJO类保存了CustomSearchDto这20个不同的值 在POJO中,我使用了orgName,但是@parameter(In=ParameterIn.QUERY,name=“organizationname”,,不知何故,我想覆盖变量名。我必须这样做。有什么办法吗 @Parameter(in = ParameterIn.QUERY, name = "org

我正在研究SpringBootV2.2.6.RELEASE和OpenAPI集成示例。此示例能够使用20个不同的参数进行搜索。因此,这个POJO类保存了
CustomSearchDto
这20个不同的值

在POJO中,我使用了orgName,但是
@parameter(In=ParameterIn.QUERY,name=“organizationname”,
,不知何故,我想覆盖变量名。我必须这样做。有什么办法吗

@Parameter(in = ParameterIn.QUERY, name = "orgizationName", schema = @Schema(type = "string")) 
@Parameter(in = ParameterIn.QUERY, name = "employeeId", schema = @Schema(type = "string")) 
@Parameter(in = ParameterIn.QUERY, name = "emailId", schema = @Schema(type = "string")) 
@Parameter(in=ParameterIn.QUERY, name="page", description="Results page you want to retrieve (0..N)", schema=@Schema(defaultValue = "0"))
    @Parameter(in=ParameterIn.QUERY, name="size", description="Number of records per page.", schema=@Schema(defaultValue = "30"))
@GetMapping(value = "/employees/organizations")
public ResponseEntity<PagedModel<Employees>> search(CustomSearchDto requestparams,
        @Parameter(hidden=true) Pageable pageRequest) {

    ......
    ........

    return new ResponseEntity<>(model, HttpStatus.OK);
}

您可以使用注释
@ParameterObject
直接将对象CustomSearchDto传递给用户

以下是文档的链接:


您可以使用注释
@ParameterObject
直接将对象CustomSearchDto传递给用户

以下是文档的链接:

public class CustomSearchDto {
    @Schema(description = "", type = "string", example = " ")
    private String orgName;

    @Schema(description = "", type = "string", example = " ")
    private String empId;

    @Schema(description = "", type = "integer", example = "null")
    private Integer email;

    .........
    ..............
    .............
}