<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wzj.soopin.order.mapper.VerificationCodesMapper">

    <select id="getProduvtNameAndMemberId" resultType="map">
        SELECT
            p.name AS productName,
            vc.member_id AS memberId
        FROM oms_verification_codes vc
                 JOIN oms_order_item oi ON vc.order_id = oi.order_id
                 JOIN pms_product p ON oi.product_id = p.id
        WHERE vc.code = #{code}
            LIMIT 1
    </select>

    <select id="verificationTime" resultType="java.time.LocalDateTime">
        SELECT vlogs.verification_time
        FROM oms_verification_codes vcodes
                 JOIN oms_verification_logs vlogs ON vcodes.order_id = vlogs.order_id
        WHERE vcodes.code = #{code}
            LIMIT 1
    </select>

    <select id="getReason" resultType="java.lang.String">
        SELECT logs.reason
        FROM oms_verification_codes codes
                 JOIN oms_verification_logs logs ON codes.order_id = logs.order_id
        WHERE codes.code = #{code}
            LIMIT 1
    </select>


</mapper>
