We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
1.2.4
不同的实体数据库表,都有相同的查询条件,构造MPJLambdaWrapper时,期望不需要每个实体类都去处理一遍这些查询条件,相同的查询条件定义泛型方法来处理
1,定义两个数据库实体,相同的字段放到基类Base
class Base { Long id; Long appId; } class A extends Base { String fieldA; } class B extends Base { String fieldB; }
2,定义查询条件的泛型处理方法
protected <E extends Base> void handleAppId(MPJLambdaWrapper<E> qw, Long appId) { if (appId != null) { if (appId == -1L) { qw.eq(E::getAppId, -1L); } else { qw.and(t -> t.eq(E::getAppId, -1L) .or().eq(E::getAppId, appId)); } } }
3,查询报错
空指针异常,ColumnCache 字段缓存里面没有找到
nested exception is org.apache.ibatis.builder.BuilderException: Error evaluating expression 'ew.sqlSegment != null and ew.sqlSegment != '' and ew.nonEmptyOfWhere'. Cause: org.apache.ibatis.ognl.OgnlException: sqlSegment [java.lang.NullPointerException]
com.github.yulichang.wrapper.MPJAbstractLambdaWrapper, getCache(), 57 com.github.yulichang.wrapper.MPJAbstractLambdaWrapper, columnToString(), 47 com.github.yulichang.wrapper.MPJAbstractLambdaWrapper, columnToString(), 36
debug 可以看到缓存字段 columnMap 中只有 ClassA和ClassB,不会有个ClassBase,但是泛型Lambda传入的是ClassBase
The text was updated successfully, but these errors were encountered:
No branches or pull requests
当前使用版本(必填,否则不予处理)
1.2.4
该问题是如何引起的?(确定最新版也有问题再提!!!)
不同的实体数据库表,都有相同的查询条件,构造MPJLambdaWrapper时,期望不需要每个实体类都去处理一遍这些查询条件,相同的查询条件定义泛型方法来处理
重现步骤(如果有就写完整)
1,定义两个数据库实体,相同的字段放到基类Base
2,定义查询条件的泛型处理方法
3,查询报错
报错信息
空指针异常,ColumnCache 字段缓存里面没有找到
nested exception is org.apache.ibatis.builder.BuilderException: Error evaluating expression 'ew.sqlSegment != null and ew.sqlSegment != '' and ew.nonEmptyOfWhere'. Cause: org.apache.ibatis.ognl.OgnlException: sqlSegment [java.lang.NullPointerException]
com.github.yulichang.wrapper.MPJAbstractLambdaWrapper, getCache(), 57
com.github.yulichang.wrapper.MPJAbstractLambdaWrapper, columnToString(), 47
com.github.yulichang.wrapper.MPJAbstractLambdaWrapper, columnToString(), 36
debug 可以看到缓存字段 columnMap 中只有 ClassA和ClassB,不会有个ClassBase,但是泛型Lambda传入的是ClassBase
The text was updated successfully, but these errors were encountered: