using System; using System.Linq.Expressions; namespace Mtxfw.Utility.DataAccess { /// /// 删除类 /// public partial class Sql : DbHelperSqlSugar { /// /// 根据实体类删除数据 /// /// 实体类名称 /// 实体类 /// public int Del(T entity) where T : class, new() { return Db.Deleteable(entity).ExecuteCommand(); } /// /// 根据主键删除数据 /// /// 实体类名称 /// 主键 /// public int Del(int keyValue) where T : class, new() { return Db.Deleteable(keyValue).ExecuteCommand(); } /// /// 根据主键批量删除 /// /// 实体类名称 /// 主键集合 /// public int Del(object[] keyValues) where T : class, new() { return Db.Deleteable(keyValues).ExecuteCommand(); } /// /// 根据条件删除 /// /// 实体类名称 /// linq 条件 -> (t => t.id == 1 && t.name == "aaaa") /// public int Del(Expression> predicate) where T : class, new() { return Db.Deleteable(predicate).ExecuteCommand(); } } }