// FindSelectedRecords find selected records when run bulk actions
FindSelectedRecords find selected records when run bulk actions
// FindSelectedRecords find selected records when run bulk actions
func (actionArgument *ActionArgument) FindSelectedRecords() []interface{} {
	var (
		context   = actionArgument.Context
		resource  = context.Resource
		records   = []interface{}{}
		sqls      []string
		sqlParams []interface{}
	)
	if len(actionArgument.PrimaryValues) == 0 {
		return records
	}
	clone := context.clone()
	for _, primaryValue := range actionArgument.PrimaryValues {
		primaryQuerySQL, primaryParams := resource.ToPrimaryQueryParams(primaryValue, context.Context)
		sqls = append(sqls, primaryQuerySQL)
		sqlParams = append(sqlParams, primaryParams...)
	}
	if len(sqls) > 0 {
		clone.SetDB(clone.GetDB().Where(strings.Join(sqls, " OR "), sqlParams...))
	}
	results, _ := clone.FindMany()
	resultValues := reflect.Indirect(reflect.ValueOf(results))
	for i := 0; i < resultValues.Len(); i++ {
		records = append(records, resultValues.Index(i).Interface())
	}
	return records
}
func ( actionArgument * ActionArgument ) FindSelectedRecords ( ) [ ] interface { } { var ( context = actionArgument . Context resource = context . Resource records = [ ] interface { } { } sqls [ ] string sqlParams [ ] interface { } ) if len ( actionArgument . PrimaryValues ) == 0 { return records } clone := context . clone ( ) for _ , primaryValue := range actionArgument . PrimaryValues { primaryQuerySQL , primaryParams := resource . ToPrimaryQueryParams ( primaryValue , context . Context ) sqls = append ( sqls , primaryQuerySQL ) sqlParams = append ( sqlParams , primaryParams ... ) } if len ( sqls ) > 0 { clone . SetDB ( clone . GetDB ( ) . Where ( strings . Join ( sqls , " " ) , sqlParams ... ) ) } results , _ := clone . FindMany ( ) resultValues := reflect . Indirect ( reflect . ValueOf ( results ) ) for i := 0 ; i < resultValues . Len ( ) ; i ++ { records = append ( records , resultValues . Index ( i ) . Interface ( ) ) } return records }
FindSelectedRecords find selected records when run bulk actions
FindSelectedRecords find selected records when run bulk actions