package com.jjt.inventory.controller;

import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jjt.common.annotation.Log;
import com.jjt.common.core.controller.BaseController;
import com.jjt.common.core.domain.AjaxResult;
import com.jjt.common.enums.BusinessType;
import com.jjt.inventory.domain.TwinCalcDayBp;
import com.jjt.inventory.service.ITwinCalcDayBpService;
import com.jjt.common.utils.poi.ExcelUtil;
import com.jjt.common.core.page.TableDataInfo;

/**
 * 白坯库日统计数据Controller
 *
 * @author wukai
 * @date 2025-06-13
 */
@Api(tags="白坯库日统计数据")
@RestController
@RequestMapping("/inventory/bpDay")
public class TwinCalcDayBpController extends BaseController{
    @Resource
    private ITwinCalcDayBpService twinCalcDayBpService;

    /**
     * 查询白坯库日统计数据列表
     */
    @ApiOperation("查询白坯库日统计数据列表")
    //@PreAuthorize("@ss.hasPermi('inventory:bpDay:list')")
    @GetMapping("/list")
    public TableDataInfo list(TwinCalcDayBp twinCalcDayBp)
    {
        startPage();
        List<TwinCalcDayBp> list = twinCalcDayBpService.selectTwinCalcDayBpList(twinCalcDayBp);
        return getDataTable(list);
    }

    /**
     * 导出白坯库日统计数据列表
     */
    @ApiOperation("导出白坯库日统计数据列表")
    //@PreAuthorize("@ss.hasPermi('inventory:bpDay:export')")
    @Log(title = "白坯库日统计数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TwinCalcDayBp twinCalcDayBp)
    {
        List<TwinCalcDayBp> list = twinCalcDayBpService.selectTwinCalcDayBpList(twinCalcDayBp);
        ExcelUtil<TwinCalcDayBp> util = new ExcelUtil<TwinCalcDayBp>(TwinCalcDayBp.class);
        util.exportExcel(response, list, "白坯库日统计数据数据");
    }

    /**
     * 获取白坯库日统计数据详细信息
     */
    @ApiOperation("获取白坯库日统计数据详细信息")
    //@PreAuthorize("@ss.hasPermi('inventory:bpDay:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(twinCalcDayBpService.selectTwinCalcDayBpById(id));
    }

    /**
     * 新增白坯库日统计数据
     */
    @ApiOperation("新增白坯库日统计数据")
    //@PreAuthorize("@ss.hasPermi('inventory:bpDay:add')")
    @Log(title = "白坯库日统计数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TwinCalcDayBp twinCalcDayBp)
    {
        return toAjax(twinCalcDayBpService.insertTwinCalcDayBp(twinCalcDayBp));
    }

    /**
     * 修改白坯库日统计数据
     */
    @ApiOperation("修改白坯库日统计数据")
    //@PreAuthorize("@ss.hasPermi('inventory:bpDay:edit')")
    @Log(title = "白坯库日统计数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TwinCalcDayBp twinCalcDayBp)
    {
        return toAjax(twinCalcDayBpService.updateTwinCalcDayBp(twinCalcDayBp));
    }

    /**
     * 删除白坯库日统计数据
     */
    @ApiOperation("删除白坯库日统计数据")
    //@PreAuthorize("@ss.hasPermi('inventory:bpDay:remove')")
    @Log(title = "白坯库日统计数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(twinCalcDayBpService.deleteTwinCalcDayBpByIds(ids));
    }
}
