29 lines
654 B
Go
29 lines
654 B
Go
![]() |
package model
|
||
|
|
||
|
import (
|
||
|
"SciencesServer/app/common/model"
|
||
|
"SciencesServer/serve/orm"
|
||
|
)
|
||
|
|
||
|
type SysNavigation struct {
|
||
|
*model.SysNavigation
|
||
|
}
|
||
|
|
||
|
// Navigation 导航信息
|
||
|
func (m *SysNavigation) Navigation() ([]*model.SysNavigation, error) {
|
||
|
out := make([]*model.SysNavigation, 0)
|
||
|
|
||
|
err := orm.GetDB().Table(m.TableName()).
|
||
|
Select("id", "parent_id", "title", "link").
|
||
|
Where("status = ?", model.SysNavigationStatusForShow).
|
||
|
Where("is_deleted = ?", model.DeleteStatusForNot).
|
||
|
Order("sort " + model.OrderModeToDesc).
|
||
|
Scan(&out).Error
|
||
|
|
||
|
return out, err
|
||
|
}
|
||
|
|
||
|
func NewSysNavigation() *SysNavigation {
|
||
|
return &SysNavigation{model.NewSysNavigation()}
|
||
|
}
|