<?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="cn.reghao.tnb.content.app.mall.db.mapper.ProductSnapshotMapper">
    <insert id="save" useGeneratedKeys="true" keyProperty="id">
        insert into mall_product_snapshot
        (`order_id`,`item_id`,`title`,`pic_url`,`price`)
        values 
        (#{orderId},#{itemId},#{title},#{picUrl},#{price})
    </insert>

    <select id="findByOrderId" resultType="cn.reghao.tnb.content.app.mall.model.po.ProductSnapshot">
        select *
        from mall_product_snapshot
        where order_id=#{orderId}
    </select>
    <select id="findItemSnapshotByOrderId" resultType="cn.reghao.tnb.content.api.dto.ItemSnapshot">
        select *
        from mall_product_snapshot
        where order_id=#{orderId}
    </select>
</mapper>