package com.liquidnet.service.kylin.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.liquidnet.commons.lang.util.IDGenerator;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * <p>
 * 轮播图关联表 模型
 * </p>
 *
 * @author jiangxiulong
 * @since 2021-05-08
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class KylinBannersRelations implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "mid", type = IdType.AUTO)
    private Integer mid;

    /**
     * banners_relations_id
     */
    private String bannersRelationsId;

    /**
     * banners_id
     */
    private String bannersId;

    /**
     * 展示位置id/推广省份code
     */
    private String fieldId;

    /**
     * 关联字段类型 1展示位置(由接口提供) 2推广省份(由接口提供)
     */
    private int fieldIdType;

    /**
     * 创建时间
     */
    private String createdAt;

    /**
     * 修改时间
     */
    private String updatedAt;

    // 整合入库数据
    @JsonIgnore
    public KylinBannersRelations newData(String bannersId, String fieldId, int fieldIdType, String createdAtString) {
        String bannersRelationsId = IDGenerator.nextSnowId().toString();
        this.setBannersRelationsId(bannersRelationsId);
        this.setBannersId(bannersId);
        this.setFieldId(fieldId);
        this.setFieldIdType(fieldIdType);
        this.setCreatedAt(createdAtString);
        return this;
    }

}
