Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should NOT_IN judgment be added to QueryMapper's convertValue function implementation? #1744

Closed
yande2011 opened this issue Feb 29, 2024 · 2 comments
Assignees
Labels
status: ideal-for-contribution An issue that a contributor can help us with type: enhancement A general enhancement

Comments

@yande2011
Copy link

The current implementation is like this
@nullable
private Object convertValue(Comparator comparator, @nullable Object value, TypeInformation<?> typeHint) {

	if (Comparator.IN.equals(comparator) && value instanceof Collection<?> collection && !collection.isEmpty()) {

		Collection<Object> mapped = new ArrayList<>(collection.size());

		for (Object o : collection) {
			mapped.add(convertValue(o, typeHint));
		}

		return mapped;
	}

	return convertValue(value, typeHint);
}

My scenario is like this. I implemented the conversion from Collection to String myself. If NOT_IN is not determined before, the subsequent conversion function first determines whether conversion is possible, resulting in the wrong type of conversion.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 29, 2024
@mp911de
Copy link
Member

mp911de commented Feb 29, 2024

It should be added. Do you want to submit a pull request?

@mp911de mp911de added status: ideal-for-contribution An issue that a contributor can help us with type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 29, 2024
@yande2011
Copy link
Author

It should be added. Do you want to submit a pull request?

ok, i'll submit.

@mp911de mp911de self-assigned this Feb 29, 2024
schauder added a commit that referenced this issue Mar 13, 2024
Code formatting.
Adding author tags.
Added test for jdbc.
Fixed typo.

See #1744
Original pull request #1745
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ideal-for-contribution An issue that a contributor can help us with type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants