package com.ytpm.general;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BaseParam extends PageMeta {
    /** 创建时间 */
    private Date createTime;
    /** 创建人 */
    private String createUserId;
    /** 修改时间 */
    private Date updateTime;
    /** 修改人 */
    private String updateUserId;
    /** 逻辑删除 1-是 0-否 */
    private Integer available;
    /** 机构ID */
    private String channelId;
    /** 是否超级管理员 */
    private int superAdmin;

    public BaseParam(Long total, Integer perPage, Integer currentPage, Integer lastPage) {
        super(total, perPage, currentPage, lastPage);
    }

    /**
     * 设置默认参数 创建
     * @param userId
     */
    public void setDefaultParam(String userId){
        this.createTime = new Date();
        this.available = 1;
        this.createUserId = userId;
    }

    /**
     * 设置修改参数
     * @param userId
     */
    public void setUpdateParam(String userId){
        this.updateTime = new Date();
        this.updateUserId = userId;
    }

    /**
     * 设置删除参数
     * @param userId
     * @param available
     */
    public void setDeleteParam(String userId, Integer available){
        this.updateTime = new Date();
        this.updateUserId = userId;
        this.available = available;
    }
}
