package com.dayou.controller;

import com.dayou.annotation.DataPermission;
import com.dayou.common.RestResponse;
import com.dayou.dto.MarketStatDTO;
import com.dayou.service.IMarketStatService;
import com.dayou.vo.MarketStatVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.dayou.common.Constants.MANAGER_OFFICE;

/**
 * 全局配置
 *
 * @author wucl
 * @since 2023-01-13
 */
@RestController
@RequestMapping("marketStat")
@Slf4j
public class MarketStatController {

    @Autowired
    private IMarketStatService marketStatService;

    /**
     * 市场首页统计数据
     * @return
     */
    @DataPermission(teamData = true,postChild = false,ignoreDepartment = {MANAGER_OFFICE})
    @GetMapping("")
    public RestResponse<MarketStatVO> marketStat(MarketStatDTO dto){
        MarketStatVO marketStatVO = marketStatService.marketStat(dto);
        return RestResponse.data(marketStatVO);
    }
}
