mybatits

<update id="updateStatusById" parameterType="java.lang.Integer">
update
nic_techsupport
set status_id = #{0}
where techsupport_id =#{1}
</update>

在MyBatis3.4.4版后不能直接使用#{0}要使用 #{arg0}

<update id="updateStatusById" parameterType="java.lang.Integer">
update
nic_techsupport
set status_id = #{arg0}
where techsupport_id =#{arg1}
</update>

不使用@Param注解时,参数只能有一个,并且是Javabean。在SQL语句里可以引用JavaBean的属性,而且只能引用JavaBean的属性。

// 这里id是user的属性

@Select("SELECT * from Table where id = ${id}")
Enchashment selectUserById(User user);

原文地址:https://www.cnblogs.com/y-blog/p/9165618.html