先创建一个方法用来进行测试,方法对应xml文件内的sql语句如下
<select id="getMoreById" resultType="cn.mybatis.demo1.model.User">
select * from User where id = ${start_id} or id = #{end_id}
</select>
修改Mybatis配置,让Mybatis输出其生成的SQL语句
<configuration>
<settings>
<setting name="logImpl" value="STDOUT_LOGGING"/> //显示 MyBatis生产的SQL语句
</settings>
</configuration>
其对应的SQL语句是:select * from User where id >= 1 and id <= ?