package com.usky.iot.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.iot.domain.BaseBuildEngineering;
import com.usky.iot.service.BaseBuildEngineeringService;
import com.usky.iot.service.BaseBuildEngineeringService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author han
 * @since 2026-02-03
 */
@RestController
@RequestMapping("/baseBuildEngineering")
public class BaseBuildEngineeringController {

    @Autowired
    private BaseBuildEngineeringService baseBuildEngineeringService;

    /**
     * 新增
     * @param baseBuildEngineering
     * @return
     */
    @PostMapping
    ApiResult<Void> add(@RequestBody BaseBuildEngineering baseBuildEngineering){
        baseBuildEngineeringService.add(baseBuildEngineering);
        return ApiResult.success();
    }

    /**
     * 修改
     * @param baseBuildEngineering
     * @return
     */
    @PutMapping
    ApiResult<Void> update(@RequestBody BaseBuildEngineering baseBuildEngineering){
        baseBuildEngineeringService.update(baseBuildEngineering);
        return ApiResult.success();
    }

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

    /**
     * 列表
     * @param id
     * @param buildId
     * @return
     */
    @GetMapping("baseBuildEngineeringList")
    ApiResult<List<BaseBuildEngineering>> baseBuildEngineeringList(@RequestParam(value = "id",required = false) Integer id,
                                                     @RequestParam(value = "buildId") Integer buildId){
        return ApiResult.success(baseBuildEngineeringService.baseBuildEngineeringList(id,buildId));
    }
}

