【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>
原文地址:https://www.cnblogs.com/sxdcgaq8080/p/11281333.html