package com.sptg.estate.api.feigns;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.estate.api.dto.CarDto;
import com.sptg.estate.api.entity.Car;
import com.sptg.estate.api.feigns.fallback.CarFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(value = "smart-house-estate",fallbackFactory = CarFeignFallbackFactory.class)
public interface CarFeign {

    /**
     * 分页
     * @param dto
     * @return
     */
    @PostMapping(value = "/car/page")
    ResultBean<Page<Car>> page(@RequestBody CarDto dto);

    /**
     * 分页
     * @param id
     * @return
     */
    @PostMapping(value = "/car/getById")
    Car getById(@RequestBody Long id);

    /**
     * 新增
     * @param dto
     * @return
     */
    @PostMapping(value = "car/add")
    ResultBean<Boolean> add(@RequestBody CarDto dto);

    /**
     * 新增
     * @param dto
     * @return
     */
    @PostMapping(value = "car/addByApp")
    ResultBean<Boolean> addByApp(@RequestBody CarDto dto);

    /**
     * 修改
     * @param dto
     * @return
     */
    @PostMapping(value = "car/edit")
    ResultBean<Boolean> edit(@RequestBody CarDto dto);

    /**
     * 删除
     * @param dto
     * @return
     */
    @PostMapping(value = "car/delete")
    ResultBean<Boolean> delete(@RequestBody CarDto dto);
}
