自学内容网 自学内容网

Mybatis <foreach collection怎么取值

有多个参数时collection需取值为参数名,只有一个参数时可取值为array/list/collection【set时取collection】

XxxMapper.java

Long checkPass(List<Long> ids, String currentName);

 XxxMapper.xml

  <!--报账审核通过-->
  <update id="checkPass">
    update std_expend
    set status = 1,
    check_date = sysdate(),
    check_by = #{currentName}
    where expend_id in (
    <!--有多个参数时collection需取值为参数名,只有一个参数时可取值为array/list/collection【set时取collection】-->
    <foreach collection="ids" item="id" separator=",">
      #{id}
    </foreach>
    )
  </update>


原文地址:https://blog.csdn.net/tanzongbiao/article/details/142366491

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!