相关文章推荐

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 request for change "IllegalArgumentException: eq(null) is not allowed. Use isNull() instead" #3059 request for change "IllegalArgumentException: eq(null) is not allowed. Use isNull() instead" #3059 jiayp opened this issue Oct 15, 2021 · 1 comment

There is a same request #25 ,but I have a deffrent reason.

Why the new feature should be added

My project has many search conditions, and has many code like this:

    BooleanBuilder builder = new BooleanBuilder();
    if (!ObjectUtils.isEmpty(likeName)) {
      builder.and(QUser.user.name.like(("%" + likeName+ "%")));
    if (!ObjectUtils.isEmpty(age)) {
      builder.and(QUser.user.age.eq(age));

I want to impove it, So I and a function to check is the param is exists and then add it .I want code like this

    TryBooleanBuilder builder = new TryBooleanBuilder();
    builder
        .tryAnd(likeName, QUser.user.name.like(("%" + likeName+ "%")))
        .tryAnd(age, QUser.user.id.eq(age));

Then "IllegalArgumentException: eq(null) is not allowed. Use isNull() instead" is appeared.

How the new feature should work

Maybe add a config to ignore the exception?

 
推荐文章