/// <summary> /// 移除实体-逻辑删除 /// </summary> /// <param name="entity">实体对象</param> /// <param name="user">操作人</param> /// <returns></returns> public virtual Result Remove(T entity, AppUser user, Action <int> Cb = null) { var error = ValidateDelete(entity, user); if (!string.IsNullOrWhiteSpace(error)) { return(ResultUtil.AuthFail(error)); } var row = db.Update <T>(KeyValuePairs.New() .Add("IsDel", true) .Add("Updator", user.Name) .Add("UpdateAt", DateTime.Now), MySearchUtil.New().AndEqual("Id", entity.Id)); Cb?.Invoke(row); if (row > 0) { return(ResultUtil.Success()); } else { return(ResultUtil.Fail()); } }