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

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.gyee.wisdom.alarm.sharding.entity.AlarmHistory;
import com.gyee.wisdom.alarm.sharding.service.TableNameService;
import lombok.Data;

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


public class AlarmHistoryTable {

    private String stationId;

    private Date dtStart;

    private Date dtEnd;

    public AlarmHistoryTable(String stId, Date startDate, Date endDate) {
        stationId = stId;
        dtStart = startDate;
        dtEnd = endDate;
    }

    @Override
    public String toString() {
        try {
            String[] arr = stationId.split("_");
            return String.format(TableNameService.FORMAT_ALARMHISTORY,
                    arr[0].toLowerCase(),
                    TableNameService.FORMAT_DATE.format(dtStart));
        }catch (Exception ex) {
            System.out.println(ex.getMessage());
        }

        return "";
    }

}
