mybatis在使用标签时,{<、>、<=、>=}等符号需要转译否则不认报错;
原符号
<、 <=、 >、 >=、 &、 '、 "、
替换符号
\<、 \<=、 \>、 \>=、 \&、 \'、 \"、
例如:sql如下:
create_date_time >= #{startTime} and create_date_time <= #{endTime}
注意:if 标签内判断 0 ,1等数字时,不需要加引号
"<script>" +
"SELECT " +
"id,name " +
"FROM user_info" +
"WHERE " +
" isdelete = '0'" +
" <if test=\" type != null and type!= 0 \"> AND type = #{type} </if> "+
"</script>"