From 5174fc9ec03e6b6d3f6f96a7e74b9a44edea9aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=87=E6=B0=B8=E8=BE=BE?= Date: Wed, 18 Oct 2023 23:17:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=9A=E5=8A=A1model?= =?UTF-8?q?=E5=9F=BA=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Model/BaseModel.cs | 37 +++++++++++++++++++++++++++++++++++++ ZR.Service/GlobalUsing.cs | 3 ++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 ZR.Model/BaseModel.cs diff --git a/ZR.Model/BaseModel.cs b/ZR.Model/BaseModel.cs new file mode 100644 index 0000000..52af7c1 --- /dev/null +++ b/ZR.Model/BaseModel.cs @@ -0,0 +1,37 @@ +using MiniExcelLibs.Attributes; + +namespace ZR.Model; + +public class BaseModel +{ + [SugarColumn(IsOnlyIgnoreUpdate = true)] + [JsonProperty(propertyName: "CreateBy")] + [ExcelIgnore] + public long CreateBy { get; set; } + + [SugarColumn(IsOnlyIgnoreUpdate = true)] + [JsonProperty(propertyName: "CreateName")] + [ExcelIgnore] + public string CreateName { get; set; } + + [SugarColumn(IsOnlyIgnoreUpdate = true)] + [JsonProperty(propertyName: "CreateTime")] + [ExcelColumn(Format = "yyyy-MM-dd HH:mm:ss")] + public DateTime CreateTime { get; set; } = DateTime.Now; + + [SugarColumn(IsOnlyIgnoreInsert = true)] + [JsonProperty(propertyName: "UpdateBy")] + [ExcelIgnore] + public long UpdateBy { get; set; } + + [SugarColumn(IsOnlyIgnoreInsert = true)] + [JsonProperty(propertyName: "UpdateName")] + [ExcelIgnore] + public string UpdateName { get; set; } + + [SugarColumn(IsOnlyIgnoreInsert = true, IsNullable = true)] + [JsonProperty(propertyName: "UpdateTime")] + [ExcelIgnore] + public DateTime? UpdateTime { get; set; } + +} \ No newline at end of file diff --git a/ZR.Service/GlobalUsing.cs b/ZR.Service/GlobalUsing.cs index 9845705..924f43f 100644 --- a/ZR.Service/GlobalUsing.cs +++ b/ZR.Service/GlobalUsing.cs @@ -1,4 +1,5 @@ global using System.Collections.Generic; global using System; global using SqlSugar; -global using Newtonsoft.Json; \ No newline at end of file +global using Newtonsoft.Json; +global using Infrastructure.Attribute; \ No newline at end of file