package com.usky.iot.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.common.core.bean.CommonPage;
import com.usky.iot.domain.BaseBuildFacilityType;
import com.usky.iot.service.BaseBuildFacilityTypeService;
import com.usky.iot.service.vo.BaseBuildFacilityTypeRequestVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 * 建筑设施类型 前端控制器
 * </p>
 *
 * @author han
 * @since 2023-07-26
 */
@RestController
@RequestMapping("/baseBuildFacilityType")
public class BaseBuildFacilityTypeController {

    @Autowired
    private BaseBuildFacilityTypeService baseBuildFacilityTypeService;

    /**
     * 新增
     * @param baseBuildFacilityType
     * @return
     */
    @PostMapping
    public ApiResult<Void> add(@RequestBody BaseBuildFacilityType baseBuildFacilityType){
        baseBuildFacilityTypeService.add(baseBuildFacilityType);
        return ApiResult.success();
    }

    /**
     * 修改
     * @param baseBuildFacilityType
     * @return
     */
    @PutMapping
    public ApiResult<Void> update(@RequestBody BaseBuildFacilityType baseBuildFacilityType){
        baseBuildFacilityTypeService.update(baseBuildFacilityType);
        return ApiResult.success();
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    public ApiResult<Void> remove(@PathVariable("id") Integer id){
        baseBuildFacilityTypeService.remove(id);
        return ApiResult.success();
    }

    /**
     * 分页
     * @param baseBuildFacilityTypeRequestVO
     * @return
     */
    @PostMapping("page")
    public ApiResult<CommonPage<BaseBuildFacilityType>> page(@RequestBody BaseBuildFacilityTypeRequestVO baseBuildFacilityTypeRequestVO){
        return ApiResult.success(baseBuildFacilityTypeService.page(baseBuildFacilityTypeRequestVO));
    }

}










