From d8411c318d372267c39212f1660c23efe4623f1b Mon Sep 17 00:00:00 2001 From: dushixiang <798148596@qq.com> Date: Tue, 19 Jan 2021 21:51:10 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=E8=B5=84=E4=BA=A7?= =?UTF-8?q?=E3=80=81=E5=87=AD=E8=AF=81=E3=80=81=E6=8C=87=E4=BB=A4=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E6=95=B0=E9=87=8F=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84?= =?UTF-8?q?bug=20-=20=E4=BF=AE=E5=A4=8D=E8=B5=84=E4=BA=A7=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E5=87=BA=E7=8E=B0=E7=A9=BA=E6=A0=BC=E7=9A=84bug=20-?= =?UTF-8?q?=20=E5=88=A0=E9=99=A4=E9=80=80=E5=87=BA=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=97=81=E8=BE=B9=E7=9A=84=E9=80=97=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/model/asset.go | 2 +- pkg/model/command.go | 2 +- pkg/model/credential.go | 2 +- web/src/components/asset/Asset.js | 6 +----- web/src/components/user/Logout.js | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/pkg/model/asset.go b/pkg/model/asset.go index d51970a..6c9ce3c 100644 --- a/pkg/model/asset.go +++ b/pkg/model/asset.go @@ -65,7 +65,7 @@ func FindAssetByConditions(protocol string, account User) (o []Asset, err error) func FindPageAsset(pageIndex, pageSize int, name, protocol, tags string, account User, owner, sharer string) (o []AssetVo, total int64, err error) { db := global.DB.Table("assets").Select("assets.id,assets.name,assets.ip,assets.port,assets.protocol,assets.active,assets.owner,assets.created, users.nickname as owner_name,COUNT(resource_sharers.user_id) as sharer_count").Joins("left join users on assets.owner = users.id").Joins("left join resource_sharers on assets.id = resource_sharers.resource_id").Group("assets.id") - dbCounter := global.DB.Table("assets").Select("DISTINCT assets.id").Joins("left join resource_sharers on assets.id = resource_sharers.resource_id") + dbCounter := global.DB.Table("assets").Select("DISTINCT assets.id").Joins("left join resource_sharers on assets.id = resource_sharers.resource_id").Group("assets.id") if TypeUser == account.Type { owner := account.ID diff --git a/pkg/model/command.go b/pkg/model/command.go index 39fb25f..7f86056 100644 --- a/pkg/model/command.go +++ b/pkg/model/command.go @@ -30,7 +30,7 @@ func (r *Command) TableName() string { func FindPageCommand(pageIndex, pageSize int, name, content string, account User) (o []CommandVo, total int64, err error) { db := global.DB.Table("commands").Select("commands.id,commands.name,commands.content,commands.owner,commands.created, users.nickname as owner_name,COUNT(resource_sharers.user_id) as sharer_count").Joins("left join users on commands.owner = users.id").Joins("left join resource_sharers on commands.id = resource_sharers.resource_id").Group("commands.id") - dbCounter := global.DB.Table("commands").Select("DISTINCT commands.id").Joins("left join resource_sharers on commands.id = resource_sharers.resource_id") + dbCounter := global.DB.Table("commands").Select("DISTINCT commands.id").Joins("left join resource_sharers on commands.id = resource_sharers.resource_id").Group("commands.id") if TypeUser == account.Type { owner := account.ID diff --git a/pkg/model/credential.go b/pkg/model/credential.go index 02d90b3..db0a585 100644 --- a/pkg/model/credential.go +++ b/pkg/model/credential.go @@ -54,7 +54,7 @@ func FindAllCredential(account User) (o []CredentialSimpleVo, err error) { func FindPageCredential(pageIndex, pageSize int, name string, account User) (o []CredentialVo, total int64, err error) { db := global.DB.Table("credentials").Select("credentials.id,credentials.name,credentials.type,credentials.username,credentials.owner,credentials.created,users.nickname as owner_name,COUNT(resource_sharers.user_id) as sharer_count").Joins("left join users on credentials.owner = users.id").Joins("left join resource_sharers on credentials.id = resource_sharers.resource_id").Group("credentials.id") - dbCounter := global.DB.Table("credentials").Select("DISTINCT credentials.id").Joins("left join resource_sharers on credentials.id = resource_sharers.resource_id") + dbCounter := global.DB.Table("credentials").Select("DISTINCT credentials.id").Joins("left join resource_sharers on credentials.id = resource_sharers.resource_id").Group("credentials.id") if TypeUser == account.Type { owner := account.ID diff --git a/web/src/components/asset/Asset.js b/web/src/components/asset/Asset.js index 99b78fb..f54364b 100644 --- a/web/src/components/asset/Asset.js +++ b/web/src/components/asset/Asset.js @@ -171,10 +171,6 @@ class Asset extends Component { }; handleTagsChange = tags => { - console.log(tags) - // this.setState({ - // tags: tags - // }) let query = { ...this.state.queryParams, 'pageIndex': 1, @@ -248,7 +244,7 @@ class Asset extends Component { } if (asset['tags'] && typeof (asset['tags']) === 'string') { - if (asset['tags'] === '-') { + if (asset['tags'] === '' || asset['tags'] === '-') { asset['tags'] = []; } else { asset['tags'] = asset['tags'].split(','); diff --git a/web/src/components/user/Logout.js b/web/src/components/user/Logout.js index c91c9cd..82c8a3c 100644 --- a/web/src/components/user/Logout.js +++ b/web/src/components/user/Logout.js @@ -27,7 +27,7 @@ class Logout extends Component { > , +