package org.springblade.gateway.common_gateway.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.gateway.common_gateway.dto.IndexCensusDto;
import org.springblade.gateway.common_gateway.service.IndexCensusService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Silent
 * @Description
 * @Date: Created in 16:20 2021/11/19
 * @Modified By:
 */
@RestController
@AllArgsConstructor
@RequestMapping("app/index/census")
@Api(value = "首页统计", tags = "首页统计接口")
public class IndexCensusController {
	private final IndexCensusService indexCensusService;

	/**
	 * 统计所有数量
	 */
	@GetMapping("/censusAllTotal")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "统计所有数量")
	public R<IndexCensusDto> censusAllTotal(){
		return R.data(indexCensusService.censusTotalCount(false));
	}

	/**
	 * 统计今天数量
	 */
	@GetMapping("/censusTodayTotal")
	@ApiOperationSupport(order = 2)
	@ApiOperation(value = "统计今日数量")
	public R<IndexCensusDto> censusTodayTotal(){
		return R.data(indexCensusService.censusTotalCount(true));
	}
}
