From 894ae062166e70667c5659337186fc006a5c6145 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 24 Oct 2024 18:08:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/implement/permission_group_implement.go | 4 ++-- src/model/permission_group.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/implement/permission_group_implement.go b/src/implement/permission_group_implement.go index 81e0d16..36ca223 100644 --- a/src/implement/permission_group_implement.go +++ b/src/implement/permission_group_implement.go @@ -1,4 +1,4 @@ -package implement +package implement import ( "code.fnuoos.com/zhimeng/model.git/enum" @@ -26,7 +26,7 @@ func (p PermissionGroupDb) FindPermissionGroup() (*[]model.PermissionGroup, erro func (p PermissionGroupDb) FindPermissionGroupV2() (*[]model.PermissionGroup, error) { var m []model.PermissionGroup - if err := p.Db.Asc("id").Find(&m); err != nil { + if err := p.Db.OrderBy("sort desc,id asc").Find(&m); err != nil { return nil, zhios_order_relate_logx.Error(err) } return &m, nil diff --git a/src/model/permission_group.go b/src/model/permission_group.go index ac927e3..50d7750 100644 --- a/src/model/permission_group.go +++ b/src/model/permission_group.go @@ -8,4 +8,5 @@ type PermissionGroup struct { State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:废弃)') TINYINT(1)"` CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + Sort int `json:"sort" xorm:"not null default 0 comment('') INT(11)"` }