package vip.xiaonuo.production.controller;


import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.production.entity.ProductionWriteEnergy;
import vip.xiaonuo.production.param.ProductionLocationEditParam;
import vip.xiaonuo.production.param.ProductionLocationParam;
import vip.xiaonuo.production.param.ProductionWriteEnergyAddParam;
import vip.xiaonuo.production.service.IProductionWriteEnergyService;

import java.util.Map;

/**
 * <p>
 * 车间能耗数据填报 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-01-07
 */
@RestController
@RequestMapping("/production-write-energy")
@Api(tags = "车间能耗数据填报")
@ApiSupport(author = "wang", order = 1)
@Validated
public class ProductionWriteEnergyController {

    @Autowired
    private IProductionWriteEnergyService energyService;

    @PostMapping("/produce-location/add")
    @ApiOperationSupport(order = 1)
    @ApiOperation("能耗数据填报添加")
    public CommonResult add(@RequestBody ProductionWriteEnergyAddParam addParam) {
        return energyService.add(addParam);
    }

    @PostMapping("/produce-location/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation("能耗数据填报列表")
    public CommonResult list(@RequestBody Map<String,String> paramsMap) {
        return energyService.list(paramsMap);
    }

    @PostMapping("/produce-location/edit")
    @ApiOperationSupport(order = 3)
    @ApiOperation("能耗数据填报修改")
    public CommonResult edit(@RequestBody ProductionWriteEnergy writeEnergy) {
        return energyService.edit(writeEnergy);
    }

    @PostMapping("/produce-location/delete")
    @ApiOperationSupport(order = 4)
    @ApiOperation("能耗数据填报删除")
    public CommonResult delete(@RequestBody Map<String, String> paramsMap) {
        return energyService.delete(paramsMap);
    }

    @PostMapping("/produce-location/page")
    @ApiOperationSupport(order = 5)
    @ApiOperation("能耗数据填报列表")
    public CommonResult page(@RequestBody Map<String,String> paramsMap) {
        return energyService.page(paramsMap);
    }
}
