Mybatis 多个参数传递的问题

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>

posted @ 2020-05-15 17:33  master_hxh  阅读(189)  评论(0编辑  收藏  举报