package com.bohuikeji.frame.module.admin.entity.sys;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.bohuikeji.frame.module.admin.annotation.TableKeyField;
import com.bohuikeji.frame.module.admin.annotation.TableQueryField;
import com.bohuikeji.frame.module.admin.annotation.TableShowField;
import com.bohuikeji.frame.module.admin.annotation.TableNewField;
import com.bohuikeji.frame.module.admin.base.EntityBase;
import com.bohuikeji.frame.module.admin.constant.RegEx;
import com.bohuikeji.frame.module.admin.entity.web.block.SelectBlock;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * <p>
 * 系统菜单
 * </p>
 *
 * @author jobob
 * @since 2019-08-09
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class SysMenu extends EntityBase<SysMenu> {

    private static final long serialVersionUID = 1L;

    /**
     * 菜单id
     */
    @TableId(value = "id", type = IdType.AUTO)
    @TableShowField(value = "ID",id = true)
    @TableNewField(show = false)
    private Integer id;

    /**
     * 菜单名称
     */
    @TableField("name")
    @TableShowField("菜单名称")
    @TableNewField
    private String name;

    /**
     * 菜单级别
     */
    @TableField("levle")
    @TableShowField(value = "菜单级别",show = false)
    @TableNewField(edit = false)
    @TableQueryField
    private String levle;

    /**
     * 菜单地址
     */
    @TableField("url")
    @TableShowField("菜单地址")
    @TableNewField(edit = false)
    private String url;

    /**
     * 实体类名
     */
    @TableField("model")
    @TableShowField(value = "实体类名",show = false)
    @TableNewField(edit = false)
    private String model;

    /**
     * 上级菜单id
     */
    @TableField("super_id")
    @TableShowField(value = "上级菜单",show = false)
    @TableNewField(edit = false,block = SelectBlock.class)
    @TableKeyField(table = "sys_menu",keyShowFields = {"name"},where = "display=1",key = SysMenu.class)
    @TableQueryField
    private Integer superId;

    /**
     * 是否为首页
     */
    @TableField("is_index")
    @TableShowField(value = "是否为首页",show = false)
    private Boolean isIndex;

    /**
     * 菜单图标
     */
    @TableField("icon")
    @TableShowField(value = "菜单图标",show = false)
    @TableNewField(edit = false)
    private String icon;

    /**
     * 是否显示(1、显示 0、隐藏)
     */
    @TableField("display")
    @TableShowField(value = "是否显示(1、显示 0、隐藏)",show = false)
    private Boolean display;

    /**
     * 排序
     */
    @TableField("sort")
    @TableShowField(value = "排序",show = false)
    @TableNewField(limit = RegEx.INTEGER)
    private Integer sort;

    /**
     * 排序
     */
    @TableField("share")
    @TableShowField(value = "共享方式呢",show = false)
    @TableNewField(limit = RegEx.INTEGER)
    private Integer share=0;

    /**
     * 页面模板id
     */
    @TableField("page_id")
    private Integer pageId;

    /**
     * 下级菜单列表
     */
    @TableField(exist = false)
    private List<SysMenu> sonMenu;
    @TableField(exist = false)
    private SysMenu superMenu;
    @TableField(exist = false)
    private String active;
    @TableField(exist = false)
    private String open;


}
