Skip to content

Commit

Permalink
[fix]修正IP和用户名填充缺陷
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Aug 5, 2024
1 parent ac4053e commit e16539e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion XCode/Entity/IEntityModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ protected virtual Boolean SetNoDirtyItem(ICollection<FieldItem> fields, IEntity
protected virtual Boolean SetItem(ICollection<FieldItem> 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;
Expand Down
4 changes: 2 additions & 2 deletions XCode/Model/IPModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -92,5 +92,5 @@ protected override Boolean OnValid(IEntity entity, DataMethod method)
/// <summary>获取实体类的字段名。带缓存</summary>
/// <param name="entityType"></param>
/// <returns></returns>
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());
}
10 changes: 8 additions & 2 deletions XCode/Model/UserModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit e16539e

Please sign in to comment.