在使用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 ){
...
}
