package com.gyee.wisdom.alarm.sharding.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gyee.wisdom.alarm.sharding.cache.StationCache;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

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

/**
 * @description: 数据修改事件记录
 * @auther: Wanghs
 * @date: 2022-04-01
 */
@Data
@TableName(value = "RULEUPDATEEVENT",resultMap = "ruleUpdateEventResult")
//@TableName(value = "RULEUPDATEEVENT")
public class RuleUpdateEvent implements Serializable {
    private static final long serialVersionUID = -7009408032434108640L;
    @TableId("ID")
    private Long id;

    @TableField("RULETYPE")
    private String ruleType;

    @TableField("RULENAME")
    private String ruleName;

    @TableField("RULEID")
    private String ruleId;

    @TableField("STATION")
    private String station;

    @TableField("MODEL")
    private String model;

    @TableField("UPDATETIME")
    private Date updateTime;

    @TableField("UPDATETYPE")
    private String updateType;

    @TableField("UPDATEUSER")
    private String updateUser;

    @TableField(exist = false)
    @Getter(AccessLevel.NONE)
    @Setter(AccessLevel.NONE)
    private String stationName;

    @TableField(exist = false)
    private List<RuleUpdateEventInfo> infoList;




    public String getStationName() {
        String name = StationCache.getStationName(this.station);
        return name;
    }
}
