payne
2024-04-25 46af5a3a488e06c2eb4844a2dd72ad9ddcd7cdbd
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
 
namespace Admin.NET.Core
{
    /// <summary>
    /// Excel模板
    /// </summary>
    [Table("sys_excel_template")]
    [Comment("Excel模板")]
    public class SysExcelTemplate : DEntityBase, IEntityTypeBuilder<SysExcelTemplate>
    {
        /// <summary>
        /// 模板名称
        /// </summary>
        [Comment("模板名称")]
        [Required, MaxLength(50)]
        public string Name { get; set; }
 
        /// <summary>
        /// 版本
        /// </summary>
        [Comment("版本")]
        [Required, MaxLength(20)]
        public string Version { get; set; }
 
        /// <summary>
        /// 所属应用
        /// </summary>
        [Comment("所属应用")]
        [Required, MaxLength(20)]
        public string AppName { get; set; }
 
 
        /// <summary>
        /// 类名
        /// </summary> 
        [Comment("类名")]
        [Required, MaxLength(50)]
        public string ClassName { get; set; }
 
        /// <summary>
        /// 模板文件名称
        /// </summary> 
        [Comment("模板文件名称")]
        [Required, MaxLength(50)]
        public string TemplateFileName { get; set; }
 
        /// <summary>
        /// 唯一字段集
        /// </summary> 
        [Comment("唯一字段集")]
        [Required, MaxLength(300)]
        public string UnionUniqueFields { get; set; }
 
 
        /// <summary>
        /// 表头开始行
        /// </summary>
        [Comment("表头开始行")]
        public int HeadStartLine { get; set; }
 
        /// <summary>
        /// 数据开始行
        /// </summary>
        [Comment("数据开始行")]
        public int DataStartLine { get; set; }
 
        /// <summary>
        /// 状态
        /// </summary>
        [Comment("状态")]
        public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
 
        /// <summary>
        /// 配置唯一键
        /// </summary>
        /// <param name="entityBuilder"></param>
        /// <param name="dbContext"></param>
        /// <param name="dbContextLocator"></param>
        public void Configure(EntityTypeBuilder<SysExcelTemplate> entityBuilder, DbContext dbContext, Type dbContextLocator)
        {
            entityBuilder.HasAlternateKey(x => new { x.ClassName, x.Version, x.AppName });
        }
    }
}