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

Boolean 类型的字段,当检索时 该字段传入的参数值为 空串时,BoolValueFilter 会将其转换为 true, 而没有忽略它 #29

Closed
troyzhxu opened this issue Apr 6, 2022 · 1 comment
Labels

Comments

@troyzhxu
Copy link
Owner

troyzhxu commented Apr 6, 2022

这个问题将在 v3.5.3 中修复。
再此之前,我们可以声明一个自定义的 参数过滤器 来绕过它:

@Bean
public ParamFilter myBoolValueFilter() {
    return new BoolValueFilter() {
	@Override
	protected Boolean toBoolean(Object value) {
            if (value instanceof String && StringUtils.isBlank((String) value)) {
                return null;
            }
            return super.toBoolean(value);
	}
    };
}
@troyzhxu troyzhxu changed the title 对Boolean 类型的字段,当 Boolean 类型的字段,当检索时 传入的字段参数值为 空串时,BoolValueFilter 会将其转换为 true, 而没有忽略它 Apr 6, 2022
@troyzhxu troyzhxu added the bug label Apr 6, 2022
@troyzhxu troyzhxu changed the title Boolean 类型的字段,当检索时 传入的字段参数值为 空串时,BoolValueFilter 会将其转换为 true, 而没有忽略它 Boolean 类型的字段,当检索时 该字段传入的参数值为 空串时,BoolValueFilter 会将其转换为 true, 而没有忽略它 Apr 6, 2022
@troyzhxu
Copy link
Owner Author

troyzhxu commented Apr 6, 2022

@troyzhxu troyzhxu closed this as completed Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant