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.SubsystemTemperature;
import com.evobms.project.battery.service.ISubsystemTemperatureService;
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/SubsystemTemperature")
@Api(tags = "可充电储能子系统温度信息")
public class SubsystemTemperatureController extends BaseController
{
    @Autowired
    private ISubsystemTemperatureService subsystemTemperatureService;

    /**
     * 查询可充电储能子系统温度信息列表
     */
    @PreAuthorize("@ss.hasPermi('Battery:SubsystemTemperature:list')")
    @GetMapping("/list")
    @ApiOperation("查询子系统温度信息列表")
    public TableDataInfo list(SubsystemTemperature subsystemTemperature)
    {
        startPage();
        List<SubsystemTemperature> list = subsystemTemperatureService.selectSubsystemTemperatureList(subsystemTemperature);
        return getDataTable(list);
    }

    /**
     * 导出可充电储能子系统温度信息列表
     */
    @PreAuthorize("@ss.hasPermi('Battery:SubsystemTemperature:export')")
    @Log(title = "可充电储能子系统温度信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出子系统温度信息列表")
    public void export(HttpServletResponse response, SubsystemTemperature subsystemTemperature)
    {
        List<SubsystemTemperature> list = subsystemTemperatureService.selectSubsystemTemperatureList(subsystemTemperature);
        ExcelUtil<SubsystemTemperature> util = new ExcelUtil<SubsystemTemperature>(SubsystemTemperature.class);
        util.exportExcel(response, list, "可充电储能子系统温度信息数据");
    }

    /**
     * 获取可充电储能子系统温度信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('Battery:SubsystemTemperature:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取子系统温度信息详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(subsystemTemperatureService.selectSubsystemTemperatureById(id));
    }

    /**
     * 新增可充电储能子系统温度信息
     */
    @PreAuthorize("@ss.hasPermi('Battery:SubsystemTemperature:add')")
    @Log(title = "可充电储能子系统温度信息", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增子系统温度信息")
    public AjaxResult add(@RequestBody SubsystemTemperature subsystemTemperature)
    {
        return toAjax(subsystemTemperatureService.insertSubsystemTemperature(subsystemTemperature));
    }

    /**
     * 修改可充电储能子系统温度信息
     */
    @PreAuthorize("@ss.hasPermi('Battery:SubsystemTemperature:edit')")
    @Log(title = "可充电储能子系统温度信息", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改子系统温度信息")
    public AjaxResult edit(@RequestBody SubsystemTemperature subsystemTemperature)
    {
        return toAjax(subsystemTemperatureService.updateSubsystemTemperature(subsystemTemperature));
    }

    /**
     * 删除可充电储能子系统温度信息
     */
    @PreAuthorize("@ss.hasPermi('Battery:SubsystemTemperature:remove')")
    @Log(title = "可充电储能子系统温度信息", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @ApiOperation("删除子系统温度信息")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(subsystemTemperatureService.deleteSubsystemTemperatureByIds(ids));
    }
}
