/king007c/article/details/85276655
例:
<foreach collection="plantset_types" item="plant" separator="," open="'" close="'">
${plant.plant_id}
</foreach>
每个${plant.plant_id}获取的值前后都会自动加空格,' 1 , 2 , 3',会导致判断的值包含空格,无法正确匹配。
使用下面方法去除空格:
replace(<foreach collection="plantset_types" item="plant" separator="," open="'" close="'">
${plant.plant_id}
</foreach>,' ','')
使用SQL语句的replace方法,去掉所有的空格(缺点:去掉所有的空格)。
replace('字符串',' ','')