原代码:
<select id="selectByStaffID" resultType="com.ailk.utils.IMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from PIM_HOST_MONITOR_SET
where 1=1
<if test="staffID != null and staffID !=''">
and STAFF_ID = #{staffID,jdbcType=DECIMAL}
</if>
</select>
现代码:
<select id="selectByStaffID" resultType="com.ailk.utils.IMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from PIM_HOST_MONITOR_SET
where 1=1
and STAFF_ID = #{staffID,jdbcType=DECIMAL}
</select>
报错原因:
parameterType 为 String , xml中又用到 if 时, 框架反射不到 get方法.所以报错.
parameterType 为 String 时 不能用 if 结构,只有 map 时才能用