query.go 686 B

123456789101112131415
  1. package yb_activity_permission
  2. import "hongze/hongze_yb/global"
  3. // GetPermissionsByActivityId 根据活动ID获取权限集合
  4. func GetPermissionsByActivityId(activityId int) (permissions []*YbActivityPermission, err error) {
  5. err = global.DEFAULT_MYSQL.Model(YbActivityPermission{}).Where("activity_id", activityId).Scan(&permissions).Error
  6. return
  7. }
  8. // GetPermissionsByPermissionIds根据权限IDs获取权限集合
  9. func GetPermissionsByPermissionIds(permissionIds []int) (permissions []*YbActivityPermission, err error) {
  10. err = global.DEFAULT_MYSQL.Model(YbActivityPermission{}).Where("permission_id IN (?)", permissionIds).Group("activity_id").Scan(&permissions).Error
  11. return
  12. }