From 35300b9c436a864f59df93189c02cc567e4b7771 Mon Sep 17 00:00:00 2001 From: yubaolee Date: Wed, 22 Oct 2025 22:46:25 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#ID31JE=20postgreSql=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenAuth.App/DbExtension.cs | 44 ++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/OpenAuth.App/DbExtension.cs b/OpenAuth.App/DbExtension.cs index 141c2053..1d0fec27 100644 --- a/OpenAuth.App/DbExtension.cs +++ b/OpenAuth.App/DbExtension.cs @@ -212,21 +212,35 @@ namespace OpenAuth.App , case when con.conname is not null then 1 else 0 end as iskey --是否主键 , case when attr.attnotnull is true then 0 else 1 end as isnull --可空 , t.typname columntype --类型名称 - , case - when typname in ('BIT', 'BOOL', 'bit', 'bool') then - 'bool' - when typname in ('smallint', 'SMALLINT') then 'short' - when typname in ('tinyint', 'TINYINT') then 'bool' - when typname in ('int4', 'int', 'INT') then - 'int' - when typname in ('BIGINT', 'bigint') then - 'bigint' - when typname in ('FLOAT', 'DOUBLE', 'DECIMAL', 'float', 'double', 'decimal') then - 'decimal' - when typname in ('varchar', 'text') then - 'string' - when typname in ('Date', 'DateTime', 'TimeStamp', 'date', 'datetime', 'timestamp') then - 'DateTime' + ,case + -- 布尔类型 + when typname in ('bit', 'bool', 'boolean') then 'bool' + + -- 整数类型 + when typname in ('int2', 'smallint') then 'short' + when typname in ('int4', 'int', 'integer') then 'int' + when typname in ('int8', 'bigint') then 'bigint' + + -- 浮点数类型 + when typname in ('real', 'float4') then 'float' + when typname in ('float8', 'double precision') then 'double' + when typname in ('numeric', 'decimal') then 'decimal' + + -- 字符串类型 + when typname in ('char', 'bpchar', 'character') then 'string' + when typname in ('varchar', 'character varying') then 'string' + when typname in ('text') then 'string' + + -- 日期时间类型 + when typname in ('time', 'timetz') then 'TimeSpan' + when typname in ('timestamp', 'timestamptz', 'datetime','date') then 'DateTime' + when typname in ('interval') then 'TimeSpan' + + -- 其他类型 + when typname in ('uuid') then 'Guid' + when typname in ('bytea') then 'byte[]' + when typname in ('json', 'jsonb') then 'string' + else 'string' end as entitytype , comment.description as comment