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.SubsystemVoltage;
import com.evobms.project.Battery.service.ISubsystemVoltageService;
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;

/**
 * 可充电储能子系统电压信息Controller
 * 
 * @author 田志阳
 * @date 2025-11-15
 */
@RestController
@RequestMapping("/voltage/voltage")
public class SubsystemVoltageController extends BaseController
{
    @Autowired
    private ISubsystemVoltageService subsystemVoltageService;

    /**
     * 查询可充电储能子系统电压信息列表
     */
    @PreAuthorize("@ss.hasPermi('voltage:voltage:list')")
    @GetMapping("/list")
    public TableDataInfo list(SubsystemVoltage subsystemVoltage)
    {
        startPage();
        List<SubsystemVoltage> list = subsystemVoltageService.selectSubsystemVoltageList(subsystemVoltage);
        return getDataTable(list);
    }

    /**
     * 导出可充电储能子系统电压信息列表
     */
    @PreAuthorize("@ss.hasPermi('voltage:voltage:export')")
    @Log(title = "可充电储能子系统电压信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SubsystemVoltage subsystemVoltage)
    {
        List<SubsystemVoltage> list = subsystemVoltageService.selectSubsystemVoltageList(subsystemVoltage);
        ExcelUtil<SubsystemVoltage> util = new ExcelUtil<SubsystemVoltage>(SubsystemVoltage.class);
        util.exportExcel(response, list, "可充电储能子系统电压信息数据");
    }

    /**
     * 获取可充电储能子系统电压信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('voltage:voltage:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(subsystemVoltageService.selectSubsystemVoltageById(id));
    }

    /**
     * 新增可充电储能子系统电压信息
     */
    @PreAuthorize("@ss.hasPermi('voltage:voltage:add')")
    @Log(title = "可充电储能子系统电压信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SubsystemVoltage subsystemVoltage)
    {
        return toAjax(subsystemVoltageService.insertSubsystemVoltage(subsystemVoltage));
    }

    /**
     * 修改可充电储能子系统电压信息
     */
    @PreAuthorize("@ss.hasPermi('voltage:voltage:edit')")
    @Log(title = "可充电储能子系统电压信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SubsystemVoltage subsystemVoltage)
    {
        return toAjax(subsystemVoltageService.updateSubsystemVoltage(subsystemVoltage));
    }

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