All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.hugh.model.dto.ResultDTO Maven / Gradle / Ivy

The newest version!
package com.github.hugh.model.dto;

import lombok.Builder;
import lombok.Data;

/**
 * 统一返回信息实体类
 *
 * @author hugh
 * @since 1.5.0
 */
@Data
@Builder
public class ResultDTO {

    /**
     * code、提示信息
     *
     * @param code    code
     * @param message 提示信息
     */
    public ResultDTO(String code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * @param code    code
     * @param message 提示信息
     * @param data    数据
     */
    public ResultDTO(String code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    private String code; // code
    private String message; // 提示信息
    private T data; // 数据

    /**
     * 判断code码是否一样
     * 

当前实体类中的对应与传入的code一致

* * @param code code * @return boolean * @since 1.7.0 */ public boolean equalCode(String code) { return this.code.equals(code); } /** * 判断code码不一样 * * @param code code * @return boolean * @since 1.7.0 */ public boolean notEqualCode(String code) { return !equalCode(code); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy