其他分享
首页 > 其他分享> > Mybatis实战应用

Mybatis实战应用

作者:互联网

不断更新,先占个坑
传入List批量更新

  <update id="updateAttribute" parameterType="java.util.List">
    update objectattribute set
    attributeName =
    <foreach collection="list" item="item" index="index" separator=" " open="case data_objectUID" close="end">
      when #{item.data_objectUID} then #{item.attributeName}
    </foreach>
    ,attributeID =
    <foreach collection="list" item="item" index="index" separator=" " open="case data_objectUID" close="end">
      when #{item.data_objectUID} then #{item.attributeID}
    </foreach>
    ,dataType =
    <foreach collection="list" item="item" index="index" separator=" " open="case data_objectUID" close="end">
      when #{item.data_objectUID} then #{item.dataType}
    </foreach>
    ,dataLength =
    <foreach collection="list" item="item" index="index" separator=" " open="case data_objectUID" close="end">
      when #{item.data_objectUID} then #{item.dataLength}
    </foreach>
    ,isNotNull =
    <foreach collection="list" item="item" index="index" separator=" " open="case data_objectUID" close="end">
      when #{item.data_objectUID} then #{item.isNotNull}
    </foreach>
    ,isFilter =
    <foreach collection="list" item="item" index="index" separator=" " open="case data_objectUID" close="end">
      when #{item.data_objectUID} then #{item.isFilter}
    </foreach>
    ,isHidden =
    <foreach collection="list" item="item" index="index" separator=" " open="case data_objectUID" close="end">
      when #{item.data_objectUID} then #{item.isHidden}
    </foreach>
    ,displayType =
    <foreach collection="list" item="item" index="index" separator=" " open="case data_objectUID" close="end">
      when #{item.data_objectUID} then #{item.displayType}
    </foreach>
    ,displayLogic =
    <foreach collection="list" item="item" index="index" separator=" " open="case data_objectUID" close="end">
      when #{item.data_objectUID} then #{item.displayLogic}
    </foreach>
    where data_objectUID in
    <foreach collection="list" item="item" index="index" separator="," open="(" close=")">
      #{item.data_objectUID}
    </foreach>
  </update>

标签:实战,dataLength,isNotNull,when,objectUID,item,应用,Mybatis,data
来源: https://blog.csdn.net/weixin_42340366/article/details/97769267