package models type MenuPasture struct { Id int64 `xorm:"id"` PastureId int64 `xorm:"pastureid"` IsGroups int32 `xorm:"isgroups"` } func (m *MenuPasture) TableName() string { return "menu_pasture" } func NewMenuPastureList(pastureId int64, menuList []*Menu) []*MenuPasture { res := make([]*MenuPasture, len(menuList)) for i, v := range menuList { res[i] = &MenuPasture{ PastureId: pastureId, Id: v.Id, IsGroups: 0, } } return res }