package com.diagbot.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.diagbot.entity.OrderDetailStatus;
import com.diagbot.entity.OrderDetails;
import com.diagbot.entity.OrderDetailsIndex;
import com.diagbot.entity.wrapper.OrderDetailsWapper;
import com.diagbot.mapper.OrderDetailsMapper;
import com.diagbot.service.OrderDetailsService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 订单明细表 服务实现类
 * </p>
 *
 * @author gaodm
 * @since 2018-09-18
 */
@Service
public class OrderDetailsServiceImpl extends ServiceImpl<OrderDetailsMapper, OrderDetails> implements OrderDetailsService {
    /**
     * @Description: （审核）查询订单明细相关信息
     * @Author: wangyu
     * @Date: 15:25 2018/9/21
     */
    @Override
    public List<OrderDetailsWapper> seleAllOrderDetials(OrderDetailsIndex orderDetailsIndex) {
        return baseMapper.seleAllOrderDetials(orderDetailsIndex);
    }
    /**
     *根据订单编号查询所有订单明细审核状态
     *
     * @param orderNum
     * @return
     */
    @Override
    public OrderDetailStatus selectAllOrderDetialsByOrderNum(String orderNum) {
        return baseMapper.selectAllOrderDetialsByOrderNum(orderNum);
    }

    /**
     * 添加订单明细
     * @param list
     * @return Boolean
     */
    @Override
    public Boolean saveOrderDetails(List<OrderDetails> list) {
        return baseMapper.saveOrderDetails(list) ==0 ? true:false;
    }

    /**
     * 根据用户id查询正在审核中的产品id
     * @param userId
     * @return
     */
    @Override
    public List<Long> getOrderDetailsByUser(Long userId) {
        return baseMapper.getOrderDetailsByUser(userId);
    }


}
