From e16539e8a47460e053d4ef414811f3958b72356a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=9F=B3=E5=A4=B4?= Date: Mon, 5 Aug 2024 16:38:30 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=E4=BF=AE=E6=AD=A3IP=E5=92=8C=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=90=8D=E5=A1=AB=E5=85=85=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- XCode/Entity/IEntityModule.cs | 2 +- XCode/Model/IPModule.cs | 4 ++-- XCode/Model/UserModule.cs | 10 ++++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/XCode/Entity/IEntityModule.cs b/XCode/Entity/IEntityModule.cs index 079d54726..e787fa12b 100644 --- a/XCode/Entity/IEntityModule.cs +++ b/XCode/Entity/IEntityModule.cs @@ -223,7 +223,7 @@ protected virtual Boolean SetNoDirtyItem(ICollection fields, IEntity protected virtual Boolean SetItem(ICollection fields, IEntity entity, String name, Object value) { // 没有这个字段,就不想了 - var fi = fields.FirstOrDefault(e => e.Name.EqualIgnoreCase(name)); + var fi = fields.FirstOrDefault(e => name.EqualIgnoreCase(e.Name, e.ColumnName)); if (fi == null) return false; name = fi.Name; diff --git a/XCode/Model/IPModule.cs b/XCode/Model/IPModule.cs index c71b4c04e..7ea50f172 100644 --- a/XCode/Model/IPModule.cs +++ b/XCode/Model/IPModule.cs @@ -69,7 +69,7 @@ protected override Boolean OnValid(IEntity entity, DataMethod method) { foreach (var fi in fs2) { - SetItem(fs2, entity, fi, ip); + SetItem(fs2, entity, fi.Name, ip); } } break; @@ -92,5 +92,5 @@ protected override Boolean OnValid(IEntity entity, DataMethod method) /// 获取实体类的字段名。带缓存 /// /// - protected static FieldItem[] GetIPFieldNames(Type entityType) => _ipFieldNames.GetOrAdd(entityType, t => GetFields(t).Where(e => e.Name.EqualIgnoreCase("CreateIP", "UpdateIP")).ToArray()); + protected static FieldItem[] GetIPFieldNames(Type entityType) => _ipFieldNames.GetOrAdd(entityType, t => GetFields(t).Where(e => e.Name.EqualIgnoreCase(__.CreateIP, __.UpdateIP)).ToArray()); } diff --git a/XCode/Model/UserModule.cs b/XCode/Model/UserModule.cs index 49b1e8b00..5417e1b02 100644 --- a/XCode/Model/UserModule.cs +++ b/XCode/Model/UserModule.cs @@ -48,10 +48,16 @@ protected override Boolean OnInit(Type entityType) { var fs = GetFields(entityType); foreach (var fi in fs) + { if (fi.Type == typeof(Int32) || fi.Type == typeof(Int64)) + { if (fi.Name.EqualIgnoreCase(__.CreateUserID, __.UpdateUserID)) return true; - else if (fi.Type == typeof(String)) - if (fi.Name.EqualIgnoreCase(__.CreateUser, __.UpdateUser)) return true; + } + else if (fi.Type == typeof(String)) + { + if (fi.Name.EqualIgnoreCase(__.CreateUser, __.UpdateUser)) return true; + } + } return false; }