123456789101112131415161718192021222324252627282930 |
- package models
- type RoleMenu struct {
- Id int64 `xorm:"id"`
- PastureId int64 `xorm:"pastureid"`
- RoleId int64 `xorm:"role_id"`
- MenuId int64 `xorm:"menu_id"`
- DeletedOn int64 `xorm:"deleted_on"`
- SeeButton int32 `xorm:"seebutton"`
- EditButton int32 `xorm:"editbutton"`
- }
- func (r *RoleMenu) TableName() string {
- return "role_menu"
- }
- func NewRoleMenu(pastureId, roleId int64, menuList []*Menu) []*RoleMenu {
- res := make([]*RoleMenu, len(menuList))
- for i, v := range menuList {
- res[i] = &RoleMenu{
- PastureId: pastureId,
- RoleId: roleId,
- MenuId: v.Id,
- DeletedOn: 0,
- SeeButton: 1,
- EditButton: 1,
- }
- }
- return res
- }
|