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

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
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.*;
import java.util.List;

/**
 * @Description : 自定义表单布局
 * @Reference :
 * @Author : yunhao
 * @CreateDate : 2019-03-21 13:54
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "BF_LAYOUT")
@Api(value = "自定义表单布局")
public class BfLayout extends BaseBean {

    private static final long serialVersionUID = 4951428858633293563L;
    @Column(name = "LAYOUT_NAME")
    @ApiParam(value = "名称")
    private String layoutName;

    @Column(name = "LAYOUT_WIDTH")
    @ApiParam(value = "布局宽度")
    private Double layoutWidth;

    @Column(name = "LAYOUT_HEIGHT")
    @ApiParam(value = "布局高度")
    private Double layoutHeight;

    @Column(name = "LAYOUT_ROW_COUNT")
    @ApiParam(value = "行数")
    private Integer layoutRowCount;

    @Column(name = "LAYOUT_COLUMN_COUNT")
    @ApiParam(value = "列数")
    private Integer layoutColumnCount;

    public Integer getLayoutColumnCountValue(){
        if(this.layoutColumnCount == null) {
            return 0;
        }
        return layoutColumnCount.intValue();
    }

    @Column(name = "LAYOUT_REPORT_COUNT")
    @ApiParam(value = "引用报表数量")
    private Integer layoutReportCount;

    @Lob
    @Column(name = "LAYOUT_DESCRIPTION")
    @ApiParam(value = "布局描述")
    private String layoutDescription;

    // 布局行集合
    @Transient
    private List<BfLayoutRow> bfLayoutRows;
}
