From 9ef3caf1d598db4d819fca49aa6c44f505bbce02 Mon Sep 17 00:00:00 2001
From: kunkkawu <kunkkawu.com@tencent.com>
Date: Tue, 23 Jul 2024 10:59:42 +0800
Subject: [PATCH] fix kingbase support
remove ` for asset list
---
etc/registration-service.yaml | 5 +++--
internal/event/event.go | 1 -
internal/logic/assetlistlogic.go | 6 +++---
internal/model/asset_certification.go | 2 +-
internal/model/asset_data_set_column.go | 8 ++++----
5 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/etc/registration-service.yaml b/etc/registration-service.yaml
index 217a893..b71f9be 100644
--- a/etc/registration-service.yaml
+++ b/etc/registration-service.yaml
@@ -72,12 +72,13 @@ GrpcServerConf:
# 鏁版嵁搴撻厤缃�
DBConf:
# 鏁版嵁搴撶被鍨嬶紝鏀寔锛歮ysql銆乲ingbase_mysql銆乲ingbase_pgsql銆乸ostgres
- Type: "mysql"
+ Type: "kingbase_pgsql"
# 鏁版嵁搴撹繛鎺ュ瓧绗︿覆
- DNS: root:root123456@tcp(192.168.1.135:3306)/registration_service?charset=utf8&parseTime=true&loc=Asia%2FShanghai
+# DNS: root:root123456@tcp(192.168.1.135:3306)/registration_service?charset=utf8&parseTime=true&loc=Asia%2FShanghai
#DNS: root:root123456@tcp(192.168.1.135:3306)/ida1?charset=utf8&parseTime=true&loc=Asia%2FShanghai
#DNS: root:@tcp(127.0.0.1:3306)/registration-service?charset=utf8&parseTime=true&loc=Asia%2FShanghai
#DNS: root:root123456@tcp(192.168.40.22:32006)/registration_service?charset=utf8&parseTime=true&loc=Asia%2FShanghai
+ DNS: host=192.168.1.135 port=54321 user=kingbase password=123456 dbname=registration_service sslmode=disable client_encoding=UTF8 TimeZone=Asia/Shanghai
# redis 缂撳瓨閰嶇疆锛屼富瑕佹寚瀹氳闂湴鍧€锛屽叾浠栭厤缃」榛樿鍗冲彲
Cache:
diff --git a/internal/event/event.go b/internal/event/event.go
index 24c3ddc..c48849b 100644
--- a/internal/event/event.go
+++ b/internal/event/event.go
@@ -26,7 +26,6 @@ import (
)
var (
-
// defaultGroupName 璁㈤槄缁勪俊鎭�
defaultGroupName = "registration" // 娉ㄥ唽涓績
// consumer 娑堣垂鑰�
diff --git a/internal/logic/assetlistlogic.go b/internal/logic/assetlistlogic.go
index 88d42eb..679eef0 100644
--- a/internal/logic/assetlistlogic.go
+++ b/internal/logic/assetlistlogic.go
@@ -89,10 +89,10 @@ func (l *AssetListLogic) AssetList(in *registrationpb.AssetListReq) (*registrati
sql1 := fmt.Sprintf("SELECT asset_id from asset_chain_info where "+
" deleted_at is NULL and asset_id not in(%s) group by asset_chain_info.asset_id", sub1)
// 鏌ヨ褰撳墠閾剧殑璧勪骇
- sql2 := fmt.Sprintf("SELECT *,2 as sort_order FROM `asset` WHERE asset.platform = %d "+
- "AND `asset`.`deleted_at` IS NULL and asset.id in (%s) %s ", model.PlatformLocal, sub2, whereClause)
+ sql2 := fmt.Sprintf("SELECT *,2 as sort_order FROM asset WHERE asset.platform = %d "+
+ "AND asset.deleted_at IS NULL and asset.id in (%s) %s ", model.PlatformLocal, sub2, whereClause)
- sql := fmt.Sprintf("SELECT *,1 as sort_order FROM `asset` WHERE platform = %d %s "+
+ sql := fmt.Sprintf("SELECT *,1 as sort_order FROM asset WHERE platform = %d %s "+
"AND deleted_at IS NULL and asset.id in(%s) UNION ALL %s order by sort_order asc, created_at desc "+
"LIMIT %d OFFSET %d", model.PlatformLocal, whereClause, sql1, sql2, int(in.PageSize), offset)
db.Raw(sql).Scan(&assetList)
diff --git a/internal/model/asset_certification.go b/internal/model/asset_certification.go
index 9361b09..d85ba78 100644
--- a/internal/model/asset_certification.go
+++ b/internal/model/asset_certification.go
@@ -26,7 +26,7 @@ const (
// nolint
type AssetCertification struct {
Id uint `gorm:"column:id;primary_key;AUTO_INCREMENT" json:"id"`
- AssetId int32 `gorm:"column:asset_id;type:varchar(120);comment:璧勪骇鑷id" json:"asset_id"`
+ AssetId int32 `gorm:"column:asset_id;comment:璧勪骇鑷id" json:"asset_id"`
ChainInfoId int32 `gorm:"column:chain_info_id;comment:閾句俊鎭痠d" json:"chain_info_id"`
EnterpriseId int32 `gorm:"column:enterprise_id;comment:璁よ瘉浼佷笟ID" json:"enterprise_id"`
EnterpriseType int32 `gorm:"column:enterprise_type;comment:浼佷笟绫诲瀷锛� 1鍚堣璁よ瘉锛�2浠峰€艰瘎浼�" json:"enterprise_type"`
diff --git a/internal/model/asset_data_set_column.go b/internal/model/asset_data_set_column.go
index d521463..2a382d3 100644
--- a/internal/model/asset_data_set_column.go
+++ b/internal/model/asset_data_set_column.go
@@ -19,18 +19,18 @@ import (
type AssetDataSetColumn struct {
Id uint `gorm:"column:id;primary_key;AUTO_INCREMENT" json:"id"`
DataSetId int32 `gorm:"column:data_set_id" json:"data_set_id"`
- AssetId int32 `gorm:"column:asset_id;type:varchar(20);comment:璧勪骇id;NOT NULL" json:"asset_id"`
+ AssetId int32 `gorm:"column:asset_id;comment:璧勪骇id;NOT NULL" json:"asset_id"`
Name string `gorm:"column:name;type:varchar(128);comment:鏁版嵁椤瑰瓧娈靛悕绉�;NOT NULL" json:"name"`
OriginalName string `gorm:"column:original_name;type:varchar(128);comment:鍘熷鏁版嵁椤瑰瓧娈靛悕绉�" json:"original_name"`
SecurityLevel int32 `gorm:"column:security_level;comment:鍒嗙骇鍒嗙被:1 涓€绾э紝2浜岀骇锛�3涓夌骇" json:"security_level"`
DataType string `gorm:"column:data_type;type:varchar(20);comment:鏁版嵁绫诲瀷;NOT NULL" json:"data_type"`
DataLength int32 `gorm:"column:data_length;comment:鏁版嵁闀垮害;NOT NULL" json:"data_length"`
- Description string `gorm:"column:description;type:varchar(50);comment:瀛楁鎻忚堪;NOT NULL" json:"description"`
- IsPrimaryKey int32 `gorm:"column:is_primary_key;default:0;comment:鏄惁涓婚敭: 1鏄紝0鍚�;NOT NULL" json:"is_primary_key"`
+ Description string `gorm:"column:description;type:varchar(50);comment:瀛楁鎻忚堪" json:"description"`
+ IsPrimaryKey int32 `gorm:"column:is_primary_key;default:0;comment:鏄惁涓婚敭: 1鏄紝0鍚�" json:"is_primary_key"`
IsNotNull int32 `gorm:"column:is_not_null;default:0;comment:鏄惁涓虹┖锛�1鏄紝0鍚�;NOT NULL" json:"is_not_null"`
PrivacyQuery int32 `gorm:"column:privacy_query;default:1;comment:鏄惁闅愮鏌ヨ锛�1鏄紝0鍚�;NOT NULL" json:"privacy_query"`
DataExample string `gorm:"column:data_example;type:varchar(255);comment:鏁版嵁鏍蜂緥" json:"data_example"`
- CustomColumn string `gorm:"column:custom_column;type:varchar(500);comment:涓€у寲瀛楁" json:"custom_column"`
+ CustomColumn string `gorm:"column:custom_column;type:varchar(4096);comment:涓€у寲瀛楁" json:"custom_column"`
CreatedAt time.Time `gorm:"column:created_at;comment:鍒涘缓鏃堕棿" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;comment:鏇存柊鏃堕棿" json:"updated_at"`
}
--
GitLab