Closed tianyu94 closed 1 year ago
补充:
根据情况考虑后发现,两种情况都会出现;
例如1:业务上可能需要查询在某个 list 中的数据,如果这个 list 都为空,那么最终结果为空
例如2:其他如普通参数筛选查询的场景下,为空时需要忽略这个查询条件项
应该只能自己根据场景、上下文判断了
ExampleWrapper中有类似下面的方法 https://github.com/mybatis-mapper/mapper/blob/fca2ce29f7492aa0bdde9319361aa8cc33962b86/mapper/src/main/java/io/mybatis/mapper/example/ExampleWrapper.java#L496:
@SuppressWarnings("rawtypes")
public ExampleWrapper<T, I> in(boolean useCondition, Fn<T, Object> fn, Iterable values) {
return useCondition ? in(fn, values) : this;
}
如果
andIn
比较值为 empty,SQL 会异常例如
这种是否可以考虑通过配置方式,或者默认将 empty 的集合(Collection)忽略其查询条件?