package com.ag.log.pojo;

import cn.hutool.core.date.DateUtil;
import com.ag.util.StrUtil;
import com.alibaba.fastjson.JSONObject;

/**
 * Created by yangxh on 2022/5/26.
 */
public class LogForCdc {

    private String tablekey;
    private String database;
    private String table;
    private String type;
    private JSONObject data;
    private JSONObject beforedata;

    public void putData() {
        String now = StrUtil.join("to_date('", DateUtil.now(), "','yyyy-MM-dd HH24:mi:ss')");
        if (data != null) {
            data.put("tablekey", tablekey);
            data.put("type", type);
            data.put("created_on", now);
        }
        if (beforedata != null) {
            beforedata.put("tablekey", tablekey);
            beforedata.put("type", type);
            beforedata.put("created_on", now);
        }
    }

    public String getTablekey() {
        return tablekey;
    }

    public void setTablekey(String tablekey) {
        this.tablekey = tablekey;
    }

    public String getDatabase() {
        return database;
    }

    public void setDatabase(String database) {
        this.database = database;
    }

    public String getTable() {
        return table;
    }

    public void setTable(String table) {
        this.table = table;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public JSONObject getData() {
        return data;
    }

    public void setData(JSONObject data) {
        this.data = data;
    }

    public JSONObject getBeforedata() {
        return beforedata;
    }

    public void setBeforedata(JSONObject beforedata) {
        this.beforedata = beforedata;
    }
}
