71 lines
2.4 KiB
C#
71 lines
2.4 KiB
C#
using FreeSql.DataAnnotations;
|
||
using F9WebAiTest.Domain.Enums.SYS.Departments;
|
||
using F9WebAiTest.Domain.Enums.SYS.WuziMulus;
|
||
using F9WebAiTest.Domain.Events.SYS.WuziMulus;
|
||
|
||
namespace F9WebAiTest.Domain.Entities.SYS.WuziMulus;
|
||
|
||
/// <summary>
|
||
/// 物资分组:物资目录的分类树(如 01 干茧、04 副产品、0401 副产品-副产车间…),编号按父级编号 + 2 位序号自动生成。
|
||
/// </summary>
|
||
[Table(Name = "sys_wuzi_group")]
|
||
public class WuziGroup : AggregateRoot
|
||
{
|
||
/// <summary>业务类型(原料/中间品/生丝/副产品/五金)</summary>
|
||
[Column(Name = "businesstype")]
|
||
public WuziBusiness_Type_Enum BusinessType { get; private set; }
|
||
|
||
/// <summary>归属部门职责类型</summary>
|
||
[Column(Name = "departmenttype")]
|
||
public Department_DutyType_Enum DepartmentType { get; private set; }
|
||
|
||
/// <summary>编号(如 01、0101)</summary>
|
||
[Column(Name = "code")]
|
||
public string Code { get; private set; }
|
||
|
||
/// <summary>名称</summary>
|
||
[Column(Name = "name")]
|
||
public string Name { get; private set; }
|
||
|
||
/// <summary>父级 Id(0 = 一级分类)</summary>
|
||
[Column(Name = "parentid")]
|
||
public long ParentId { get; private set; }
|
||
|
||
/// <summary>顺序号</summary>
|
||
[Column(Name = "sortorder")]
|
||
public int SortOrder { get; private set; }
|
||
|
||
/// <summary>描述</summary>
|
||
[Column(Name = "description")]
|
||
public string Description { get; private set; }
|
||
|
||
public WuziGroup() { }
|
||
|
||
public WuziGroup(long id, WuziBusiness_Type_Enum businessType, Department_DutyType_Enum departmentType,
|
||
string code, string name, long parentId, int sortOrder, string description)
|
||
{
|
||
Id = id;
|
||
BusinessType = businessType;
|
||
DepartmentType = departmentType;
|
||
Code = code;
|
||
Name = name;
|
||
ParentId = parentId;
|
||
SortOrder = sortOrder;
|
||
Description = description;
|
||
AddDomainEvent(new WuziGroup_ChangedDomainEvent(Id));
|
||
}
|
||
|
||
public void Update(WuziBusiness_Type_Enum businessType, Department_DutyType_Enum departmentType,
|
||
string name, int sortOrder, string description)
|
||
{
|
||
BusinessType = businessType;
|
||
DepartmentType = departmentType;
|
||
Name = name;
|
||
SortOrder = sortOrder;
|
||
Description = description;
|
||
AddDomainEvent(new WuziGroup_ChangedDomainEvent(Id));
|
||
}
|
||
|
||
public void Deleted() => AddDomainEvent(new WuziGroup_ChangedDomainEvent(Id));
|
||
}
|