package com.sptg.estate.biz.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.FaceChargeProjectDto;
import com.sptg.estate.api.entity.FaceChargeProject;
import com.sptg.estate.api.feigns.FaceChargeProjectFeign;
import com.sptg.estate.biz.service.FaceChargeProjectServiceInterface;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * title: FaceChargeProjectController
 * package: com.sptg.estate.biz.controller
 * description: 人脸套餐 控制器
 *
 */

@RestController
@RequiredArgsConstructor
public class FaceChargeProjectController implements FaceChargeProjectFeign {

    private final FaceChargeProjectServiceInterface faceChargeProjectServiceInterface;


    @Override
    @PostMapping(value = "/faceChargeProject/showFaceChargeProjectList")
    public ResultBean<Page<FaceChargeProject>> showFaceChargeProjectList(@RequestBody FaceChargeProjectDto dto) {
        return faceChargeProjectServiceInterface.showFaceChargeProjectList(dto);
    }

    @Override
    @PostMapping(value = "/faceChargeProject/getListByResidentialId")
    public List<FaceChargeProject> getListByResidentialId(@RequestParam("residentialId") Long residentialId) {
        return faceChargeProjectServiceInterface.getListByResidentialId(residentialId);
    }

    @Override
    @PostMapping(value = "/faceChargeProject/getListByResidentialIdAndDate")
    public List<FaceChargeProject> getListByResidentialIdAndDate(@RequestParam("residentialId") Long residentialId) {
        return faceChargeProjectServiceInterface.getListByResidentialIdAndDate(residentialId);
    }
    @Override
    @PostMapping(value = "/faceChargeProject/selectByResidentialId")
    public ResultBean<FaceChargeProject> selectByResidentialId(@RequestBody Long residentialId) {
        return faceChargeProjectServiceInterface.selectByResidentialId(residentialId);
    }

    @Override
    @PostMapping(value = "/faceChargeProject/getList")
    public List<FaceChargeProject> getList(@RequestBody FaceChargeProjectDto dto) {
        return faceChargeProjectServiceInterface.getList(dto);
    }

    @Override
    @PostMapping(value = "/faceChargeProject/getOneFaceChargeProject")
    public ResultBean<FaceChargeProject> getOneFaceChargeProject(@RequestBody FaceChargeProjectDto dto) {
        return faceChargeProjectServiceInterface.getOneFaceChargeProject(dto);
    }

    @Override
    @PostMapping(value = "/faceChargeProject/getOneNotInId")
    public FaceChargeProject getOneNotInId(@RequestBody FaceChargeProjectDto dto) {
        return faceChargeProjectServiceInterface.getOneNotInId(dto);
    }

    @Override
    @PostMapping(value = "/faceChargeProject/addFaceChargeProject")
    public ResultBean<Boolean> addFaceChargeProject(@RequestBody FaceChargeProjectDto dto) {
        return faceChargeProjectServiceInterface.addFaceChargeProject(dto);
    }

    @Override
    @PostMapping(value = "/faceChargeProject/getFaceChargeProjectById")
    public FaceChargeProject getFaceChargeProjectById(@RequestParam("id") Long id) {
        return faceChargeProjectServiceInterface.getFaceChargeProjectById(id);
    }

    @Override
    @PostMapping(value = "/faceChargeProject/updateFaceChargeProject")
    public ResultBean<Boolean>updateFaceChargeProject(@RequestBody FaceChargeProjectDto dto) {
        return faceChargeProjectServiceInterface.updateFaceChargeProject(dto);
    }

    @Override
    @PostMapping(value = "/faceChargeProject/deleteFaceChargeProject")
    public ResultBean<Boolean> deleteFaceChargeProject(@RequestBody FaceChargeProjectDto dto) {
        return faceChargeProjectServiceInterface.deleteFaceChargeProject(dto);
    }

    @Override
    @PostMapping(value = "/faceChargeProject/getByOldId/{oldId}")
    public FaceChargeProject getByOldId(@PathVariable(value = "oldId") String oldId) {
        return this.faceChargeProjectServiceInterface.getByOldId(oldId);
    }

    @Override
    @PostMapping(value = "/faceChargeProject/updateBathFaceChargeProject")
    public Boolean updateBathFaceChargeProject(List<FaceChargeProject> faceChargeProjectList) {
        return this.faceChargeProjectServiceInterface.updateBatchById(faceChargeProjectList);
    }

    @Override
    @PostMapping(value = "/faceChargeProject/putStatusChange")
    public ResultBean<Boolean> putStatusChange(@RequestBody FaceChargeProjectDto dto) {
        return new ResultBean<>(ResultEnum.SUCCESS,this.faceChargeProjectServiceInterface.updateById(dto));
    }

}
