detect/detect.gui/Models/Entities/AuthorityEntity.cs

44 lines
1.2 KiB
C#
Raw Normal View History

2024-11-13 17:09:15 +08:00
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Avalonia.Collections;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
namespace detect.gui.Models.Entities;
2024-11-14 17:11:43 +08:00
[Table("dat_authority")]
2024-11-13 17:09:15 +08:00
[Index(nameof(Name), IsUnique = true)]
[Index(nameof(ParentId), IsUnique = false)]
public class AuthorityEntity
{
2024-11-14 17:11:43 +08:00
[Key]
[JsonProperty(PropertyName = "id")]
[Column("id")]
public long? Id { get; set; }
2024-11-13 17:09:15 +08:00
2024-11-14 17:11:43 +08:00
[StringLength(255), Comment("名称")]
[JsonProperty(PropertyName = "name")]
[Column("name")]
public string? Name { get; set; }
2024-11-13 17:09:15 +08:00
2024-11-14 17:11:43 +08:00
[DefaultValue(0)]
[JsonProperty(PropertyName = "parentId")]
[Column("parent_id")]
public long? ParentId { get; set; }
2024-11-13 17:09:15 +08:00
2024-11-14 17:11:43 +08:00
[Comment("创建时间")]
[JsonProperty(PropertyName = "createTime")]
[Column("create_time")]
public DateTime? CreateTime { get; set; }
2024-11-13 17:09:15 +08:00
2024-11-14 17:11:43 +08:00
[Comment("更新时间")]
[JsonProperty(PropertyName = "updateTime")]
[Column("update_time")]
public DateTime? UpdateTime { get; set; }
2024-11-13 17:09:15 +08:00
[NotMapped]
[JsonIgnore]
public AvaloniaList<AuthorityEntity>? Children { get; set; }
}