package eta import ( "hongze/hz_crm_eta/global" "strings" "time" ) type SysMenu struct { MenuId int32 `gorm:"column:menu_id;primary_key;AUTO_INCREMENT;NOT NULL"` ParentId int32 `gorm:"column:parent_id;default:0;comment:'父级菜单ID\n'"` Name string `gorm:"column:name;default:;comment:'菜单名称或者按钮名称'"` Sort int8 `gorm:"column:sort;default:0;comment:'排序\n'"` Path string `gorm:"column:path;default:;comment:'路径'"` IconPath string `gorm:"column:icon_path;default:;comment:'菜单图标地址\n'"` Component string `gorm:"column:component;default:;comment:'组件路径\n'"` Hidden int8 `gorm:"column:hidden;default:0;comment:'是否隐藏:1-隐藏 0-显示\n'"` IsLevel int8 `gorm:"column:is_level;default:0;NOT NULL;comment:'1,只有一级;2,有多级'"` LevelPath string `gorm:"column:level_path;default:"` MenuType int8 `gorm:"column:menu_type;default:0;NOT NULL;comment:'菜单类型: 0-菜单; 1-按钮; 2-字段(需要特殊处理)'"` ButtonCode string `gorm:"column:button_code;default:;NOT NULL;comment:'按钮唯一编码'"` CreateTime time.Time `gorm:"column:create_time;default:NULL;comment:'创建时间'"` ModifyTime time.Time `gorm:"column:modify_time;default:NULL;comment:'更新时间'"` Api string `gorm:"column:api;NOT NULL;comment:'按钮相关api'"` NameEn string `gorm:"column:name_en;default:;comment:'菜单名称或者按钮名称(英文)'"` } func (s *SysMenu) TableName() string { return "sys_menu" } const ( MenuSpecialHandleClassifyChildMenu = "classifyList:cnClassify:childMenu" MenuSpecialHandleClassifyShowType = "classifyList:cnClassify:showType" MenuSpecialHandleClassifyReportImgs = "classifyList:cnClassify:reportImgs" MenuSpecialHandleSandboxVariety = "sandbox:variety" ) // GetSysMenuItemsByCondition 获取菜单列表 func (s *SysMenu) GetSysMenuItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*SysMenu, err error) { fields := strings.Join(fieldArr, ",") if len(fieldArr) == 0 { fields = `*` } order := ` create_time DESC` if orderRule != "" { order = orderRule } err = global.MYSQL["hz_eta"].Model(s).Select(fields).Where(condition, pars...).Order(order).Scan(&items).Error return }