package com.sqx.modules.goods.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.modules.order.entity.Evaluate;
import com.sqx.modules.goods.entity.Goods;
import com.sqx.modules.goods.entity.GoodsShop;
import com.sqx.modules.goods.entity.GoodsShopRelevancy;
import com.sqx.modules.order.entity.TbOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface GoodsShopDao extends BaseMapper<GoodsShop> {

    IPage<GoodsShop> selectAllShop(@Param("pages") Page<GoodsShop> pages, @Param("shopName") String shopName, @Param("region") String region, @Param("isActivity") Integer isActivity);

    IPage<GoodsShop> selectAllShopByAdmin(Page<GoodsShop> pages,@Param("shopName") String shopName,@Param("userId") Long userId);

    IPage<Goods> selectAdminGoodsList(Page<Goods> pages,@Param("classifyId") Integer classifyId,
                                      @Param("goodsName") String goodsName,@Param("status") Integer status,@Param("shopId") Long shopId, @Param("shopName") String shopName);

    IPage<Goods> selectGoodsByShopId(Page<Goods> pages, @Param("shopId") Long shopId, @Param("goodsName") String goodsName,
                                     @Param("classifyId") Integer classifyId, @Param("status") Integer status);

    IPage<Goods> selectGoodsByNotShopId(Page<Goods> pages,@Param("shopId") Long shopId, @Param("goodsName") String goodsName);

    int addGoodsByShopId(@Param("goodsShopRelevancyList") List<GoodsShopRelevancy> goodsShopRelevancyList, @Param("date") String date);

    int deleteGoodsByShopId(@Param("shopId") Long shopId, @Param("goodsId") Long goodsId);

    int soldOutOrPutaway(@Param("shopId") Long shopId, @Param("goodsId") Long goodsId,@Param("status") Integer status);

    List<GoodsShop> selectListByAdmin(Long userId);

    int selectStoreCount(@Param("shopId") Long shopId,@Param("startTime") String startTime,@Param("endTime") String endTime);

    BigDecimal selectStoreMoney(@Param("shopId") Long shopId,@Param("startTime") String startTime,@Param("endTime") String endTime);

    IPage<TbOrder> selectStoreMessage(@Param("pages") Page<TbOrder> pages, @Param("shopId") Long shopId, @Param("startTime") String startTime, @Param("endTime") String endTime);

    IPage<GoodsShop> selectSearch(Page<GoodsShop> pages, String impotr, Double lng, Double lat, String city);

    IPage<GoodsShop> selectShop(Page<GoodsShop> pages, Integer screen, Integer shopTypeId, Double lng, Double lat, String city, String impotr,Long activityId);

    IPage<Evaluate> selectEvaluate(Page<Evaluate> pages, Long shopId, String goodsId, Integer grade);

    IPage<Evaluate> selectEvaluateByGoodsId(Page<Evaluate> pages, String goodsId,Integer grade);

  //  IPage<GoodsShop> selectShopList(Page<GoodsShop> pages, String shopName, Integer status, Integer shopType);

    int addGoodsShopRelevancy(GoodsShopRelevancy goodsShopRelevancy);

    IPage<GoodsShop> selectShopList(Page<GoodsShop> pages, String shopName, Integer status, Integer shopType);

    BigDecimal shopAllEarnings(Long shopId);

    BigDecimal shopEarningsDay(Long shopId, String date);

    BigDecimal shopEarningsMonth(Long shopId, String date);

    BigDecimal allMoney(Long shopId, String startTime, String endTime);

    int selectCountOrder(Long shopId, String startTime, String endTime, Integer status);

    int allCount(Long shopId, String startTime, String endTime);

    BigDecimal orderMoney(Long shopId, String startTime, String endTime);

    int sumCountOrder(Long shopId, String startTime, String endTime);

    BigDecimal refundMoney(Long shopId, String startTime, String endTime);

    int putawayCount(Long shopId);

    int soldoutCount(Long shopId);

    GoodsShop selectGoodsList(Long shopId, Double lng, Double lat);

    GoodsShop selectGoodShopByPhone(String phone);

    int selectGoodReputation(Long shopId, String goodsId);

    int selectMediumReview(Long shopId, String goodsId);

    int selectNegativeComment(Long shopId, String goodsId);

    int deleteGoods(Long shopId, Long goodsId);

    int updateShopSales(Integer type,Integer goodsNum, Long shopId);

    void updateCashDeposit(Double money, Long shopId);

    void updateShopCashDeposit(Long shopId, BigDecimal money, Integer type);

    int insertGoodsShop(GoodsShop goodsShop);

    Integer cancelActivityShop(@Param("activityId") Long activityId, @Param("shopId") Long shopId);

    IPage<GoodsShop> getShoActivityShopList(@Param("pages") Page<GoodsShop> pages, @Param("goodsShop") GoodsShop goodsShop);

    IPage<GoodsShop> getAdminShoActivityShopList(@Param("pages") Page<GoodsShop> pages, @Param("goodsShop") GoodsShop goodsShop);

    IPage<GoodsShop> selectSupplierShop(Page<GoodsShop> pages, Integer screen, Integer shopTypeId, Double lng, Double lat, String city, String impotr,Long activityId);

    GoodsShop getByAdminUserId(@Param("adminUserId") Long adminUserId);
}
