package com.jeesharp.business.modules.food.service.impl;

import com.jeesharp.business.modules.food.mapper.FoodStatisticsMapper;
import com.jeesharp.business.modules.food.service.FoodStatisticsService;
import com.jeesharp.business.modules.food.vo.FoodCompanyMealStatisticsVO;
import com.jeesharp.business.modules.food.vo.FoodDishSalesStatisticsVO;
import com.jeesharp.business.modules.food.vo.FoodOrderStatisticsVO;
import com.jeesharp.business.modules.food.vo.FoodPaymentStatisticsVO;
import com.jeesharp.business.modules.food.vo.FoodStatisticsQueryVO;
import com.jeesharp.framework.utils.WebFrameworkUtils;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@AllArgsConstructor
@Transactional(readOnly = true)
public class FoodStatisticsServiceImpl implements FoodStatisticsService {

    private final FoodStatisticsMapper foodStatisticsMapper;

    @Override
    public List<FoodOrderStatisticsVO> orderStatistics(FoodStatisticsQueryVO query) {
        return foodStatisticsMapper.selectOrderStatistics(query, WebFrameworkUtils.getLoginUserTenantCode());
    }

    @Override
    public List<FoodPaymentStatisticsVO> paymentStatistics(FoodStatisticsQueryVO query) {
        return foodStatisticsMapper.selectPaymentStatistics(query, WebFrameworkUtils.getLoginUserTenantCode());
    }

    @Override
    public List<FoodCompanyMealStatisticsVO> companyMealStatistics(FoodStatisticsQueryVO query) {
        return foodStatisticsMapper.selectCompanyMealStatistics(query, WebFrameworkUtils.getLoginUserTenantCode());
    }

    @Override
    public List<FoodDishSalesStatisticsVO> dishSalesStatistics(FoodStatisticsQueryVO query) {
        return foodStatisticsMapper.selectDishSalesStatistics(query, WebFrameworkUtils.getLoginUserTenantCode());
    }
}
