baotian
2024-06-04 b959135a1139fb66646523d92e5bd20c5910f283
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
 
namespace iWare.Wms.Core
{
    /// <summary>
    /// 字典类型表
    /// </summary>
    [Table("sys_dict_type")]
    [Comment("字典类型表")]
    public class SysDictType : DEntityBase, IEntityTypeBuilder<SysDictType>
    {
        /// <summary>
        /// 名称
        /// </summary>
        [Comment("名称")]
        [Required, MaxLength(50)]
        public string Name { get; set; }
 
        /// <summary>
        /// 编码
        /// </summary>
        [Comment("编码")]
        [Required, MaxLength(50)]
        public string Code { get; set; }
 
        /// <summary>
        /// 排序
        /// </summary>
        [Comment("排序")]
        public int Sort { get; set; }
 
        /// <summary>
        /// 备注
        /// </summary>
        [Comment("备注")]
        [MaxLength(100)]
        public string Remark { get; set; }
 
        /// <summary>
        /// 状态(字典 0正常 1停用 2删除)
        /// </summary>
        [Comment("状态")]
        public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
 
        /// <summary>
        /// 对应枚举
        /// </summary>
        [Comment("对应枚举")]
        [MaxLength(200)]
        public string EnumClassName { get; set; }
 
        /// <summary>
        /// 字典数据
        /// </summary>
        public ICollection<SysDictData> SysDictDatas { get; set; }
 
        public void Configure(EntityTypeBuilder<SysDictType> entityBuilder, DbContext dbContext, Type dbContextLocator)
        {
            entityBuilder.HasMany(x => x.SysDictDatas)
                .WithOne(x => x.SysDictType)
                .HasForeignKey(x => x.TypeId);
        }
    }
}