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

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

/**
 * @Description : 目录
 * @Reference :
 * @Author : Adair Peng
 * @CreateDate : 2019-01-17 11:17
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="BR_MENU")
@Api(value="报表目录",description = "报表目录")
public class BrMenu extends BaseBean {

    private static final long serialVersionUID = -247488761545602540L;
    @Column(name="NAME")
    @ApiParam(value ="功能名称")
    private String name;

    @Column(name="NAME_ZH_SHORTENING")
    @ApiParam(value ="功能名称中文简写")
    private String nameZhShortening;

    @Column(name="MENU_CODE")
    @ApiParam(value ="功能代码")
    private String menuCode;

    @Column(name="MENU_TYPE")
    @ApiParam(value ="功能类型（枚举：1.模块，2.菜单，3.按钮）" , example ="-1")
    private Integer menuType;

    // 根节点-1
    @Column(name="PARENT_ID")
    @ApiParam(value ="父级功能ID" , example = "-1")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentId;

    @Column(name="PARENT_NAME_RDD")
    @ApiParam(value ="父级功能名称" , access ="父级功能名称")
    private String parentNameRdd;

    // 根节点-1
    @Column(name="REPORT_ID")
    @ApiParam(value ="报表ID" , example = "-1")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long reportId;

    @Column(name="REPORT_NAME_RDD")
    @ApiParam(value ="报表名称" , access ="父级功能名称")
    private String reportNameRdd;

    @Column(name="MENU_CLASS_PATH")
    @ApiParam(value ="功能 class path" , access ="资源class path")
    private String menuClassPath;

    @Column(name="MENU_GRADE")
    @ApiParam(value ="功能等级", example = "1")
    private String menuGrade;

    @Column(name="MENU_SORT")
    @ApiParam(value ="功能排序", example = "0")
    private Integer menuSort;

    @Column(name="MENU_URL")
    @ApiParam(value ="功能 url" , access ="资源 url")
    private String menuUrl;

    @Column(name="MENU_CSS")
    @ApiParam(value ="功能 css" , access ="资源css")
    private String menuCss;

    @Column(name="MENU_ICON")
    @ApiParam(value ="功能icon" , access ="资源icon")
    private String menuIcon;

    @Column(name="MENU_DESCRIPTION")
    @ApiParam(value ="功能描述" , access ="配置描述")
    private String menuDescription;

    @Column(name="MENU_STATUS")
    @ApiParam(value ="功能状态（1.正常，2.禁用）" , example ="1" , access ="功能状态（1.正常，2.禁用）",defaultValue="1")
    private Integer menuStatus;

    @Column(name="ROLE_NAMES_RDD")
    @ApiParam(value ="角色名称" , access ="角色名称")
    private String roleNamesRdd;

    @Transient
    @ApiParam(value ="查询 ID 集合")
    private List<Long> findIdList = new ArrayList<>();

    @Transient
    @ApiParam(value ="角色ID 集合")
    private List<String> roleIdList = new ArrayList<>();

    @Transient
    @ApiParam(value ="子集列表")
    private List<BrMenu> childList = new ArrayList<>();
}
