package eta

import "eta/eta_mini_ht_api/models"

// ChartPermissionSearchKeyWordMapping 表示 chart_permission_search_key_word_mapping 表的结构
type ChartPermissionSearchKeyWordMapping struct {
	ChartPermissionID int `gorm:"column:chart_permission_id"` // chart_permission_id 字段
	ClassifyID        int `gorm:"column:classify_id"`         // classify_id 字段
}

func GetClassifyIdsByPermissionIds(permissionIds []int) (classifyIds []int, err error) {
	db := models.ETA()
	err = db.Model(&ChartPermissionSearchKeyWordMapping{}).Select("DISTINCT classify_id").Where("chart_permission_id in ?", permissionIds).Scan(&classifyIds).Error
	return
}

func (c *ChartPermissionSearchKeyWordMapping) TableName() string {
	return "chart_permission_search_key_word_mapping"
}
