package cn.estsh.i3plus.pojo.aps.common;

import cn.estsh.i3plus.pojo.aps.annotation.ExcludeImportExport;
import cn.estsh.i3plus.pojo.aps.annotation.FieldAnnotation;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiParam;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Lob;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import java.util.HashMap;

/**
 * @Description :APS基类
 * 对于APS所有实体类均需继承该类。
 * @Reference :
 * @Author : jason.niu
 * @CreateDate : 2019-09-17
 * @Modify:
 **/
@Data
@MappedSuperclass
@ExcludeImportExport
public abstract class BaseAPS extends BaseBean {
    private static final long serialVersionUID = -8638842158403944318L;
    @JsonIgnore
    @Lob
    @FieldAnnotation(property = false)
    private HashMap<String, Object> customFields = new HashMap<>();

    @Column(name="KEY")
    @ApiParam(value ="主键值")
    @FieldAnnotation(display = false, modify = false)
    @Transient
    private String key;

    public Object getCustomField(String code) {
        return customFields.get(code);
    }

    public void setCustomField(String code, Object value) {
        customFields.put(code, value);
    }
}
