package yb_activity_permission

import "hongze/hongze_yb/global"

// GetPermissionsByActivityId 根据活动ID获取权限集合
func GetPermissionsByActivityId(activityId int) (permissions []*YbActivityPermission, err error) {
	err = global.DEFAULT_MYSQL.Model(YbActivityPermission{}).Where("activity_id", activityId).Scan(&permissions).Error
	return
}

// GetPermissionsByPermissionIds根据权限IDs获取权限集合
func GetPermissionsByPermissionIds(permissionIds []int) (permissions []*YbActivityPermission, err error) {
	err = global.DEFAULT_MYSQL.Model(YbActivityPermission{}).Where("permission_id IN (?)", permissionIds).Group("activity_id").Scan(&permissions).Error
	return
}