package com.malk.server.aliwork;

import com.malk.utils.UtilMap;
import lombok.Data;
import org.springframework.data.domain.Page;

import java.util.Map;

/**
 * * 返回数据_宜搭
 **/
@Data
public class YDR {

    private boolean success;

    private String errorCode;

    private String errorMsg;

    // 查询为data之集合, 新增为实例Id, 删除/更新为空, ....
    private Object result;

    /**
     * 宜搭表格分页管理
     */
    public static final Map formatPage(Page<Map> page) {
        Map data = UtilMap.map("currentPage, pageSize, totalCount", page.getNumber() + 1, page.getNumberOfElements(), page.getTotalElements());
        data.put("data", page.getContent());
        return data;
    }
}