From 094447258f272575d386ee5cfcb7f5153ec52e05 Mon Sep 17 00:00:00 2001 From: Falcon <12919280+falconfly@user.noreply.gitee.com> Date: Fri, 26 Jul 2024 11:05:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E6=89=80=E6=9C=89=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E8=A1=A8=E5=A2=9E=E5=8A=A0TableBase=E5=9F=BA=E7=B1=BB?= =?UTF-8?q?=EF=BC=8C=E6=89=80=E6=9C=89=E8=A1=A8=E5=A2=9E=E5=8A=A0Id?= =?UTF-8?q?=E5=92=8CCreateDateTime=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CalendarNotepad/Models/PlusFileUnit.cs | 2 +- CalendarNotepad/Models/TableBase.cs | 20 ++++++++++++++++++++ CalendarNotepad/Models/WorkUnit.cs | 2 +- CalendarNotepad/Models/WorkUnitPlusFile.cs | 2 +- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 CalendarNotepad/Models/TableBase.cs diff --git a/CalendarNotepad/Models/PlusFileUnit.cs b/CalendarNotepad/Models/PlusFileUnit.cs index f679896..6d4ca50 100644 --- a/CalendarNotepad/Models/PlusFileUnit.cs +++ b/CalendarNotepad/Models/PlusFileUnit.cs @@ -3,7 +3,7 @@ /// /// 附件文件单元 /// - public class PlusFileUnit + public class PlusFileUnit:TableBase { /// /// 文件指纹ID diff --git a/CalendarNotepad/Models/TableBase.cs b/CalendarNotepad/Models/TableBase.cs new file mode 100644 index 0000000..639fbe9 --- /dev/null +++ b/CalendarNotepad/Models/TableBase.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations; + +namespace CalendarNotepad.Models +{ + /// + /// 数据表基类 + /// + public abstract class TableBase + { + /// + /// 数据主键 + /// + [Key] + public string Id { get; set; } = Guid.NewGuid().ToString(); + /// + /// 记录创建或最后修改时间 + /// + public DateTime CreateDateTime { get; set; } = DateTime.Now; + } +} diff --git a/CalendarNotepad/Models/WorkUnit.cs b/CalendarNotepad/Models/WorkUnit.cs index b785e95..1d59767 100644 --- a/CalendarNotepad/Models/WorkUnit.cs +++ b/CalendarNotepad/Models/WorkUnit.cs @@ -7,7 +7,7 @@ namespace CalendarNotepad.Models /// 工作记录单元 /// [Table("WorkUnit")] - public class WorkUnit + public class WorkUnit:TableBase { /// /// 工作日期 diff --git a/CalendarNotepad/Models/WorkUnitPlusFile.cs b/CalendarNotepad/Models/WorkUnitPlusFile.cs index fb5d893..d415cbc 100644 --- a/CalendarNotepad/Models/WorkUnitPlusFile.cs +++ b/CalendarNotepad/Models/WorkUnitPlusFile.cs @@ -3,7 +3,7 @@ /// /// 工作单元附件对应关系 /// - public class WorkUnitPlusFile + public class WorkUnitPlusFile:TableBase { /// /// 工作日期