package com.kmall.admin.dao;

import com.kmall.admin.entity.ProductStoreRelaEntity;
import org.apache.ibatis.annotations.Param;
import com.kmall.manager.dao.BaseDao;

import java.util.List;
import java.util.Map;

/**
 * Dao
 *
 * @author Scott
 * @email
 * @date 2017-12-27 19:12:46
 */
public interface ProductStoreRelaDao extends BaseDao<ProductStoreRelaEntity> {

    int deleteByGoodsId(Integer goodsId);

    ProductStoreRelaEntity queryObjectByStoreAndGoodsId(Map<String, Object> params);

    ProductStoreRelaEntity queryByStoreIdProductId(@Param("storeId") Long storeId, @Param("productId") Long productId);

    ProductStoreRelaEntity queryByGoodsIdAndStoreId(@Param("storeId") Long storeId, @Param("goodsId") Long goodsId);

    List<ProductStoreRelaEntity> queryByGoodsId(Long id);

    List<ProductStoreRelaEntity> querySameList(Map<String, Object> map);

    void updateStockNum(ProductStoreRelaEntity productStoreRelaEntity);

    void updateSellVolumeNum(ProductStoreRelaEntity productStoreRelaEntity);

    /**
     * 根据优惠券临时表查询商品分页查询
     *
     * @param map 参数
     * @return list
     */
    List<ProductStoreRelaEntity> queryGoodsRealListByDiscountTid(Map<String, Object> map);

    /**
     * 根据优惠券临时表查询商品分页统计总数
     *
     * @param map 参数
     * @return 总数
     */
    int queryGoodsRealListByDiscountTidTotal(Map<String, Object> map);

    /**
     * 根据门店活动临时表查询商品分页查询
     *
     * @param map 参数
     * @return list
     */
    List<ProductStoreRelaEntity> queryGoodsRealListByTopicId(Map<String, Object> map);

    /**
     * 根据门店活动临时表查询商品分页统计总数
     *
     * @param map 参数
     * @return 总数
     */
    int queryGoodsRealListByTopicIdTotal(Map<String, Object> map);

    /**
     * 共享库存商品库存变化，修改该商品的所有库存信息
     * @param productStoreRelaEntity
     */
    void updateStockNumByGoodsId(ProductStoreRelaEntity productStoreRelaEntity);
}
