package classify_menu

import (
	"hongze/hongze_yb/global"
)

// GetMenuListByClassifyId 分类ID获取子目录列表
func GetMenuListByClassifyId(classify int) (list []*ClassifyMenu, err error) {
	err = global.MYSQL["rddp"].Model(ClassifyMenu{}).
		Where("classify_id = ?", classify).
		Order("sort ASC, create_time DESC").
		Scan(&list).Error
	return
}

// GetClassifyIdsByMenuId 子目录ID获取关联分类IDs
func GetClassifyIdsByMenuId(menuId int) (classifyIds []int, err error) {
	err = global.MYSQL["rddp"].Model(ClassifyMenuRelation{}).
		Select("classify_id").
		Where("menu_id = ?", menuId).
		Scan(&classifyIds).Error
	return
}