java - MyBatis 在使用 isInCaseInsensitiveWhenPresent 时给出空指针异常
问题描述
根据此处的 MyBatis 文档https://mybatis.org/mybatis-dynamic-sql/docs/conditions.html
如果传递了空值,则IsInCaseInsensitiveWhenPresent不应呈现。
所以,下面是我的查询:
SelectStatementProvider selectStatement = select(allColumns())
.from(table1)
.where(table1.date1, isGreaterThanOrEqualToWhenPresent(from_))
.and(table1.date2, isLessThanWhenPresent(to_))
.and(table1.type, isInCaseInsensitiveWhenPresent(event))
.build()
.render(RenderingStrategies.MYBATIS3);
其中event是Collection类型的输入。
在这里,如果event为 null ,则查询呈现失败。那么,有什么建议吗?我想搜索一个列是否具有值列表中的值并且应该不区分大小写。
解决方案
推荐阅读
- merge - Lightroom 批处理 HDR 脚本
- c# - C# 将证书和密钥 (PFX) 导入 CNG/KSP
- php - php ms sql登录返回int -1无值
- python - 如何使用 Python 在现有 XML 中附加一堆标签
- arrays - 将数组值放入powershell中的字符串中
- c# - 用作 SQL Query_for 列和条件的变量的选定值
- sql-server - 确定 msdb.dbo.backupset 记录是备份还是还原
- vue.js - 在 Vuetify 中调整 v-list-tile 的高度
- java - 无法从本地 IDE 连接到 docker hbase
- c# - SQL 与 NULL 或非空列完全匹配