package cn.pluss.platform.entity;

import cn.pluss.platform.config.mybatis.SqlConditionExtra;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 商户插件表
 * CREATE TABLE `tb_pluss_merchant_plugin` (
 *   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
 *   `channel` int(11) DEFAULT NULL COMMENT '通道id',
 *   `userId` int(11) DEFAULT NULL COMMENT '用户id',
 *   `pluginId` int(11) DEFAULT NULL COMMENT '插件id',
 *   `status` varchar(4) DEFAULT NULL COMMENT '插件进件状态，参考merchant_channel_status表',
 *   `thirdStatus` varchar(4) DEFAULT NULL COMMENT '通道返回状态',
 *   `applicationId` varchar(50) DEFAULT NULL COMMENT '业务id',
 *   `remark` varchar(255) DEFAULT NULL COMMENT '驳回原因',
 *   `createTime` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
 *   `updateTime` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
 *   `extra` json DEFAULT NULL COMMENT '附加信息',
 *   PRIMARY KEY (`id`),
 *   UNIQUE KEY `idx1` (`channel`,`userId`) USING BTREE
 * ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商户插件表';
 * </p>
 *
 * @author Djh
 * @since 2021-01-29
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_pluss_merchant_plugin")
public class MerchantPlugin implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;


    /**
     * 通道id
     */
    @TableField("channel")
    private Integer channel;


    /**
     * 用户id
     */
    @TableField("userId")
    private Integer userId;


    /**
     * 插件id
     */
    @TableField("pluginId")
    private String pluginId;


    /**
     * 插件进件状态，参考merchant_channel_status表
     */
    @TableField("status")
    private String status;


    /**
     * 通道返回状态
     */
    @TableField("thirdStatus")
    private String thirdStatus;

    /**
     * 业务id
     */
    @TableField("applicationId")
    private String applicationId;

    /**
     * 驳回原因
     */
    @TableField("remark")
    private String remark;


    /**
     * 创建时间
     */
    @TableField(value = "createTime", fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 创建时间 开始时间
     */
    @TableField(select = false, value = "createTime", condition = SqlConditionExtra.GT)
    private Date createTimeStart;

    /**
     * 创建时间 截止时间
     */
    @TableField(select = false, value = "createTime", condition = SqlConditionExtra.LT)
    private Date createTimeEnd;

    /**
     * 更新时间
     */
    @TableField(value = "updateTime", fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    /**
     * 更新时间 开始时间
     */
    @TableField(select = false, value = "updateTime", condition = SqlConditionExtra.GT)
    private Date updateTimeStart;

    /**
     * 更新时间 截止时间
     */
    @TableField(select = false, value = "updateTime", condition = SqlConditionExtra.LT)
    private Date updateTimeEnd;

    /**
     * 附加信息
     */
    @TableField("extra")
    private JSONObject extra;

    /**
     * pos商编
     */
    private String posMerId;

    /**
     * 终端编号
     */
    @TableField(exist = false)
    private String termList;
}