feat: 解决查询条件string有传""的情况,这种情况直接忽略
This commit is contained in:
parent
e719fef563
commit
ea1ff005e4
@ -32,6 +32,12 @@ public @interface CriteriaField {
|
||||
*/
|
||||
boolean filterNull() default true;
|
||||
|
||||
/**
|
||||
* 默认为true,当value为""的时候,自动过滤该查询条件.
|
||||
* @return
|
||||
*/
|
||||
boolean filterBlank() default true;
|
||||
|
||||
/**
|
||||
* 是否忽略该字段的查询条件
|
||||
*
|
||||
|
||||
@ -338,6 +338,12 @@ public class CriteriaWrapper {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (fieldAnnotation.filterBlank()
|
||||
&& (value instanceof String)
|
||||
&& StringUtils.isBlank((String) value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String fieldName = Strings.isNullOrEmpty(fieldAnnotation.field()) ? field : fieldAnnotation.field();
|
||||
// XXX 注解中获取的operator如果为EQ,无法判断是用户手动设置为EQ还是使用的默认operator.EQ,这里暂时保持原状
|
||||
return build(fieldName, fieldAnnotation.operator(), value, fieldAnnotation.prefix());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user