mybatis传多个参数实例

最近在做一个统计功能,有一个功能点:根据id更新某字段的值。那么就需要有两个参数,我的做法:

dao层:

 int updateTaskCount(int taskCount,int id);

对应的mapper.xml

 <update id="updateTaskCount" parameterType="com.zmgj.zmd.domain.CollectionStatistic">
       update collection_statistic set task_count =  #{0} where user_id =  #{1}
 </update>

其中:#{0}代表接收的是dao层中的第一个参数,#{1}代表第二参数,可以根据需要以此向后推

 注意:接收参数时#{}顺序要一一对应

posted @ 2017-08-21 15:44  在路上的牛小牛  阅读(331)  评论(0编辑  收藏  举报