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
Scenario:
When we use SQL IN with djolar query together, all in values are turn to null
IN
in
null
Sample code:
try (SqlSession session = this.sessionFactory.openSession()) { setDjolarParameter(session, DjolarProperty.KEY_THROW_IF_EXPRESSION_INVALID, DjolarProperty.VALUE_OFF); BlogMapper mapper = session.getMapper(BlogMapper.class); QueryRequest queryRequest = new QueryRequest(); queryRequest.setQuery("n__eq__abc1|user_id__in__1,2"); List<Integer> ids1 = new ArrayList<>(); ids1.add(1); ids1.add(2); ids1.add(3); List<Blog> results = mapper.findBlogWithIdRange(queryRequest, ids1); Assertions.assertEquals(1, results.size()); }
blog_mapper.xml
<select id="findBlogWithIdRange" resultType="com.enixyu.djolar.mybatis.domain.Blog" parameterType="list"> SELECT `blog`.`id`, `blog`.`name`, `blog`.`user_id` FROM ( SELECT `blog`.`id`, `blog`.`name`, `blog`.`user_id` FROM `blog` <where> `id` IN <foreach item="id" collection="ids" separator="," open="(" close=")"> #{id, jdbcType=NUMERIC} </foreach> </where> ) AS `blog` </select>
Result:
14:50:21.702 [main] DEBUG o.a.i.t.jdbc.JdbcTransaction - Setting autocommit to false on JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@aa10649] 14:50:21.703 [main] DEBUG c.e.d.m.m.B.findBlogWithIdRange - ==> Preparing: SELECT `blog`.`id`, `blog`.`name`, `blog`.`user_id` FROM ( SELECT `blog`.`id`, `blog`.`name`, `blog`.`user_id` FROM `blog` WHERE `id` IN ( ? , ? , ? ) ) AS `blog` WHERE `blog`.`name` = ? AND `blog`.`user_id` IN (?,?) 14:50:21.704 [main] DEBUG c.e.d.m.m.B.findBlogWithIdRange - ==> Parameters: null, null, null, abc1(String), 1(Integer), 2(Integer) 14:50:21.705 [main] DEBUG c.e.d.m.m.B.findBlogWithIdRange - <== Total: 0
The text was updated successfully, but these errors were encountered:
Fixed fea6e53
Sorry, something went wrong.
No branches or pull requests
Scenario:
When we use SQL
IN
with djolar query together, allin
values are turn tonull
Sample code:
blog_mapper.xml
Result:
The text was updated successfully, but these errors were encountered: