schangxiang@126.com
2025-05-07 cace264ad9d86a7831099810b079da1141957add
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
90
91
92
93
94
95
using CMS.Plugin.PipeLineLems.Domain.Shared.MyTestEntityNames;
using Volo.Abp;
using Volo.Abp.Domain.Entities.Auditing;
 
namespace CMS.Plugin.PipeLineLems.Domain.MyTestEntityNames
{
    /// <summary>
    /// MyTestEntityName
    /// </summary>
    public class MyTestEntityName : FullAuditedAggregateRoot<Guid>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MyTestEntityName"/> class.
        /// </summary>
        protected MyTestEntityName()
        {
        }
 
        /// <summary>
        /// Initializes a new instance of the <see cref="MyTestEntityName"/> class.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="code">The code.</param>
        /// <param name="name">The name.</param>
        /// <param name="sort">The sort.</param>
        /// <param name="remark">The remark.</param>
        public MyTestEntityName(Guid id, string code, string name, int sort = 0, string remark = null) : base(id)
        {
            Code = Check.NotNullOrWhiteSpace(code, "编号", MyTestEntityNameConsts.MaxCodeLength);
            Name = Check.NotNullOrWhiteSpace(name, "名称", MyTestEntityNameConsts.MaxNameLength);
            Sort = sort;
            Remark = Check.Length(remark, "备注", MyTestEntityNameConsts.MaxRemarkLength);
        }
 
        /// <summary>
        /// 编号
        /// </summary>
        public virtual string Code { get; protected set; }
 
        /// <summary>
        /// 名称
        /// </summary>
        public virtual string Name { get; protected set; }
 
        /// <summary>
        /// 排序
        /// </summary>
        public virtual int Sort { get; protected set; }
 
        /// <summary>
        /// 备注
        /// </summary>
        public virtual string Remark { get; protected set; }
 
        /// <summary>
        /// 是否禁用
        /// </summary>
        public virtual bool? IsDisabled { get; protected set; }
 
        /// <summary>
        /// Updates the specified code.
        /// </summary>
        /// <param name="code">The code.</param>
        /// <param name="name">The name.</param>
        /// <param name="remark">The remark.</param>
        public virtual void Update(string code, string name, string remark = null, bool? isDisabled = null)
        {
            Code = Check.NotNullOrWhiteSpace(code, "编号", MyTestEntityNameConsts.MaxCodeLength);
            Name = Check.NotNullOrWhiteSpace(name, "名称", MyTestEntityNameConsts.MaxNameLength);
            Remark = Check.Length(remark, "备注", MyTestEntityNameConsts.MaxRemarkLength);
            IsDisabled = isDisabled ?? IsDisabled;
        }
 
        /// <summary>
        /// Adjusts the sort.
        /// </summary>
        /// <param name="sort">The sort.</param>
        public void AdjustSort(int sort)
        {
            Sort = sort;
        }
 
        /// <summary>
        /// Clones the specified create.
        /// </summary>
        /// <param name="create">The create.</param>
        /// <param name="name">The name.</param>
        /// <param name="i">The i.</param>
        /// <returns></returns>
        public MyTestEntityName Clone(Guid create, string name, int i)
        {
            return new MyTestEntityName(create, Code, name, i, Remark);
        }
    }
}