#{id}
这句话告诉mybatis创建一个PreparedStatement类,它所对应的参数会由?来标识,并把传的值给替换掉
//JDBC代码
String selectPerson = "SELECT * FROM PERSON WHERE ID=?";
PreparedStatement ps = conn.prepareStatement(selectPerson);
ps.setInt(1,id);
//MyBatis代码
<select id="selectPerson" parameterType="int" resultType="hashmap">
SELECT * FROM PERSON WHERE ID = #{id}
</select>
mybatis中#符号
最新推荐文章于 2024-01-28 00:05:15 发布