MyBatis中Mapper配置常见问题
-
入参为List时,foreach标签中collection属性值固定为“list”(list存放在map中作为入参时,collection应为key值):
<foreach item="item" collection="list" open="(" separator="," close=")"> #{item, jdbcType=VARCHAR, javaType=string} </foreach>
-
if标签中比较Enum对象和String对象时,枚举对象必须先调用toString():
<if test="Enum.toString() == 'String'">
</if>