BaseRepository 新增备注

This commit is contained in:
不做码农 2021-12-25 12:06:00 +08:00
parent 412dccf416
commit 4a42969932
2 changed files with 28 additions and 0 deletions

View File

@ -131,6 +131,13 @@ namespace ZR.Repository
return Context.Updateable(entity).UpdateColumns(expression).IgnoreColumns(ignoreAllNull).ExecuteCommand();
}
/// <summary>
/// 根据实体类更新 egUpdate(dept, it => new { it.Status }, f => depts.Contains(f.DeptId));只更新Status列条件是包含
/// </summary>
/// <param name="entity"></param>
/// <param name="expression"></param>
/// <param name="where"></param>
/// <returns></returns>
public int Update(T entity, Expression<Func<T, object>> expression, Expression<Func<T, bool>> where)
{
return Context.Updateable(entity).UpdateColumns(expression).Where(where).ExecuteCommand();
@ -169,6 +176,13 @@ namespace ZR.Repository
// });
// return result.IsSuccess;
//}
/// <summary>
/// 更新指定列 egUpdate(w => w.NoticeId == model.NoticeId, it => new SysNotice(){ Update_time = DateTime.Now, Title = "通知标题" });
/// </summary>
/// <param name="where"></param>
/// <param name="columns"></param>
/// <returns></returns>
public int Update(Expression<Func<T, bool>> where, Expression<Func<T, T>> columns)
{
return Context.Updateable<T>().SetColumns(columns).Where(where).RemoveDataCache().ExecuteCommand();

View File

@ -132,6 +132,13 @@ namespace ZR.Service
return baseRepository.Update(entity, expression, ignoreAllNull);
}
/// <summary>
/// 根据实体类更新 egUpdate(dept, it => new { it.Status }, f => depts.Contains(f.DeptId));只更新Status列条件是包含
/// </summary>
/// <param name="entity"></param>
/// <param name="expression"></param>
/// <param name="where"></param>
/// <returns></returns>
public int Update(T entity, Expression<Func<T, object>> expression, Expression<Func<T, bool>> where)
{
return baseRepository.Update(entity, expression, where);
@ -171,6 +178,13 @@ namespace ZR.Service
// });
// return result.IsSuccess;
//}
/// <summary>
/// 更新指定列 egUpdate(w => w.NoticeId == model.NoticeId, it => new SysNotice(){ Update_time = DateTime.Now, Title = "通知标题" });
/// </summary>
/// <param name="where"></param>
/// <param name="columns"></param>
/// <returns></returns>
public int Update(Expression<Func<T, bool>> where, Expression<Func<T, T>> columns)
{
return baseRepository.Update(where, columns);