fix:merge

This commit is contained in:
PZ688 2025-02-27 17:18:26 +08:00
commit ea26ff8f04
8 changed files with 58 additions and 42 deletions

View File

@ -20,9 +20,9 @@
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
<PackageReference Include="BouncyCastle.Cryptography" Version="2.5.1" Aliases="BouncyCastleV2" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.17.1" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.7.13" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.7.13" />
<PackageReference Include="Furion.Pure" Version="4.9.7.13" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.7.15" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.7.15" />
<PackageReference Include="Furion.Pure" Version="4.9.7.15" />
<PackageReference Include="Hardware.Info" Version="101.0.1" />
<PackageReference Include="Hashids.net" Version="1.7.0" />
<PackageReference Include="IPTools.China" Version="1.6.0" />
@ -40,15 +40,15 @@
<PackageReference Include="Novell.Directory.Ldap.NETStandard" Version="3.6.0" />
<PackageReference Include="OnceMi.AspNetCore.OSS" Version="1.2.0" />
<PackageReference Include="QRCoder" Version="1.6.0" />
<PackageReference Include="RabbitMQ.Client" Version="7.1.0" />
<PackageReference Include="RabbitMQ.Client" Version="7.1.1" />
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.3" />
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.7.0" />
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.10.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.178" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.179" />
<PackageReference Include="SSH.NET" Version="2024.2.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.0.2" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1186" />
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1188" />
<PackageReference Include="UAParser" Version="3.1.47" />
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
</ItemGroup>

View File

@ -110,9 +110,9 @@ public partial class SysCodeGenConfig : EntityBase
public string? DictTypeCode { get; set; }
/// <summary>
/// 列表是否缩进(字典)
/// 是否缩进列表(字典)
/// </summary>
[SugarColumn(ColumnDescription = "列表是否缩进", Length = 8)]
[SugarColumn(ColumnDescription = "是否缩进列表", Length = 8)]
[MaxLength(8)]
public string? WhetherRetract { get; set; }
@ -136,10 +136,11 @@ public partial class SysCodeGenConfig : EntityBase
[SugarColumn(ColumnDescription = "是否是统计字段", Length = 8)]
[MaxLength(8)]
public string? Statistical { get; set; }
/// <summary>
/// 是否是GroupBy字段
/// 是否是分组字段
/// </summary>
[SugarColumn(ColumnDescription = "是否是GroupBy字段", Length = 8)]
[SugarColumn(ColumnDescription = "是否是分组字段", Length = 8)]
[MaxLength(8)]
public string? IsGroupBy { get; set; }

View File

@ -122,6 +122,7 @@ public class CodeGenConfig
/// 是否是统计字段
/// </summary>
public string Statistical { get; set; }
/// <summary>
/// 是否是GroupBy字段
/// </summary>

View File

@ -1,24 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
namespace Admin.NET.Core.Utils;
// 聚合配置增强版(独立类)
/// <summary>
/// 聚合配置增强版(独立类)
/// </summary>
public class AggregationBuilder
{
private readonly List<AggregationConfig> _configs;
private readonly Type _entityType;
private readonly Type _outputType;
public List<string> SelectParts { get; } = new();
public List<string> HavingConditions { get; } = new();
public List<string> SelectParts { get; } = [];
public List<string> HavingConditions { get; } = [];
public AggregationBuilder(
IEnumerable<AggregationConfig> configs,
Type entityType,
Type outputType)
public AggregationBuilder(IEnumerable<AggregationConfig> configs, Type entityType, Type outputType)
{
_configs = configs.ToList();
_entityType = entityType;
@ -55,10 +55,11 @@ public class AggregationBuilder
// 输出属性验证
return _outputType.GetProperty(config.Alias) != null;
}
/// <summary>
/// 验证聚合配置有效性
/// </summary>
private bool ValidateAggregation(AggregationConfig config, Type entityType, Type outputType)
private static bool ValidateAggregation(AggregationConfig config, Type entityType, Type outputType)
{
// 验证实体字段存在性
var entityProp = entityType.GetProperty(config.Field);
@ -88,24 +89,24 @@ public class AggregationBuilder
_ => false
};
}
/// <summary>
/// 验证字段有效性
/// </summary>
public static List<string> ValidateFields<T>(string[] fields, Type targetType)
{
if (fields == null || fields.Length == 0) return new List<string>();
if (fields == null || fields.Length == 0) return [];
return fields
.Where(f => !string.IsNullOrWhiteSpace(f))
.Select(f => f.Trim())
.Where(f => targetType.GetProperty(
targetType == typeof(T) ?
$"{f}Sum" : f) != null)
return fields.Where(u => !string.IsNullOrWhiteSpace(u))
.Select(u => u.Trim())
.Where(u => targetType.GetProperty(targetType == typeof(T) ? $"{u}Sum" : u) != null)
.ToList();
}
}
// 增强版聚合配置类
/// <summary>
/// 增强版聚合配置类
/// </summary>
public class AggregationConfig
{
/// <summary>
@ -126,13 +127,17 @@ public class AggregationConfig
/// <summary>
/// 输出字段别名必须与DTO属性名一致
/// </summary>
public required string Alias { get; set; }
public string Alias { get; set; }
/// <summary>
/// HAVING条件表达式如"> 100"
/// </summary>
public string HavingCondition { get; set; }
}
/// <summary>
/// 函数枚举
/// </summary>
public enum AggregateFunction
{
Sum,
@ -141,4 +146,4 @@ public enum AggregateFunction
Max,
Min,
// 可扩展其他函数
}
}

View File

@ -268,6 +268,7 @@ const state = reactive({
showAdvanceQueryUI: false,
queryParams: {
searchKey: undefined,
GroupBy: [] as any,
@if(Model.QueryWhetherList.Count > 0) {
@foreach (var column in Model.QueryWhetherList) {
@:@(@column.LowerPropertyName): undefined,
@ -350,7 +351,7 @@ const checkTableColumnVisible = (tableColumnName: any) => {
if (@column.Statistical == "Y"){
@: if (column.field === '@(@column.LowerPropertyName)') {
@: // 计算表格内总和
@: return `${data.reduce((sum, row) => sum + (row.@(@column.LowerPropertyName) || 0), 0)}/总数:${totalSum.@(@column.LowerPropertyName)}`
@: return `${data.reduce((sum, row) => sum + (row.@(@column.LowerPropertyName) || 0), 0)}/总数:${totalSum?.@(@column.LowerPropertyName)||0}`
@: }
}
}
@ -377,6 +378,9 @@ const checkTableColumnVisible = (tableColumnName: any) => {
return checkTableColumnVisible(`@Model.LowerClassName:${column.field}`);
},
},
@if(@Model.TableField.Any(x=>x.Statistical == "Y")||@Model.TableField.Any(x=>x.IsGroupBy == "Y")){
@:showFooter: true, // ✅ 正确控制表尾显示
}
}
);
@ -398,6 +402,12 @@ const handleQueryApi = async (page: VxeGridPropTypes.ProxyAjaxQueryPageParams, s
// 查询操作
const handleQuery = async (reset = false) => {
options.loading = true;
state.queryParams.GroupBy = [];
@foreach (var column in Model.TableField){
if (@column.IsGroupBy == "Y"){
@:state.queryParams.GroupBy.push('@(@column.PropertyName)');
}
}
@if(@Model.TableField.Any(x=>x.Statistical == "Y")){
@if (@Model.IsApiService) {
@:state.totalSum =getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)GetTotalSumPost(params).data.result;

View File

@ -2,7 +2,7 @@
"name": "admin.net.pro",
"type": "module",
"version": "2.4.33",
"lastBuildTime": "2025.02.25",
"lastBuildTime": "2025.02.27",
"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
"author": "zuohuaijun",
"license": "MIT",
@ -29,7 +29,7 @@
"@wangeditor/editor-for-vue": "^5.1.12",
"animate.css": "^4.1.1",
"async-validator": "^4.2.5",
"axios": "^1.7.9",
"axios": "^1.8.1",
"countup.js": "^2.8.0",
"cropperjs": "^1.6.2",
"crypto-js": "^4.2.0",
@ -49,8 +49,7 @@
"md-editor-v3": "^5.3.2",
"mitt": "^3.0.1",
"monaco-editor": "^0.52.2",
"mqtt": "^5.10.3",
"npm": "^11.1.0",
"mqtt": "^5.10.4",
"nprogress": "^0.2.0",
"ol": "^10.4.0",
"pinia": "^3.0.1",
@ -77,7 +76,7 @@
"vue-signature-pad": "^3.0.2",
"vue3-flag-icons": "^0.0.3",
"vue3-tree-org": "^4.2.2",
"vxe-pc-ui": "^4.3.95",
"vxe-pc-ui": "^4.3.98",
"vxe-table": "^4.10.0",
"vxe-table-plugin-element": "^4.0.4",
"vxe-table-plugin-export-xlsx": "^4.0.7",

View File

@ -21,7 +21,7 @@
<el-dropdown-item v-for="(value,key) in languageList" :key="key" :command="key" :disabled="state.disabledI18n === key">
<div class="flex items-center">
<div class="mr-2">
<FlagIcon :code="getCountryCode(key)" :size="24" />
<FlagIcon :code="getCountryCode(key)" :size="18" />
</div>
<div style="margin-left:10px;">
{{value}}

View File

@ -39,8 +39,8 @@
<vxe-switch v-model="row.statistical" open-label="是" close-label="否" :openValue="true" :closeValue="false"></vxe-switch>
</template>
<template #isGroupBy="{ row }">
<vxe-switch v-model="row.isGroupBy" open-label="是" close-label="否" :openValue="true" :closeValue="false"></vxe-switch>
</template>
<vxe-switch v-model="row.isGroupBy" open-label="是" close-label="否" :openValue="true" :closeValue="false"></vxe-switch>
</template>
<template #queryWhether="{ row }">
<vxe-switch v-model="row.queryWhether" open-label="是" close-label="否" :openValue="true" :closeValue="false"></vxe-switch>
</template>