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.entity.web.block.SelectBlock;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * <p>
 * 菜单角色对应表
 * </p>
 *
 * @author jobob
 * @since 2019-08-09
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class SysMenuRole extends EntityBase<SysMenuRole> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "menu_role_id", type = IdType.AUTO)
    @TableShowField(value = "ID",id = true)
    @TableNewField(show = false)
    private Integer menuRoleId;

    @TableField("menu_id")
    @TableShowField(value = "菜单")
    @TableQueryField()
    @TableKeyField(table = "sys_menu",keyShowFields = {"name"},key = SysMenu.class)
    @TableNewField(block = SelectBlock.class)
    private Integer menuId;

    @TableField("role_id")
    @TableShowField("角色")
    @TableQueryField()
    @TableKeyField(table = "sys_role",keyShowFields = {"role_name"},where = "fran_id is not null",key = SysRole.class)
    @TableNewField(block = SelectBlock.class)
    private Integer roleId;

    @TableField("create_time")
    @TableShowField("创建时间")
    @TableQueryField(sort = 0)
    private LocalDateTime createTime=LocalDateTime.now();

    @TableField("create_user")
    @TableShowField("创建人")
    @TableKeyField(table = "sys_user",keyShowFields = {"user_name"},key = SysUser.class)
    @TableQueryField()
    private Integer createUser;


}
