Skip to content

Commit

Permalink
🐛 修复jsonContains丢失JSON_ARRAY关键字
Browse files Browse the repository at this point in the history
  • Loading branch information
lingting committed Jan 30, 2024
1 parent 180720d commit 4f38519
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public LambdaQueryWrapperX<T> jsonContains(SFunction<T, ?> column, Collection<Ob
.map(i -> this.formatParam(null, i))
.collect(Collectors.joining(",", "(", ")"));

return String.format("%s(%s,%s)", keyword, field, content);
return String.format("%s(%s,JSON_ARRAY%s)", keyword, field, content);
});
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ void test() {
new EqualsTo(column, new StringValue("ex2")))));

assertContains(
"JSON_CONTAINS(a.list,(#{ew.paramNameValuePairs.MPGENVAL1},#{ew.paramNameValuePairs.MPGENVAL2}))",
"JSON_CONTAINS(a.list,JSON_ARRAY(#{ew.paramNameValuePairs.MPGENVAL1},#{ew.paramNameValuePairs.MPGENVAL2}))",
wrapper().jsonContainsIfPresent(Entity::getList, Arrays.asList("1", "2")));
assertContains(
" JSON_CONTAINS(a.list,(#{ew.paramNameValuePairs.MPGENVAL1},#{ew.paramNameValuePairs.MPGENVAL2})) AND",
" JSON_CONTAINS(a.list,JSON_ARRAY(#{ew.paramNameValuePairs.MPGENVAL1},#{ew.paramNameValuePairs.MPGENVAL2})) AND",
wrapper().jsonContains(Entity::getList, "1", "2").eq(Entity::getString, "eq1"));
}

Expand Down

0 comments on commit 4f38519

Please sign in to comment.