package cn.estsh.i3plus.pojo.report.bean;

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @Description :
 * @Reference :
 * @Author : wei.peng
 * @CreateDate : 19-12-3 下午5:10
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "BR_POJO_VIEW_ATTR")
@Api(value = "对象视图", description = "对象视图")
public class BrPojoViewAttr extends BaseBean {

    private static final long serialVersionUID = -3080081514595597936L;
    @Column(name = "VIEW_ID")
    @ApiParam(value = "视图ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long viewId;

    /************************************** 对象信息 **************************************/

    @Column(name = "POJO_ID")
    @ApiParam(value = "对象ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long pojoId;

    @Column(name = "POJO_NAME_RDD")
    @ApiParam(value = "对象名称")
    private String pojoNameRdd;

    @Column(name = "POJO_TABLE_NAME_RDD")
    @ApiParam(value = "对象代码")
    private String pojoTableNameRdd;

    @Column(name = "POJO_TABLE_NAME_ALIAS_RDD")
    @ApiParam(value = "对象别名")
    private String pojoTableNameAliasRdd;

    @Column(name="POJO_COLUMN_NAME")
    @ApiParam(value ="对象属性")
    private String pojoColumnName;


//    @Column(name="POJO_CODE_NAME")
//    @ApiParam(value ="对象属性")
//    private String pojoCodeName;
//
//    @Column(name="PACKAGE_POJO_ATTR")
//    @ApiParam(value ="对象属性全路径")
//    private String packagePojoAttr;

    @Column(name="VIEW_ATTR_ALIAS")
    @ApiParam(value ="视图属性别名")
    private String viewAttrAlias;

    /************************************** 属性信息 **************************************/

    @Column(name = "AGGREGATION_TYPE")
    @ApiParam(value = "聚合类型")
    private Integer aggregationType;

    @Column(name = "VIEW_ATTR_NAME")
    @ApiParam(value = "显示名称")
    private String viewAttrName;

    @Column(name = "VIEW_DIMENSION")
    @ApiParam(value = "视图维度")
    private String viewDimension;

    @Column(name = "ATTR_SORT")
    @ApiParam(value = "属性显示排序")
    private Integer attrSort;

    @Column(name="ATTR_SORT_TYPE")
    @ApiParam(value ="排序规则")
    private Integer attrSortType;
    public String getAttrSortTypeTxt(){
        return attrSortType == null ? null : CommonEnumUtil.ASC_OR_DESC.valueOf(attrSortType);
    }

    @Column(name="ATTR_SHOW")
    @ApiParam(value ="属性是否显示")
    private Integer attrShow;
    public String getAttrShowTxt(){
        return attrShow == null ? null : CommonEnumUtil.TRUE_OR_FALSE.valueOfDescription(attrShow);
    }

    @Column(name="ATTR_HQL")
    @ApiParam(value ="属性HQL")
    private String attrHql;

    @Column(name = "VIEW_DESCRIPTION")
    @ApiParam(value = "视图描述")
    private String viewDescription;


}
