在使用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 ){
...
}
本文介绍了在MyBatis框架中如何正确地传递单一字符串类型的参数,并展示了在XML映射文件中使用_parameter作为占位符的具体用法。
1442

被折叠的 条评论
为什么被折叠?



