From 8f0cecc57c0b34e6d74ab689e219979c90c8a41e Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 24 Apr 2026 03:37:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=B5=84=E4=BA=A7=20?= =?UTF-8?q?alias=20=E5=92=8C=20groupId=20=E5=AD=97=E6=AE=B5=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/model/asset.go | 5 +++++ server/repository/asset.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/server/model/asset.go b/server/model/asset.go index 46e5c6880..f4f0e8f75 100644 --- a/server/model/asset.go +++ b/server/model/asset.go @@ -28,6 +28,8 @@ type Asset struct { Encrypted bool `json:"encrypted"` AccessGatewayId string `gorm:"type:varchar(36)" json:"accessGatewayId"` Sort int `json:"sort" gorm:"default:0"` + Alias string `gorm:"type:varchar(200)" json:"alias"` + GroupId string `gorm:"index,type:varchar(36)" json:"groupId"` } type AssetForPage struct { @@ -45,6 +47,9 @@ type AssetForPage struct { Owner string `json:"owner"` OwnerName string `json:"ownerName"` Sort int `json:"sort"` + Alias string `json:"alias"` + GroupId string `json:"groupId"` + GroupFullName string `json:"groupFullName"` } func (r *Asset) TableName() string { diff --git a/server/repository/asset.go b/server/repository/asset.go index 2d8107d22..ffe38e65b 100644 --- a/server/repository/asset.go +++ b/server/repository/asset.go @@ -45,7 +45,7 @@ func (r assetRepository) FindByProtocolAndIds(c context.Context, protocol string } func (r assetRepository) Find(c context.Context, pageIndex, pageSize int, name, protocol, tags, ip, port, active, order, field string) (o []model.AssetForPage, total int64, err error) { - db := r.GetDB(c).Table("assets").Select("assets.id,assets.name,assets.ip,assets.port,assets.protocol,assets.active,assets.active_message,assets.owner,assets.created,assets.last_access_time,assets.tags,assets.description,assets.sort, users.nickname as owner_name").Joins("left join users on assets.owner = users.id") + db := r.GetDB(c).Table("assets").Select("assets.id,assets.name,assets.ip,assets.port,assets.protocol,assets.active,assets.active_message,assets.owner,assets.created,assets.last_access_time,assets.tags,assets.description,assets.sort,assets.alias,assets.group_id, users.nickname as owner_name, asset_groups.name as group_full_name").Joins("left join users on assets.owner = users.id").Joins("left join asset_groups on assets.group_id = asset_groups.id") dbCounter := r.GetDB(c).Table("assets") if len(name) > 0 {