mybatis oracle 循環 insert update 日期格式 踩坑


  1. mybatis 中操作oracle數據庫,循環標簽要注意  index="index" open="begin" close=";end;" 這一段代碼
  2. 日期字段 lastModifiedDateStr 為字符串String類型,然后使用 to_date 函數格式化
    <update id="batchUpdate">
            <foreach collection="pos" item="po" separator=";" index="index" open="begin" close=";end;">
                UPDATE
                ITEM.CUST_DIST_PRICE
                SET
                FXPF_PRICE = #{po.fxpfPrice},
                NEW_FXPF_PRICE = #{po.newFxpfPrice},
                OLD_FXPF_PRICE = #{po.oldFxpfPrice},
                ERROR_REASON = #{po.errorReason},
                CREATION_DATE =
                to_date(#{po.creationDateStr},'YYYY-MM-DD hh24:mi:ss'),
                CREATION_BY = #{po.creationBy},
                LAST_MODIFIED_DATE =
                to_date(#{po.lastModifiedDateStr},'YYYY-MM-DD hh24:mi:ss'),
                LAST_MODIFIED_BY = #{po.lastModifiedBy},
                IS_DELETE = #{po.deleted}
                where
                CUST_DIST_PRICE_ID = #{po.id}
            </foreach>
        </update>

     


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM