最近在做一个统计功能,有一个功能点:根据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}代表第二参数,可以根据需要以此向后推

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

相关文章:

  • 2022-01-23
  • 2021-05-19
  • 2021-07-04
  • 2021-11-25
猜你喜欢
  • 2022-12-23
  • 2021-12-10
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2021-06-03
相关资源
相似解决方案