| | |
| | | using CMS.Plugin.$NameSpacePath$.Application.Contracts.Dtos.$EntityName$; |
| | | using CMS.Plugin.$NameSpacePath$.Application.Contracts.Services; |
| | | using CMS.Plugin.$NameSpacePath$.Domain.Shared; |
| | | using CmsQueryExtensions; |
| | | using CMS.Plugin.$NameSpacePath$.Domain.$EntityName$; |
| | | using CmsQueryExtensions; |
| | | using CmsQueryExtensions.Entitys; |
| | | using CmsQueryExtensions.Extension; |
| | | using System.Linq.Expressions; |
| | | using Volo.Abp; |
| | | using Volo.Abp.Application.Dtos; |
| | | using Volo.Abp.Data; |
| | | using Volo.Abp.ObjectExtending; |
| | | using Volo.Abp.ObjectMapping; |
| | | using CmsQueryExtensions.Entitys; |
| | | |
| | | namespace CMS.Plugin.$NameSpacePath$.Application.Implements; |
| | | |
| | |
| | | updateObj.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp); |
| | | input.MapExtraPropertiesTo(updateObj, MappingPropertyDefinitionChecks.None); |
| | | |
| | | $UpdateAttributes$ |
| | | // æ¹éèµå¼ææå¯æ å°å段ï¼éè¿å¿åå¯¹è±¡ï¼ |
| | | updateObj = ObjectMapper.Map(input, updateObj); // çæäºæå¨èµå¼ææå¹é
åæ®µ |
| | | |
| | | updateObj.LastModifierName = input.LastModifierName;//ä¿®æ¹äºº |
| | | |
| | |
| | | Check.NotNull(input, nameof(input)); |
| | | |
| | | var $EntityInstanceName$CreateDtos = new List<(int RowIndex, $EntityName$CreateDto Item)>(); |
| | | var $EntityInstanceName$UpdateDtos = new List<(int RowIndex, Guid Id, $EntityName$UpdateDto Item)>(); |
| | | var $EntityInstanceName$UpdateDtos = new List<(int RowIndex, Guid Id, $EntityName$ Item)>(); |
| | | var importItems = input.$EntityName$s; |
| | | |
| | | if (importItems != null && importItems.Any()) |
| | |
| | | var old$EntityName$ = await _$EntityInstanceName$Repository.FindByNameAsync(impItem.$ValidateRepeatName$); |
| | | if (old$EntityName$ != null) |
| | | { |
| | | var $EntityInstanceName$UpdateDto = new $EntityName$UpdateDto |
| | | { |
| | | $AppService_ImportAsync$ |
| | | }; |
| | | |
| | | $EntityInstanceName$UpdateDtos.Add((impItem.RowIndex, old$EntityName$.Id, $EntityInstanceName$UpdateDto)); |
| | | old$EntityName$ = ObjectMapper.Map(impItem, old$EntityName$); // çæäºæå¨èµå¼ææå¹é
åæ®µ |
| | | $EntityInstanceName$UpdateDtos.Add((impItem.RowIndex, old$EntityName$.Id, old$EntityName$)); |
| | | } |
| | | else |
| | | { |
| | | var $EntityInstanceName$CreateDto = new $EntityName$CreateDto |
| | | { |
| | | $AppService_ImportAsync$ |
| | | }; |
| | | |
| | | var $EntityInstanceName$CreateDto = new $EntityName$CreateDto { }; |
| | | $EntityInstanceName$CreateDto = ObjectMapper.Map(impItem, $EntityInstanceName$CreateDto); // çæäºæå¨èµå¼ææå¹é
åæ®µ |
| | | $EntityInstanceName$CreateDtos.Add((impItem.RowIndex, $EntityInstanceName$CreateDto)); |
| | | } |
| | | } |
| | |
| | | try |
| | | { |
| | | $EntityInstanceName$Dto.Item.LastModifierName = myCurrentUser.UserAccount;//ä¿®æ¹äºº |
| | | await UpdateAsync($EntityInstanceName$Dto.Id, $EntityInstanceName$Dto.Item); |
| | | await _$EntityInstanceName$Repository.UpdateAsync($EntityInstanceName$Dto.Item); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | { |
| | | return await _$EntityInstanceName$Repository.GetSingleByFilterAsync(whereConditions, isâMultipleThrowException); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®æ¡ä»¶è·å$ChinaComment$å表 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public virtual async Task<List<$EntityName$Dto>> FindListByFilterAsync(Get$EntityName$Input input, CancellationToken cancellationToken = default) |
| | | { |
| | | Check.NotNull(input, nameof(input)); |
| | | |
| | | if (input.Sorting.IsNullOrWhiteSpace()) |
| | | { |
| | | input.Sorting = nameof($EntityName$.Sort); |
| | | } |
| | | |
| | | #region 卿æé æ¥è¯¢æ¡ä»¶ |
| | | |
| | | //卿æé æ¥è¯¢æ¡ä»¶ |
| | | var whereConditions = DynamicGetQueryParams(input); |
| | | |
| | | #endregion |
| | | |
| | | var list = await _$EntityInstanceName$Repository.GetListByFilterAsync(whereConditions?.data); |
| | | |
| | | return new List<$EntityName$Dto>(ObjectMapper.Map<List<$EntityName$>, List<$EntityName$Dto>>(list)); |
| | | } |
| | | /// <summary> |
| | | /// æ ¹æ®æ¡ä»¶è·åå个$ChinaComment$ |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public virtual async Task<$EntityName$Dto> FindSingleByFilterAsync(Get$EntityName$Input input, CancellationToken cancellationToken = default) |
| | | { |
| | | Check.NotNull(input, nameof(input)); |
| | | |
| | | if (input.Sorting.IsNullOrWhiteSpace()) |
| | | { |
| | | input.Sorting = nameof($EntityName$.Sort); |
| | | } |
| | | |
| | | #region 卿æé æ¥è¯¢æ¡ä»¶ |
| | | |
| | | //卿æé æ¥è¯¢æ¡ä»¶ |
| | | var whereConditions = DynamicGetQueryParams(input); |
| | | |
| | | #endregion |
| | | |
| | | var dataObj = await _$EntityInstanceName$Repository.GetSingleByFilterAsync(whereConditions?.data); |
| | | |
| | | return (ObjectMapper.Map<$EntityName$, $EntityName$Dto>(dataObj)); |
| | | } |
| | | } |