package com.jiayue.insu.inclientqn.controller;

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.CorrectUltraShortTerm;
import com.jiayue.insu.inclientqn.entity.RepairPlan;
import com.jiayue.insu.inclientqn.service.CorrectUltraShortTermService;
import com.jiayue.insu.inclientqn.service.RepairPlanService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


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

    private final RepairPlanService repairPlanService;

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

    @GetMapping("/page")
    public R getPage(Page page, RepairPlan repairPlan) {

        LambdaQueryWrapper<RepairPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();


        if(repairPlan.getSignTime()!=null ){
            lambdaQueryWrapper.eq(RepairPlan::getSignTime, repairPlan.getSignTime());
        }

        lambdaQueryWrapper.orderByAsc(RepairPlan::getStartTime);
        return R.ok(repairPlanService.page(page, lambdaQueryWrapper));
    }





}
