稽查实体给默认值
continuous-integration/drone/push Build is passing Details

IRC_NewDev
hang 2024-09-19 17:01:03 +08:00
parent b98df9dae8
commit b5d117f6fa
3 changed files with 42 additions and 62 deletions

View File

@ -7,64 +7,43 @@ using System;
using IRaCIS.Core.Domain.Share;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace IRaCIS.Core.Domain.Models
using Microsoft.EntityFrameworkCore;
namespace IRaCIS.Core.Domain.Models;
[Comment("医生 - 项目标准签名文档")]
[Table("DoctorCriterionFile")]
public class DoctorCriterionFile : BaseAddAuditEntity
{
///<summary>
///DoctorCriterionFile
///</summary>
[Table("DoctorCriterionFile")]
public class DoctorCriterionFile :BaseAddAuditEntity
{
#region 导航属性
[JsonIgnore]
[ForeignKey("DoctorId")]
public Doctor Doctor { get; set; }
#endregion
/// <summary>
/// 文件名称
/// </summary>
public string FileName { get; set; } = string.Empty;
#region 导航属性
[JsonIgnore]
[ForeignKey("DoctorId")]
public Doctor Doctor { get; set; }
#endregion
/// <summary>
/// 文件路径
/// </summary>
public string FilePath { get; set; } = string.Empty;
public string CriterionName { get; set; } = null!;
/// <summary>
/// 标准类型
/// </summary>
public CriterionType CriterionType { get; set; }
/// <summary>
/// 医生Id
/// </summary>
public Guid DoctorId { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; } = string.Empty;
[Comment("标准类型")]
public CriterionType CriterionType { get; set; }
/// <summary>
/// 文件类型
/// </summary>
public CriterionFileType FileType { get; set; }
public Guid DoctorId { get; set; }
[StringLength(400)]
public string FileName { get; set; } = null!;
[StringLength(4000)]
public string FilePath { get; set; } = null!;
public CriterionFileType FileType { get; set; }
public bool IsEnable { get; set; }
public string Remark { get; set; } = null!;
public Guid? TrialId { get; set; }
public Guid? TrialReadingCriterionId { get; set; }
}
/// <summary>
/// 是否启用
/// </summary>
public bool IsEnable { get; set; } = true;
public string CriterionName { get; set; } = string.Empty;
public Guid? TrialReadingCriterionId { get; set; }
public Guid? TrialId { get; set; }
}
}

View File

@ -29,23 +29,23 @@ public class DataInspection : BaseAddAuditEntity
public Guid? ChildrenTypeId { get; set; }
[Comment(" 创建人姓名")]
public string CreateUserName { get; set; } = null!;
public string CreateUserName { get; set; } = string.Empty;
public string CreateUserRealName { get; set; } = null!;
public string CreateUserRealName { get; set; } = string.Empty;
[Comment(" 阅片医生")]
public Guid? DoctorUserId { get; set; }
[Comment(" 被稽查实体名")]
public string EntityName { get; set; } = null!;
public string EntityName { get; set; } = string.Empty;
[Comment(" 要稽查对象Id")]
public Guid? GeneralId { get; set; }
[Comment(" 标识")]
public string Identification { get; set; } = null!;
public string Identification { get; set; } = string.Empty;
public string IP { get; set; } = null!;
public string IP { get; set; } = string.Empty;
[Comment(" 是否是前端添加")]
public bool? IsFrontAdd { get; set; }
@ -75,10 +75,10 @@ public class DataInspection : BaseAddAuditEntity
[Comment(" 父ID")]
public Guid? ParentId { get; set; }
public string Reason { get; set; } = null!;
public string Reason { get; set; } = string.Empty;
[Comment(" 角色名称")]
public string RoleName { get; set; } = null!;
public string RoleName { get; set; } = string.Empty;
public Guid? SignId { get; set; }

View File

@ -50,7 +50,8 @@ public class AuditEntityInterceptor(IUserInfo _userInfo, ILogger<AuditEntityInte
// 获取所有更改,删除,新增的实体,但排除审计实体(避免死循环)
foreach (var entry in context.ChangeTracker.Entries().Where(u => (u.State == EntityState.Modified || u.State == EntityState.Added))
.Where(x => !typeof(DataInspection).IsAssignableFrom(x.Entity.GetType())).ToList())
//.Where(x => !typeof(DataInspection).IsAssignableFrom(x.Entity.GetType()))
.ToList())
{
// 检查属性是否为string类型并且值为null
foreach (var property in entry.Properties.Where(t=>t.Metadata.ClrType==typeof(string) && t.CurrentValue == null))