package com.czg.service.order.service.impl;

import cn.hutool.core.date.DateUtil;
import com.czg.config.RabbitPublisher;
import com.czg.order.entity.OrderDetail;
import com.czg.order.service.OrderDetailService;
import com.czg.order.vo.OrderDetailPrintVo;
import com.czg.service.order.mapper.OrderDetailMapper;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboService;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 订单详情 服务层实现。
 *
 * @author ww
 * @since 2025-02-13
 */
@DubboService
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, OrderDetail> implements OrderDetailService {

    @Override
    public void createOrderDetails(Long orderId, List<OrderDetail> orderDetails) {
        getMapper().createOrderDetails(orderId, orderDetails);
    }

    @Override
    public List<OrderDetailPrintVo> getOrderDetailPrint(Long orderId) {
        return getMapper().getOrderDetailPrint(orderId);
    }

    @Override
    public void updateOrderDetailStatus(Long orderId,String status) {
        getMapper().updateStatusByOrderId(orderId, status, LocalDateTime.now());
    }
}
