package com.evobms.project.battery.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
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.evobms.framework.aspectj.lang.annotation.Log;
import com.evobms.framework.aspectj.lang.enums.BusinessType;
import com.evobms.project.battery.domain.ExtremeValues;
import com.evobms.project.battery.service.IExtremeValuesService;
import com.evobms.framework.web.controller.BaseController;
import com.evobms.framework.web.domain.AjaxResult;
import com.evobms.common.utils.poi.ExcelUtil;
import com.evobms.framework.web.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 电池极值数据Controller
 *
 * @author 田志阳
 * @date 2025-11-15
 */
@RestController
@RequestMapping("/Battery/ExtremeValues")
@Api(tags = "电池极值数据")
public class ExtremeValuesController extends BaseController
{
    @Autowired
    private IExtremeValuesService extremeValuesService;

    /**
     * 查询电池极值数据列表
     */
    @PreAuthorize("@ss.hasPermi('Battery:ExtremeValues:list')")
    @GetMapping("/list")
    @ApiOperation("查询电池极值数据列表")
    public TableDataInfo list(ExtremeValues extremeValues)
    {
        startPage();
        List<ExtremeValues> list = extremeValuesService.selectExtremeValuesList(extremeValues);
        return getDataTable(list);
    }

    /**
     * 导出电池极值数据列表
     */
    @PreAuthorize("@ss.hasPermi('Battery:ExtremeValues:export')")
    @Log(title = "电池极值数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出电池极值数据列表")
    public void export(HttpServletResponse response, ExtremeValues extremeValues)
    {
        List<ExtremeValues> list = extremeValuesService.selectExtremeValuesList(extremeValues);
        ExcelUtil<ExtremeValues> util = new ExcelUtil<ExtremeValues>(ExtremeValues.class);
        util.exportExcel(response, list, "电池极值数据数据");
    }

    /**
     * 获取电池极值数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('Battery:ExtremeValues:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取电池极值数据详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(extremeValuesService.selectExtremeValuesById(id));
    }

    /**
     * 新增电池极值数据
     */
    @PreAuthorize("@ss.hasPermi('Battery:ExtremeValues:add')")
    @Log(title = "电池极值数据", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增电池极值数据")
    public AjaxResult add(@RequestBody ExtremeValues extremeValues)
    {
        return toAjax(extremeValuesService.insertExtremeValues(extremeValues));
    }

    /**
     * 修改电池极值数据
     */
    @PreAuthorize("@ss.hasPermi('Battery:ExtremeValues:edit')")
    @Log(title = "电池极值数据", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改电池极值数据")
    public AjaxResult edit(@RequestBody ExtremeValues extremeValues)
    {
        return toAjax(extremeValuesService.updateExtremeValues(extremeValues));
    }

    /**
     * 删除电池极值数据
     */
    @PreAuthorize("@ss.hasPermi('Battery:ExtremeValues:remove')")
    @Log(title = "电池极值数据", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @ApiOperation("删除电池极值数据")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(extremeValuesService.deleteExtremeValuesByIds(ids));
    }
}
