From bd5c3cb9161c8365b319705f55157b1a444dfb2c Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周日, 18 5月 2025 10:07:27 +0800 Subject: [PATCH] 增加方法 --- Weben_CMS专用代码生成器/Code/Templete/AppService/IAppService模板.txt | 14 +++++++ Weben_CMS专用代码生成器/Code/Templete/AppService/AppService模板.txt | 51 +++++++++++++++++++++++++ Weben_CMS专用代码生成器/Code/Templete/Controller模板.txt | 24 ++++++++++++ 3 files changed, 89 insertions(+), 0 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..03b02e3 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" @@ -441,4 +441,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)); + } } 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/IAppService\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/IAppService\346\250\241\346\235\277.txt" index 6ed0b79..972c752 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/IAppService\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/IAppService\346\250\241\346\235\277.txt" @@ -82,4 +82,18 @@ /// <returns></returns> /// <exception cref="UserFriendlyException"></exception> Task<$EntityName$> GetSingleByFilterAsync(Expression<Func<$EntityName$, bool>> whereConditions, bool is鈥婱ultipleThrowException = false, CancellationToken cancellationToken = default); + + /// <summary> + /// 鏍规嵁鏉′欢鑾峰彇$ChinaComment$鍒楄〃 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + Task<List<$EntityName$Dto>> FindListByFilterAsync(Get$EntityName$Input input, CancellationToken cancellationToken = default); + + /// <summary> + /// 鏍规嵁鏉′欢鑾峰彇鍗曚釜$ChinaComment$ + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + Task<$EntityName$Dto> FindSingleByFilterAsync(Get$EntityName$Input input, CancellationToken cancellationToken = default); } 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/Controller\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/Controller\346\250\241\346\235\277.txt" index 59f98c4..ec1e4eb 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/Controller\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/Controller\346\250\241\346\235\277.txt" @@ -62,6 +62,30 @@ return _$EntityInstanceName$AppService.GetListAsync(input); } + /// <summary> + /// 根据条件获取$ChinaComment$ + /// </summary> + /// <param name="input">查询参数</param> + /// <returns></returns> + [HttpPost] + [Route("FindListByFilter")] + public virtual async Task<List<$EntityName$Dto>> FindListByFilterAsync(Get$EntityName$Input input) + { + return await _$EntityInstanceName$AppService.FindListByFilterAsync(input); + } + /// <summary> + /// 根据条件获取单个$ChinaComment$ + /// </summary> + /// <param name="input">查询参数</param> + /// <returns></returns> + [HttpPost] + [Route("FindSingleByFilter")] + public virtual async Task<$EntityName$Dto> FindSingleByFilterAsync(Get$EntityName$Input input) + { + + return await _$EntityInstanceName$AppService.FindSingleByFilterAsync(input); + } + /// <summary> /// 创建$ChinaComment$ /// </summary> -- Gitblit v1.9.3