json转换fix
This commit is contained in:
@@ -81,13 +81,13 @@ public class ListingMallServiceImpl extends ServiceImpl<ListingMallMapper, Listi
|
|||||||
String cat = dto.getCategories().get(i);
|
String cat = dto.getCategories().get(i);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
wrapper.apply(
|
wrapper.apply(
|
||||||
"JSON_CONTAINS(product_category, {0}, '$')",
|
"JSON_CONTAINS(product_category, JSON_QUOTE({0}), '$')",
|
||||||
"\"" + cat + "\""
|
cat
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
wrapper.or().apply(
|
wrapper.or().apply(
|
||||||
"JSON_CONTAINS(product_category, {0}, '$')",
|
"JSON_CONTAINS(product_category, JSON_QUOTE({0}), '$')",
|
||||||
"\"" + cat + "\""
|
cat
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<if test="dto.categories != null and dto.categories.size() > 0">
|
<if test="dto.categories != null and dto.categories.size() > 0">
|
||||||
AND (
|
AND (
|
||||||
<foreach collection="dto.categories" item="cat" separator=" OR ">
|
<foreach collection="dto.categories" item="cat" separator=" OR ">
|
||||||
JSON_CONTAINS(soi.product_category, #{cat})
|
JSON_CONTAINS(soi.product_category, JSON_QUOTE(#{cat}))
|
||||||
</foreach>
|
</foreach>
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
<if test="dto.categories != null and dto.categories.size() > 0">
|
<if test="dto.categories != null and dto.categories.size() > 0">
|
||||||
AND (
|
AND (
|
||||||
<foreach collection="dto.categories" item="cat" separator=" OR ">
|
<foreach collection="dto.categories" item="cat" separator=" OR ">
|
||||||
JSON_CONTAINS(soi.product_category, #{cat})
|
JSON_CONTAINS(soi.product_category, JSON_QUOTE(#{cat}))
|
||||||
</foreach>
|
</foreach>
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user