入库操作修改
This commit is contained in:
1 parent
2097bffabb
commit
8de4bc26cd
8 files changed
+348
-25
No files matched your search
@@ -111,6 +111,27 @@ namespace HHWMS.Web
|
||||
return _data.SaveChanges();
|
||||
}
|
||||
|
||||
public int BatchUpdate<T>(T[] entities) where T : class
|
||||
{
|
||||
foreach (T entity in entities)
|
||||
{
|
||||
//自动设定添加日期和添加人
|
||||
if (typeof(T).IsSubclassOf(typeof(BasePoco)))
|
||||
{
|
||||
if ((entity as BasePoco).CreateTime == null)
|
||||
{
|
||||
(entity as BasePoco).CreateTime = DateTime.Now;
|
||||
}
|
||||
if (string.IsNullOrEmpty((entity as BasePoco).CreateBy))
|
||||
{
|
||||
(entity as BasePoco).CreateBy = _info?.ITCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
_data.Set<T>().UpdateRange(entities);
|
||||
return _data.SaveChanges();
|
||||
}
|
||||
|
||||
public int BatchUpdate<T>(Expression<Func<T, bool>> where, Expression<Func<T, T>> entity) where T : class
|
||||
{
|
||||
/*if (typeof(T).IsSubclassOf(typeof(BasePoco)))
|
||||
|
||||
Reference in new issue
Block a user