问题:

原因: 传参有多个时发生!!
解决:
解决办法:
(1)直接把值改成数字
<select id="LoginUser" parameterType="String" resultMap="userMap">
SELECT * FROM user where emplnumb = #{0} and password=#{1}
</select>
(2)在变量上加注解@Param
List<Property> selectOrder(@Param("page") Page page,@Param("cid") int cid);
<select id="selectOrder" resultMap="property" >
select * from t_property WHERE category_id = #{cid} order by id asc limit #{page.start} , #{page.count}
</select>
本文探讨了在使用MyBatis框架时遇到的参数传递问题,特别是当需要传递多个参数时如何正确设置SQL语句。文章提供了两种解决方案:一是直接将参数转换为数字类型;二是利用@Param注解明确指定参数名称,确保SQL映射文件中的参数引用正确无误。
1765

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



