Browse Source

Update .net

pull/12/head
sunkaixuna 3 years ago
parent
commit
d8c4ff2395
  1. 25
      Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/LogicDeleteProvider.cs

25
Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/LogicDeleteProvider.cs

@ -10,27 +10,42 @@ namespace SqlSugar
{ {
public DeleteableProvider<T> Deleteable { get; set; } public DeleteableProvider<T> Deleteable { get; set; }
public DeleteBuilder DeleteBuilder { get; set; } public DeleteBuilder DeleteBuilder { get; set; }
public int ExecuteCommand(string LogicFieldName = null,object deleteValue=null,string deleteTimeFieldName = null)
public int ExecuteCommand(string LogicFieldName = null)
{ {
ISqlSugarClient db; ISqlSugarClient db;
List<SugarParameter> pars; List<SugarParameter> pars;
string where; string where;
LogicFieldName = _ExecuteCommand(LogicFieldName, out db, out where, out pars); LogicFieldName = _ExecuteCommand(LogicFieldName, out db, out where, out pars);
var updateable = db.Updateable<T>().SetColumns(LogicFieldName,true); if (deleteValue == null)
{
deleteValue = true;
}
var updateable = db.Updateable<T>().SetColumns(LogicFieldName, deleteValue);
if (deleteTimeFieldName != null)
{
updateable.SetColumns(deleteTimeFieldName, DateTime.Now);
}
if (pars != null) if (pars != null)
updateable.UpdateBuilder.Parameters.AddRange(pars); updateable.UpdateBuilder.Parameters.AddRange(pars);
Convert(updateable as UpdateableProvider<T>); Convert(updateable as UpdateableProvider<T>);
var result = updateable.Where(where).ExecuteCommand(); var result = updateable.Where(where).ExecuteCommand();
return result; return result;
} }
public async Task<int> ExecuteCommandAsync(string LogicFieldName = null) public async Task<int> ExecuteCommandAsync(string LogicFieldName = null, object deleteValue = null, string deleteTimeFieldName = null)
{ {
ISqlSugarClient db; ISqlSugarClient db;
List<SugarParameter> pars; List<SugarParameter> pars;
string where; string where;
LogicFieldName = _ExecuteCommand(LogicFieldName, out db, out where, out pars); LogicFieldName = _ExecuteCommand(LogicFieldName, out db, out where, out pars);
var updateable = db.Updateable<T>().SetColumns(LogicFieldName, true); if (deleteValue == null)
{
deleteValue = true;
}
var updateable = db.Updateable<T>().SetColumns(LogicFieldName, deleteValue);
if (deleteTimeFieldName != null)
{
updateable.SetColumns(deleteTimeFieldName, DateTime.Now);
}
if (pars != null) if (pars != null)
updateable.UpdateBuilder.Parameters.AddRange(pars); updateable.UpdateBuilder.Parameters.AddRange(pars);
Convert(updateable as UpdateableProvider<T>); Convert(updateable as UpdateableProvider<T>);

Loading…
Cancel
Save