最近在作一个统计功能,有一个功能点:根据id更新某字段的值。那么就须要有两个参数,个人作法:app
dao层:dom
int updateTaskCount(int taskCount,int id);
对应的mapper.xmlspa
<update id="updateTaskCount" parameterType="com.zmgj.zmd.domain.CollectionStatistic"> update collection_statistic set task_count = #{0} where user_id = #{1} </update>
其中:#{0}表明接收的是dao层中的第一个参数,#{1}表明第二参数,能够根据须要以此向后推code
注意:接收参数时#{}顺序要一一对应xml