package com.njyunzhi.pet_identity.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njyunzhi.pet_identity.common.BaseController;
import com.njyunzhi.pet_identity.common.Constants;
import com.njyunzhi.pet_identity.common.ResponseBean;
import com.njyunzhi.pet_identity.vo.StatisValue;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.njyunzhi.pet_identity.service.ITsCommonFormService;
import com.njyunzhi.pet_identity.entity.TsCommonForm;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
    * 通用统计 前端控制器
    * </p>
 *
 * @author yansen
 * @since 2022-05-28
 */

@Api(tags = "通用统计")
@RestController
@RequestMapping("/admin/statis")
public class TsCommonFormController extends BaseController {

    private final Logger logger = LoggerFactory.getLogger(TsCommonFormController.class);

    @Autowired
    public ITsCommonFormService iTsCommonFormService;


    /**
     * 统计日提交
     * @param startDate
     * @param days
     * @return
     */
    @RequestMapping(value="/applyDaily",method= RequestMethod.GET)
    @ApiOperation(value="统计日提交", notes = "统计日提交", httpMethod = "GET", response = ResponseBean.class)
    public ResponseBean getApplyDaily(@ApiParam(value = "起始日期", example = "2022-05-01") @RequestParam(value ="startDate") String startDate,
									 @ApiParam("统计天数") @RequestParam(value ="days",defaultValue = "10") Integer days) throws Exception{

        List<StatisValue> result = iTsCommonFormService.getStatisDataBy(Constants.STATIS_APPLICATION_DAILY, startDate, days);
        return ResponseBean.success(result);
    }

}
