package com.ruoyi.project.business.controller;

import java.util.List;
import javax.annotation.Resource;
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.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.business.domain.TpParabarDetailValue;
import com.ruoyi.project.business.service.ITpParabarDetailValueService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 配置参数明细Controller
 * 
 * @author ruoyi
 * @date 2024-04-28
 */
@RestController
@RequestMapping("/business/value")
public class TpParabarDetailValueController extends BaseController
{
    @Resource
    private ITpParabarDetailValueService tpParabarDetailValueService;

    /**
     * 查询配置参数明细列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TpParabarDetailValue tpParabarDetailValue)
    {
        startPage();
        List<TpParabarDetailValue> list = tpParabarDetailValueService.selectTpParabarDetailValueList(tpParabarDetailValue);
        return getDataTable(list);
    }

    /**
     * 导出配置参数明细列表
     */
    @Log(title = "配置参数明细", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TpParabarDetailValue tpParabarDetailValue)
    {
        List<TpParabarDetailValue> list = tpParabarDetailValueService.selectTpParabarDetailValueList(tpParabarDetailValue);
        ExcelUtil<TpParabarDetailValue> util = new ExcelUtil<TpParabarDetailValue>(TpParabarDetailValue.class);
        util.exportExcel(response, list, "配置参数明细数据");
    }

    /**
     * 获取配置参数明细详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tpParabarDetailValueService.selectTpParabarDetailValueById(id));
    }

    /**
     * 新增配置参数明细
     */
    @Log(title = "配置参数明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TpParabarDetailValue tpParabarDetailValue)
    {
        return toAjax(tpParabarDetailValueService.insertTpParabarDetailValue(tpParabarDetailValue));
    }

    /**
     * 修改配置参数明细
     */
    @Log(title = "配置参数明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TpParabarDetailValue tpParabarDetailValue)
    {
        return toAjax(tpParabarDetailValueService.updateTpParabarDetailValue(tpParabarDetailValue));
    }

    /**
     * 删除配置参数明细
     */
    @Log(title = "配置参数明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tpParabarDetailValueService.deleteTpParabarDetailValueByIds(ids));
    }
}
