package com.hzs.sale.wares.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hzs.common.domain.sale.ext.BdWaresSpecsSkuExt;
import com.hzs.common.domain.sale.wares.BdWaresSpecsSku;
import com.hzs.sale.shopping.vo.ProductGroup;
import com.hzs.sale.shopping.vo.WaresItemVo;
import com.hzs.sale.shopping.vo.WaresItemWaresInfo;
import com.hzs.sale.wares.param.CuWaresItemsParams;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 规格sku表 Mapper 接口
 * </p>
 *
 * @author hzs
 * @since 2022-09-09
 */
public interface BdWaresSpecsSkuMapper extends BaseMapper<BdWaresSpecsSku> {

    /**
     * 根据编号查找商品的sku,携带所有规格，查看详情
     *
     * @param specialAreaList 专区
     * @param waresCode       商品编号
     * @return: List<BdWaresSpecsSkuExt>
     * @Author: sui q
     * @Date: 2022/9/19 11:21
     */
    List<BdWaresSpecsSkuExt> queryWaresSpecsSku(@Param("specialAreaList") List<Integer> specialAreaList,
                                                @Param("waresCode") String waresCode);

    /**
     * 根据sku主键查询规格名称
     *
     * @param pkSkuId sku主键
     * @return: List<BdWaresSpecsSku>
     * @Author: sui q
     * @Date: 2023/1/13 15:25
     */
    List<BdWaresSpecsSkuExt> queryWaresSpecsNameSku(@Param("pkSkuIdList") Set<Integer> pkSkuId);

    /**
     * 通过规格列表查询商品最小库存单位，
     *
     * @param cuWaresItemsParams 专区
     * @return: SpecsSkuParam
     * @Author: sui q
     * @Date: 2022/9/19 16:26
     */
    BdWaresSpecsSkuExt queryWaresDetailSkuBySpecs(@Param("cuWaresItemsParams") CuWaresItemsParams cuWaresItemsParams);

    /**
     * 根据id修改值
     *
     * @param waresSpecsSku
     */
    void updateBySkuId(BdWaresSpecsSku waresSpecsSku);

    /**
     * 根据id查询sku （可查询删除数据）
     *
     * @param pkWaresSpecsSku
     * @return
     */
    BdWaresSpecsSku selectByWaresSpecsSkuIdAndDel(@Param("pkWaresSpecsSku") Integer pkWaresSpecsSku);

    /**
     * 根据商品id 查询
     *
     * @param waresIds
     * @return
     */
    List<BdWaresSpecsSkuExt> selectByWaresSpecsSku(@Param("waresIds") List<Integer> waresIds);

    /**
     * 根据id 批量查询sku 信息
     *
     * @param pkWaresSpecsSku
     * @return
     */
    List<WaresItemWaresInfo> selectByPkIds(@Param("pkWaresSpecsSku") List<Integer> pkWaresSpecsSku);

    /*
     * @description: 查询商品封装为返回到会员端商品信息
     * @author: sui q
     * @date: 2023/5/10 19:57
     * @param: null null
     **/
    WaresItemVo selectWaresItemsVO(@Param("specialAreaList") List<Integer> specialAreaList, @Param("waresCode") String waresCode,
                                   @Param("productGroup") List<ProductGroup> productGroup);

    /**
     * 根据商品id查询规格价格最小值
     *
     * @param pkWares
     * @return
     */
    List<BdWaresSpecsSkuExt> selectByMinWaresSpecsSku(@Param("waresId") Integer pkWares);

    /**
     * 根据id 查询
     *
     * @param pkWaresSpecsSku
     * @return
     */
    BdWaresSpecsSkuExt selectByPkWaresSpecsSku(@Param("pkWaresSpecsSku") Integer pkWaresSpecsSku);

    /**
     * 查询商品的极差价格
     *
     * @param specialArea
     * @param waresCode
     * @param pkRange
     * @return
     */
    List<BdWaresSpecsSkuExt> queryWaresSpecsRangeSku(@Param("specialArea") Integer specialArea, @Param("waresCode") String waresCode, @Param("pkRange") Integer pkRange);

    /**
     * 批量查询 sku 的最小值
     *
     * @param pkWaresIds
     * @return
     */
    List<BdWaresSpecsSkuExt> selectByMinWaresSpecsSkuByPkWaresList(@Param("pkWaresIds") List<Integer> pkWaresIds);
}
