using MessagePack;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XPrintServer.DataModel.Models
{
    ///<summary>
    ///用户角色的菜单表
    ///</summary>
    [SugarIndex("idx_{split_table}_create_time", nameof(CreateTime), OrderByType.Desc)]
    [SugarIndex("idx_{split_table}_ids", [nameof(MenuId), nameof(RoleId)], [OrderByType.Desc, OrderByType.Desc])]
    [SplitTable(SplitType.Year)]//按年分表 （自带分表支持 年、季、月、周、日）
    [SugarTable("user_menu_in_role_{year}{month}{day}")]//3个变量必须要有，这么设计为了兼容开始按年，后面改成按月、按日
    public partial class UserMenuInRole
    {
        public UserMenuInRole()
        {
        }

        /// <summary>
        /// Desc:Id
        /// Default:
        /// Nullable:False
        /// </summary>           
        [Key("Id")]
        [SugarColumn(IsPrimaryKey = true, ColumnDescription = "主键Id")]
        public Guid Id { get; set; }

        /// <summary>
        /// Desc:MenuId
        /// Default:
        /// Nullable:False
        /// </summary>           
        [Key("MenuId")]
        [SugarColumn(IsNullable = false, ColumnDescription = "菜单Id")]
        public Guid MenuId { get; set; }

        /// <summary>
        /// Desc:RoleId
        /// Default:
        /// Nullable:False
        /// </summary>           
        [Key("RoleId")]
        [SugarColumn(ColumnDescription = "角色Id")]
        public Guid RoleId { get; set; }


        [Key("CreateTime")]
        [SplitField] //分表字段 在插入的时候会根据这个字段插入哪个表，在更新删除的时候用这个字段找出相关表
        public DateTime CreateTime { get; set; }

    }
}
