package com.miyzh.controller;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.miyzh.entity.UploadExceptionLog;
import com.miyzh.service.UploadExceptionLogService;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("search")
@RestController
public class SearchController {

    @Autowired
    private UploadExceptionLogService uploadExceptionLogService;

    @GetMapping("/exceptionList")
    public PageInfo<UploadExceptionLog> getExceptionList(@RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate, @RequestParam("page") int page, @RequestParam("pageSize") int pageSize) {
        PageInfo<UploadExceptionLog> pageInfo = PageHelper.startPage(page, pageSize).doSelectPageInfo(() -> {
            uploadExceptionLogService.listUploadExceptionLogByDate(startDate, endDate);
        });
        return pageInfo;
    }
}
