package cn.ibizlab.core.rule.domain;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.annotation.DEField;
import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.enums.DEFieldDefaultValueType;
import cn.ibizlab.util.helper.DataObject;
import cn.ibizlab.util.enums.DupCheck;
import java.io.Serializable;
import lombok.*;
import org.springframework.data.annotation.Transient;
import cn.ibizlab.util.annotation.Audit;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;


import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.baomidou.mybatisplus.annotation.*;
import cn.ibizlab.util.domain.EntityMP;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;

/**
 * 实体[执行日志]
 */
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "IBZRULELOG", resultMap = "ExecLogResultMap")
@ApiModel("执行日志")
public class ExecLog extends EntityMP implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 规则执行日志标识
     */
    @DEField(name = "ru_execlogid", isKeyField = true)
    @TableId(value = "ru_execlogid", type = IdType.ASSIGN_UUID)
    @JSONField(name = "id")
    @JsonProperty("id")
    @ApiModelProperty("规则执行日志标识")
    private String id;
    /**
     * 规则执行批次
     */
    @DEField(name = "ru_execlogname")
    @TableField(value = "ru_execlogname")
    @JSONField(name = "name")
    @JsonProperty("name")
    @ApiModelProperty("规则执行批次")
    private String name;
    /**
     * 建立时间
     */
    @DEField(preType = DEPredefinedFieldType.CREATEDATE)
    @TableField(value = "createdate", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    @JSONField(name = "createdate", format = "yyyy-MM-dd HH:mm:ss")
    @JsonProperty("createdate")
    @ApiModelProperty("建立时间")
    private Timestamp createdate;
    /**
     * 更新时间
     */
    @DEField(preType = DEPredefinedFieldType.UPDATEDATE)
    @TableField(value = "updatedate")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    @JSONField(name = "updatedate", format = "yyyy-MM-dd HH:mm:ss")
    @JsonProperty("updatedate")
    @ApiModelProperty("更新时间")
    private Timestamp updatedate;
    /**
     * 执行结果
     */
    @TableField(value = "retcode")
    @JSONField(name = "ret_code")
    @JsonProperty("ret_code")
    @ApiModelProperty("执行结果")
    private Integer retCode;
    /**
     * 总行数
     */
    @TableField(value = "cnt")
    @JSONField(name = "cnt")
    @JsonProperty("cnt")
    @ApiModelProperty("总行数")
    private Integer cnt;
    /**
     * 成功行数
     */
    @TableField(value = "succ")
    @JSONField(name = "succ")
    @JsonProperty("succ")
    @ApiModelProperty("成功行数")
    private Integer succ;
    /**
     * 标识属性
     */
    @TableField(value = "keyvaluefield")
    @JSONField(name = "key_value_field")
    @JsonProperty("key_value_field")
    @ApiModelProperty("标识属性")
    private String keyValueField;
    /**
     * 运行内容
     */
    @TableField(value = "runbody")
    @JSONField(name = "run_body")
    @JsonProperty("run_body")
    @ApiModelProperty("运行内容")
    private String runBody;
    /**
     * 运行结果
     */
    @TableField(value = "runresult")
    @JSONField(name = "run_result")
    @JsonProperty("run_result")
    @ApiModelProperty("运行结果")
    private String runResult;
    /**
     * 系统标识
     */
    @TableField(value = "systemid")
    @JSONField(name = "system_id")
    @JsonProperty("system_id")
    @ApiModelProperty("系统标识")
    private String systemId;



    /**
     * 设置 [规则执行批次]
     */
    public void setName(String name) {
        this.name = name;
        this.modify("ru_execlogname", name);
    }

    /**
     * 设置 [执行结果]
     */
    public void setRetCode(Integer retCode) {
        this.retCode = retCode;
        this.modify("retcode", retCode);
    }

    /**
     * 设置 [总行数]
     */
    public void setCnt(Integer cnt) {
        this.cnt = cnt;
        this.modify("cnt", cnt);
    }

    /**
     * 设置 [成功行数]
     */
    public void setSucc(Integer succ) {
        this.succ = succ;
        this.modify("succ", succ);
    }

    /**
     * 设置 [标识属性]
     */
    public void setKeyValueField(String keyValueField) {
        this.keyValueField = keyValueField;
        this.modify("keyvaluefield", keyValueField);
    }

    /**
     * 设置 [运行内容]
     */
    public void setRunBody(String runBody) {
        this.runBody = runBody;
        this.modify("runbody", runBody);
    }

    /**
     * 设置 [运行结果]
     */
    public void setRunResult(String runResult) {
        this.runResult = runResult;
        this.modify("runresult", runResult);
    }

    /**
     * 设置 [系统标识]
     */
    public void setSystemId(String systemId) {
        this.systemId = systemId;
        this.modify("systemid", systemId);
    }


    /**
     * 复制当前对象数据到目标对象(粘贴重置)
     * @param targetEntity 目标数据对象
     * @param bIncEmpty  是否包括空值
     * @param <T>
     * @return
     */
    @Override
    public <T> T copyTo(T targetEntity, boolean bIncEmpty) {
        this.reset("ru_execlogid");
        return super.copyTo(targetEntity, bIncEmpty);
    }
}


