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.DmpProductCommand;
import com.usky.iot.service.DmpProductCommandService;
import com.usky.iot.service.vo.DmpProductCommandRequestVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 产品命令表 前端控制器
 * </p>
 *
 * @author han
 * @since 2024-10-30
 */
@RestController
@RequestMapping("/dmpProductCommand")
public class DmpProductCommandController {

    @Autowired
    private DmpProductCommandService dmpProductCommandService;

    /**
     * 新增
     * @param dmpProductCommand
     * @return
     */
    @PostMapping
    public ApiResult<Void> add(@RequestBody DmpProductCommand dmpProductCommand){
        dmpProductCommandService.add(dmpProductCommand);
        return ApiResult.success();
    }

    /**
     * 修改
     * @param dmpProductCommand
     * @return
     */
    @PutMapping
    public ApiResult<Void> edit(@RequestBody DmpProductCommand dmpProductCommand){
        dmpProductCommandService.edit(dmpProductCommand);
        return ApiResult.success();
    }


    /**
     * 分页
     * @param requestVO
     * @return
     */
    @PostMapping("/page")
    public ApiResult<CommonPage<DmpProductCommand>> page(@RequestBody DmpProductCommandRequestVO requestVO)
    {
        return ApiResult.success(dmpProductCommandService.page(requestVO));
    }



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

}

