1.当入参为 string类型时 (包括java.lang.String.)
我们使用#{xxx}引入参数.会抛异常There is no getter for property named 'XXX' in 'class java.lang.String'
<select id="xxxx" resultType="int" parameterType="string"> select count(*) from TB_EMPC_BOOKING_ORDER T where (t.state = '1' or t.state = '2') and t.appointmenttime = #{state} </select>
2.解决方法一:把#{xxx}修改为 #{_parameter} 即可
<select id="getBookingCount" resultType="int" parameterType="string"> select count(*) from TB_EMPC_BOOKING_ORDER T where (t.state = '1' or t.state = '2') and t.appointmenttime = #{_parameter} </select>
3.解决方法二:可以在方法中提前定义:
public int methodName(@Param(value="state") String state ){ ... }