package com.sptg.gateway.controller;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.estate.api.dto.BuildingDto;
import com.sptg.estate.api.dto.EstateRepairDto;
import com.sptg.estate.api.entity.Building;
import com.sptg.estate.api.entity.EstateRepair;
import com.sptg.estate.api.feigns.BuildingFeign;
import com.sptg.estate.api.feigns.EstateRepairFeign;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ddf.EscherDggRecord;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/grid/estateRepair")
public class EstateRepairController {

    private final EstateRepairFeign estateRepairFeign;

    /**
     * 功能描述:物业报修查询
     *
     * @return List<EstateRepair>
     *
     *
     */
    @GetMapping(value = "/sync")
    public List<EstateRepair> sync(){
        Page<EstateRepair> page = new Page<>();
        page.setCurrent(1);
        page.setSize(999999999);
        EstateRepairDto estateRepairDto = new EstateRepairDto();
        estateRepairDto.setPage(page);
        ResultBean<Page<EstateRepair>> pageResultBean = this.estateRepairFeign.showEstateRepairList(estateRepairDto);
        if(pageResultBean !=null){
            if(pageResultBean.getData()!=null){
                return pageResultBean.getData().getRecords();
            }
        }
        return null;
    }

}
