最近在作一個統計功能,有一個功能點:根據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