diff --git a/ZR.Repository/BaseRepository.cs b/ZR.Repository/BaseRepository.cs index 577acd5..ad82256 100644 --- a/ZR.Repository/BaseRepository.cs +++ b/ZR.Repository/BaseRepository.cs @@ -61,11 +61,11 @@ namespace ZR.Repository #endregion add #region update - public IUpdateable Updateable(T entity) - { - return Context.Updateable(entity); - } - + //public IUpdateable Updateable(T entity) + //{ + // return Context.Updateable(entity); + //} + /// /// 实体根据主键更新 /// @@ -103,37 +103,6 @@ namespace ZR.Repository return Context.Updateable(entity).UpdateColumns(expression).Where(where).ExecuteCommand(); } - public int Update(SqlSugarClient client, T entity, Expression> expression, Expression> where) - { - return client.Updateable(entity).UpdateColumns(expression).Where(where).ExecuteCommand(); - } - - /// - /// - /// - /// - /// - /// 默认为true - /// - public int Update(T entity, List list = null, bool isNull = true) - { - list ??= new List() - { - "Create_By", - "Create_time" - }; - return Context.Updateable(entity).IgnoreColumns(isNull).IgnoreColumns(list.ToArray()).ExecuteCommand(); - } - - //public bool Update(List entity) - //{ - // var result = base.Context.Ado.UseTran(() => - // { - // base.Context.Updateable(entity).ExecuteCommand(); - // }); - // return result.IsSuccess; - //} - /// /// 更新指定列 eg:Update(w => w.NoticeId == model.NoticeId, it => new SysNotice(){ Update_time = DateTime.Now, Title = "通知标题" }); /// @@ -160,14 +129,6 @@ namespace ZR.Repository throw; } } - public IStorageable Storageable(T t) - { - return Context.Storageable(t); - } - public IStorageable Storageable(List t) - { - return Context.Storageable(t); - } /// /// diff --git a/ZR.Repository/IBaseRepository.cs b/ZR.Repository/IBaseRepository.cs index 697fa1f..1e0f204 100644 --- a/ZR.Repository/IBaseRepository.cs +++ b/ZR.Repository/IBaseRepository.cs @@ -19,7 +19,6 @@ namespace ZR.Repository #endregion add #region update - IUpdateable Updateable(T entity); int Update(T entity, bool ignoreNullColumns = false); /// @@ -32,13 +31,9 @@ namespace ZR.Repository int Update(T entity, Expression> expression, Expression> where); - int Update(SqlSugarClient client, T entity, Expression> expression, Expression> where); - int Update(Expression> where, Expression> columns); #endregion update - IStorageable Storageable(T t); - IStorageable Storageable(List t); DbResult UseTran(Action action); DbResult UseTran(SqlSugarClient client, Action action); diff --git a/ZR.Service/BaseService.cs b/ZR.Service/BaseService.cs index 40faca2..94a06b4 100644 --- a/ZR.Service/BaseService.cs +++ b/ZR.Service/BaseService.cs @@ -8,11 +8,5 @@ namespace ZR.Service /// public class BaseService : BaseRepository where T : class, new() { - //public IBaseRepository baseRepository; - - //public BaseService(IBaseRepository repository) - //{ - // this.baseRepository = repository ?? throw new ArgumentNullException(nameof(repository)); - //} } } diff --git a/ZR.Service/System/CommonLangService.cs b/ZR.Service/System/CommonLangService.cs index 21d8fec..c4660b3 100644 --- a/ZR.Service/System/CommonLangService.cs +++ b/ZR.Service/System/CommonLangService.cs @@ -82,7 +82,7 @@ namespace ZR.Service.System LangName = item.LangName, }); } - var storage = Storageable(langs) + var storage = Context.Storageable(langs) .WhereColumns(it => new { it.LangKey, it.LangCode }) .ToStorage(); @@ -110,7 +110,7 @@ namespace ZR.Service.System /// public (string, object, object) ImportCommonLang(List list) { - var x = Storageable(list) + var x = Context.Storageable(list) .WhereColumns(it => new { it.LangKey, it.LangCode }) .ToStorage(); x.AsInsertable.ExecuteReturnSnowflakeIdList();//插入可插入部分; diff --git a/ZR.Service/System/SysMenuService.cs b/ZR.Service/System/SysMenuService.cs index fbf84c2..ee7369c 100644 --- a/ZR.Service/System/SysMenuService.cs +++ b/ZR.Service/System/SysMenuService.cs @@ -700,7 +700,7 @@ namespace ZR.Service } //Insert(menuList); - var x = Storageable(menuList) + var x = Context.Storageable(menuList) .SplitInsert(it => !it.Any()) .SplitUpdate(it => !it.Any()) .WhereColumns(it => new { it.MenuName, it.ParentId }) diff --git a/ZR.Service/System/SysUserPostService.cs b/ZR.Service/System/SysUserPostService.cs index 9785944..110328a 100644 --- a/ZR.Service/System/SysUserPostService.cs +++ b/ZR.Service/System/SysUserPostService.cs @@ -1,6 +1,5 @@ using Infrastructure.Attribute; using SqlSugar; -using System.Collections.Generic; using System.Linq; using ZR.Model.System; using ZR.Service.System.IService; @@ -20,15 +19,14 @@ namespace ZR.Service.System public void InsertUserPost(SysUser user) { // 新增用户与岗位管理 - List list = new List(); + List list = new(); foreach (var item in user.PostIds) { list.Add(new SysUserPost() { PostId = item, UserId = user.UserId }); } - Insert(list); + InsertRange(list); } - /// /// 查询用户岗位集合 ///