package com.iamberry.wechat.service.mapper;

import java.util.List;

import com.iamberry.wechat.core.entity.PaperBean;
import com.iamberry.wechat.core.entity.cart.CartDto;
import com.iamberry.wechat.core.entity.cart.ShopOrderAndItemDto;
import com.iamberry.wechat.core.entity.cart.ShopOrderItemDto;
import com.iamberry.wechat.core.entity.cart.ShopSalesOrderDto;
import com.iamberry.wechat.core.entity.coupon.CouponItem;
import com.iamberry.wechat.core.entity.coupon.CouponType;
import com.iamberry.wechat.core.entity.order.Order;
import com.iamberry.wechat.core.entity.product.SalesUserGift;

public interface CartMapper {

	//根据用户id查询购物车
	public List<CartDto> selectCartByOpenId(String openId);
	
	//根据用户id查询购物车数量
	public Integer getCartNumByCartOpenId(String openId);
	
	//修改购物车数量
	public Integer updateCartByOpenId(CartDto cartDto);
	
	//根据购物车id和openid查询购物车数量
	public Integer getCartNumByOpenId(CartDto cartDto);
	
	//根据商品id和用户openid查询购物车是否有该商品
	public CartDto getCartByCartProductId(CartDto cartDto);
	
	//添加商品到购物车
	public Integer addProductToCart(CartDto cartDto);
	
	//根据cartid删除购物车信息
	public Integer deleteCartByCartId(CartDto cartDto);
	
	//分页查询订单信息
	public List<ShopOrderAndItemDto> selectShopOrder(PaperBean paperBean);
	
	//根据openid查询订单数量
	public Integer getOrderNumByOpenId(PaperBean paperBean);
	
	//根据订单id查询订单项
	public List<ShopOrderItemDto> selectShopOrderItem(String itemSalesOrderid);
	
	//根据订单号查询订单信息
	public ShopSalesOrderDto getShopOrderByOrderId(String salesOrderId, String salesOpenId);
	
	/**
	 * 根据购物车ID，获取购物项
	 * @param carts
	 * @return
	 */
	public List<CartDto> selectCartItemByListId(Integer[] carts);

	/**
	 * 批量获取购物车集合
	 * @param carts
	 * @return
	 */
	List<CartDto> listCartByIds(Integer[] carts);

	/**
	 * 查询购物车产品颜色信息
	 * @param cartDto
	 * @return
	 */
	CartDto selectCartProductColor(CartDto cartDto);

	/**
	 * 查询购物车产品配件信息
	 * @param cartDto
	 * @return
	 */
	CartDto getCartProductFitting(CartDto cartDto);
	
	//根据orderid查询用户openid和订单状态
	public ShopSalesOrderDto getOpenIdAndStatus(String salesOrderid);
	
	//修改订单状态和添加备注
	public Integer updateOrderByOrderId(Order order);
	
	/**
	 * 根据ID，批量删除购物车ID
	 */
	public Integer deleteBatchCartListById(List<Integer> cartIds);
	
	/**
	 *  根据优惠券id获取优惠券优惠价格
	 * @param couponId
	 * @return
	 * @author liuzhiwei
	 */
	public CouponType getCouponReduceByItemId(CouponItem couponItem);
	
	/**
	 * 根据openid查看订单列表，不分页
	 * @param shopSalesOrderDto
	 * @return
	 */
	public List<ShopSalesOrderDto> getOrderList(ShopSalesOrderDto shopSalesOrderDto);

	/**
	 * 查询购买产品的赠品信息
	 * @param cartColorId
	 * @return
	 */
	List<SalesUserGift> listGift(Integer cartColorId);

	/**
	 * 查询赠品集合
	 * @param gift
	 * @return
	 */
	List<SalesUserGift> listSelectGift(SalesUserGift gift);

	/**
	 * 修改发货提醒次数
	 * @param order
	 * @return
	 */
	Integer updateSendWarnNum(Order order);

	/**
	 * 根据商品id和openid查询购物车数量和ID
	 * **/
	CartDto getCartByOpenId(CartDto cartDto);
}
