Java 多输入框查询需求实现-LMLPHP


多输入框查询

需求分析

Java 多输入框查询需求实现-LMLPHP

代码实现

    List<DisputeMerchantManageResponse> merchantDisputeManage(DisputeMerchantManageBO disputeMerchantManageBO);
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class PageResult<T> implements Serializable {

    @ApiModelProperty("总记录数")
    private Integer total;
    private Integer pageNo;
    private Integer pageSize;
    private Integer totalPage;

    @ApiModelProperty("列表数据")
    @Builder.Default
    private List<T> items = Collections.emptyList();


    public static <T> PageResult<T> toPage(IPage<T> page) {
        PageResult<T> result = new PageResult<>();
        result.setItems(page.getRecords());
        result.setTotal((int) page.getTotal());
        result.setPageNo((int) page.getCurrent());
        result.setPageSize((int) page.getSize());
        result.setTotalPage(page.getTotal() % page.getSize() == 0 ?
                (int) (page.getTotal() / page.getSize()) : (int) (page.getTotal() / page.getSize() + 1));
        return result;
    }

    public static <T> PageResult<T> toPage(IPage<?> page, List<T> list) {
        PageResult<T> result = new PageResult<>();
        result.setItems(list);
        result.setTotal((int) page.getTotal());
        result.setPageNo((int) page.getCurrent());
        result.setPageSize((int) page.getSize());
        result.setTotalPage(page.getTotal() % page.getSize() == 0 ?
                (int) (page.getTotal() / page.getSize()) : (int) (page.getTotal() / page.getSize() + 1));
        return result;
    }

    public static <T> PageResult<T> toPage(PageResult<?> res, List<T> list) {
        PageResult<T> result = new PageResult<>();
        BeanUtils.copyProperties(res, result);
        result.setItems(list);
        return result;
    }
}

postman测试



Java 多输入框查询需求实现-LMLPHP

10-04 10:50