修改基础表定义!
This commit is contained in:
		
							parent
							
								
									02c2c8843e
								
							
						
					
					
						commit
						207e944d02
					
				@ -5,9 +5,9 @@ using System.ComponentModel.DataAnnotations;
 | 
			
		||||
namespace Falcon.SugarApi.DatabaseDefinitions
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 基础表,定义表基础数据结构和构造方法
 | 
			
		||||
    /// 基础表.只定义表基础主键和创建时间
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public abstract class SugarBasicTable : ICreateNew
 | 
			
		||||
    public abstract class SugarBasicTable
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 主键
 | 
			
		||||
@ -21,11 +21,6 @@ namespace Falcon.SugarApi.DatabaseDefinitions
 | 
			
		||||
        [SugarColumn(IsOnlyIgnoreUpdate = true, ColumnDescription = "创建时间")]
 | 
			
		||||
        public DateTime CreateTime { get; set; } = DateTime.Now;
 | 
			
		||||
 | 
			
		||||
        /// <inheritdoc/>
 | 
			
		||||
        public void CreateNew(string createBy) {
 | 
			
		||||
            this.SetNew();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 将数据设置为新数据。
 | 
			
		||||
        /// <para>主要更新Id、创建时间和记录状态</para>
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,6 @@ using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace Falcon.SugarApi.DatabaseDefinitions
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@ -5,25 +5,16 @@ using System.Reflection;
 | 
			
		||||
namespace Falcon.SugarApi.DatabaseDefinitions
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 表基类。一般表应该继承此类
 | 
			
		||||
    /// 负载表基类。一般表应该继承此类,包括SugarBasicTable定义,和修改人,行状态,以及一些相关方法等
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public abstract class SugarTableBase : ICreateNew, IModify, IDelete
 | 
			
		||||
    public abstract class SugarTableBase :SugarBasicTable, ICreateNew, IModify, IDelete
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 主键
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsPrimaryKey = true, ColumnDescription = "主键")]
 | 
			
		||||
        public Guid Id { get; set; } = Guid.NewGuid();
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 创建人
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = true, ColumnDescription = "首次创建人")]
 | 
			
		||||
        public string? CreateBy { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 创建时间
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = true, ColumnDescription = "首次创建时间")]
 | 
			
		||||
        public DateTime? CreateTime { get; set; } = DateTime.Now;
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 更新人
 | 
			
		||||
        /// </summary>
 | 
			
		||||
@ -45,9 +36,8 @@ namespace Falcon.SugarApi.DatabaseDefinitions
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="createBy">创建人</param>
 | 
			
		||||
        public virtual void CreateNew(string createBy) {
 | 
			
		||||
            this.Id = Guid.NewGuid();
 | 
			
		||||
            base.SetNew();
 | 
			
		||||
            this.CreateBy = createBy;
 | 
			
		||||
            this.CreateTime = DateTime.Now;
 | 
			
		||||
            this.UpdateBy = this.CreateBy;
 | 
			
		||||
            this.UpdateTime = this.CreateTime;
 | 
			
		||||
            this.Status = RecordStetus.Effective;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user