/// <summary> /// 创建实体 /// </summary> /// <param name="input"></param> /// <returns></returns> protected virtual async Task CreateMenuAppAsync(CreateOrUpdateMenuAppInput input) { var menuApp = input.MenuApp.MapTo<AuthorityMenuAppInfo>(); menuApp.CreatorUserId = YLSession.UserId; menuApp.CreatorUserName = ""; menuApp.CreationTime = Clock.Now; await _menuAppRepository.InsertAsync(menuApp); cacheHandler.Remove(CacheCategoryMenuApp, "GetMenuAppList"); }
/// <summary> /// 修改实体 /// </summary> /// <param name="input"></param> /// <returns></returns> protected virtual async Task UpdateMenuAppAsync(CreateOrUpdateMenuAppInput input) { Debug.Assert(input.MenuApp.Id != null, "input.MenuApp.Id should be set."); var menuApp = await _menuAppRepository.GetAsync(input.MenuApp.Id); menuApp = input.MenuApp.MapTo<AuthorityMenuAppInfo>(); menuApp.LastModifierUserId = YLSession.UserId; menuApp.LastModifierUserName = ""; menuApp.LastModificationTime = Clock.Now; await _menuAppRepository.UpdateAsync(menuApp); cacheHandler.Remove(CacheCategoryMenuApp, "GetMenuAppList"); }
/// <summary> /// 添加修改实体 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task CreateOrUpdateMenuApp(CreateOrUpdateMenuAppInput input) { if (input.MenuApp.Id != null && input.MenuApp.Id != Guid.Empty) { await UpdateMenuAppAsync(input); } else { await CreateMenuAppAsync(input); } }