From 5a149d626ae8bc3fa4bddbb53f8caf40f51f6da6 Mon Sep 17 00:00:00 2001 From: zs <zhousong@weben-smart.com> Date: 周三, 04 6月 2025 17:42:13 +0800 Subject: [PATCH] Merge branch 'master' of http://222.71.245.114:9086/r/HIA24016N_PipeLineDemo --- Weben_CMS专用代码生成器/Code/Templete/AppService/AppService模板.txt | 78 ++++++++++++++++++++++++++++++-------- 1 files changed, 61 insertions(+), 17 deletions(-) diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/AppService/AppService\346\250\241\346\235\277.txt" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/AppService/AppService\346\250\241\346\235\277.txt" index 2a60352..789e804 100644 --- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/AppService/AppService\346\250\241\346\235\277.txt" +++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/AppService/AppService\346\250\241\346\235\277.txt" @@ -1,16 +1,15 @@ 锘縰sing 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; @@ -145,7 +144,8 @@ updateObj.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp); input.MapExtraPropertiesTo(updateObj, MappingPropertyDefinitionChecks.None); - $UpdateAttributes$ + // 鎵归噺璧嬪�兼墍鏈夊彲鏄犲皠瀛楁锛堥�氳繃鍖垮悕瀵硅薄锛� + updateObj = ObjectMapper.Map(input, updateObj); // 绛夋晥浜庢墜鍔ㄨ祴鍊兼墍鏈夊尮閰嶅瓧娈� updateObj.LastModifierName = input.LastModifierName;//淇敼浜� @@ -288,7 +288,7 @@ 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()) @@ -322,20 +322,13 @@ 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)); } } @@ -362,7 +355,7 @@ 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) { @@ -441,4 +434,55 @@ { return await _$EntityInstanceName$Repository.GetSingleByFilterAsync(whereConditions, is鈥婱ultipleThrowException); } + + /// <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)); + } } -- Gitblit v1.9.3