package com.jiayue.insu.inclientqn.controller;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jiayue.insu.common.core.util.R;
import com.jiayue.insu.inclientqn.entity.BackForeUsForecastData;
import com.jiayue.insu.inclientqn.entity.BackStatData;
import com.jiayue.insu.inclientqn.service.BackForeUsForecastDataService;
import com.jiayue.insu.inclientqn.service.BackStatDataService;
import com.jiayue.insu.inclientqn.util.DateTimeUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;


/**
 * backForeForecstData
 *
 * @author yh
 * @date 2022-03-18 15:48:48
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/backStatData")
public class BackStatDataController {

    private final BackStatDataService backStatDataService;

    /**
     * 分页查询
     *
     * @param page   分页对象
     * @return
     */

    @GetMapping("/page")
    public R getPage(Page page, String startTime, String endTime) {
            LambdaQueryWrapper<BackStatData> lambdaQueryWrapper = new LambdaQueryWrapper<>();


        if(startTime!=null && endTime!=null){
            lambdaQueryWrapper.between(BackStatData::getSignTime, startTime,endTime);

        }
        lambdaQueryWrapper.orderByAsc(BackStatData::getSignTime);

        return R.ok(backStatDataService.page(page, lambdaQueryWrapper));
    }





}
