【mybatis】mybatis一条sql更新两张数据表,mybatis关联更新多张数据表


 

示例sql:

 <update id="receipt" parameterType="com.pisen.cloud.luna.ms.security.code.base.mapper.beans.ReceiptBean">
        update
            security_code_info info
        LEFT JOIN
            security_code_relation re
        ON
            re.security_code = info.security_code
        set
            info.code_stock_state = ${@com.pisen.cloud.luna.ms.security.code.base.domain.SecurityCodeInfo@STOCK_STATE_IN_STOCK},
            info.code_state = ${@com.pisen.cloud.luna.ms.security.code.base.domain.SecurityCodeInfo@CODE_STATE_ACTIVATION_EN},
            info.receipt_date = #{receiptAndActDate},
            re.depot_id = #{depotUid}
        where
            info.security_code
        in
        <foreach collection="scList" index="index" close=")" open="(" item="item" separator=",">
            #{item}
        </foreach>

    </update>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM