package com.seer.teach.mall.app.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.seer.teach.mall.entity.OrderEntity;
import com.seer.teach.mall.mapper.OrderMapper;
import com.seer.teach.mall.app.order.service.IAppOrderQueryService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
@Slf4j
@RequiredArgsConstructor
public class AppOrderQueryServiceImpl implements IAppOrderQueryService {

    private final OrderMapper orderMapper;

    @Override
    public List<OrderEntity> queryOrderList(Integer OrderId) {
        return orderMapper.selectList(new LambdaQueryWrapper<>(OrderEntity.class).eq(OrderEntity::getId, OrderId));
    }

    @Override
    public OrderEntity queryOne(Integer OrderId) {
        return orderMapper.selectById(OrderId);
    }

    @Override
    public OrderEntity queryOne(Integer userId, Integer OrderId) {
        return orderMapper.selectOne(new LambdaQueryWrapper<>(OrderEntity.class).eq(OrderEntity::getId, OrderId).eq(OrderEntity::getUserId, userId));
    }

    @Override
    public List<OrderEntity> queryOrderListByUserId(Integer userId) {
        return Collections.emptyList();
    }

    @Override
    public OrderEntity queryOrderByOrderSn(String OrderSn) {
        return null;
    }
}
