model.go 641 B

1234567891011121314151617181920212223
  1. package classify_menu
  2. import (
  3. "hongze/hongze_yb/global"
  4. )
  5. // GetMenuListByClassifyId 分类ID获取子目录列表
  6. func GetMenuListByClassifyId(classify int) (list []*ClassifyMenu, err error) {
  7. err = global.MYSQL["rddp"].Model(ClassifyMenu{}).
  8. Where("classify_id = ?", classify).
  9. Order("sort ASC, create_time DESC").
  10. Scan(&list).Error
  11. return
  12. }
  13. // GetClassifyIdsByMenuId 子目录ID获取关联分类IDs
  14. func GetClassifyIdsByMenuId(menuId int) (classifyIds []int, err error) {
  15. err = global.MYSQL["rddp"].Model(ClassifyMenuRelation{}).
  16. Select("classify_id").
  17. Where("menu_id = ?", menuId).
  18. Scan(&classifyIds).Error
  19. return
  20. }