首页 > 其他 > 详细

Mybatis 多个参数传递的问题

时间:2020-05-15 18:11:19      阅读:41      评论:0      收藏:0      [点我收藏+]

1. 如果传递的是对象

<update id="updatePerson" parameterType="person">

        update person set pname=#{pname},address=#{address} where pid=#{pid}

</update>

2. 使用map传参

<select id="getByCondition" parameterType="java.util.Map" resultType="person">

        select *from person where pname=#{name} and address=#{address}

    </select>

3.根据方法中参数列表的索引值

 <select id="getByCondition2"  resultType="person">

        select *from person where pname=#{0} and address=#{1}

    </select>

4.给参数起别名

 List<PersonBean> getByCondition3(@Param("name") String name, @Param("add") String add); 

<select id="getByCondition3"  resultType="person">

        select *from person where pname=#{name} and address=#{add}

    </select>

Mybatis 多个参数传递的问题

原文:https://www.cnblogs.com/masterhxh/p/12896189.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!