<select id="selById" resultType="com.czxy.pojo.People" parameterType="int">
select * from people where id=#{0}
</select>
参数为对象类型时,用$
<select id="selById" resultType="xxx.xxx.xxxPeople" parameterType="xxx.xxx.xxx.People">
select * from people where id=${属性名}
</select>
前提:该属性必须有get和set方法
参数为map时,用#
map.put("id","1");
map.put("name","zhangsan");
<select id="selById" resultType="xxx.xxx.xxxPeople" parameterType="map">
select * from people where id=#{id} and name=#{name}
</select>
<select id="selById" resultType="People" parameterType="int">
select * from people where id=#{0}
</select>
语句: select * from people where id=?,将参数填入?。就是prepareStatement();语句执行。
<select id="selById" resultType="People" parameterType="xxx.xxx.xxx.People">
select * from people where id=${id}
</select>
语句: select * from people where id=People.getId();
如果是:select * from people where id=${0}
语句: select * from people where id=0;