layui 框架table.render发送请求,后端统一数据返回格式工具类LayuiResponse

layui 框架table.render发送请求,后端统一数据返回格式工具类LayuiResponse_第1张图片
layui 框架table.render发送请求,后端统一数据返回格式工具类LayuiResponse_第2张图片

LayuiResponse

@Data
public class LayuiResponse<T> {
     
    private static final  Integer CODE = 0;
    private  static final  String MSG = "";
    
    private Integer code;

    private String msg;

    private Long count;

    private T data;

    public static  <T> LayuiResponse<T> ok(T data, Long count) {
     
        return result(data,count);
    }


    private static <T>  LayuiResponse<T> result(T data, Long count) {
     
        LayuiResponse<T> layuiResponse = new LayuiResponse<>();
        layuiResponse.setData(data);
        layuiResponse.setCode(CODE);
        layuiResponse.setMsg(MSG);
        layuiResponse.setCount(count);
        return layuiResponse;
    }
}

你可能感兴趣的:(#,常用工具类utils,开发工具类,layui)