<?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.yami.shop.dao.ShopSkuMapper">


  <resultMap id="shopProdMap" type="com.yami.shop.bean.model.ShopSku">
    <id column="id" property="id"/>
    <result column="shop_id" property="shopId"/>
    <result column="sku_id" property="skuId"/>
    <result column="shop_prod_price" property="shopSkuPrice"/>
    <result column="shop_prod_stocks" property="shopSkuStocks"/>
    <result column="is_delete" property="isDelete"/>
    <result column="update_time" property="updateTime"/>
    <result column="rec_time" property="recTime"/>
  </resultMap>

  <update id="deleteByProdId">
    UPDATE tz_shop_sku SET is_delete = 1 WHERE spu_id = #{prodId}
  </update>

    <select id="selectByShopAndProd" resultMap="shopProdMap">
    SELECT * FROM tz_shop_sku
    WHERE shop_id = #{shopId} AND sku_id = #{skuId} AND is_delete = 0
  </select>

</mapper>
