在使用mybaitis传参数的时候,如果仅传入一个类型为String的参数,那么在 xml文件中应该使用_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 = #{state}
</select>
<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>
public int methodName(@Param(value="state") String state ){
...
}