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.TpParabarDetail;
import com.ruoyi.project.business.service.ITpParabarDetailService;
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/detail")
public class TpParabarDetailController extends BaseController
{
    @Resource
    private ITpParabarDetailService tpParabarDetailService;

    /**
     * 查询参数包配置列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TpParabarDetail tpParabarDetail)
    {
        startPage();
        List<TpParabarDetail> list = tpParabarDetailService.selectTpParabarDetailList(tpParabarDetail);
        return getDataTable(list);
    }

    /**
     * 导出参数包配置列表
     */
    @Log(title = "参数包配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TpParabarDetail tpParabarDetail)
    {
        List<TpParabarDetail> list = tpParabarDetailService.selectTpParabarDetailList(tpParabarDetail);
        ExcelUtil<TpParabarDetail> util = new ExcelUtil<TpParabarDetail>(TpParabarDetail.class);
        util.exportExcel(response, list, "参数包配置数据");
    }

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

    /**
     * 新增参数包配置
     */
    @Log(title = "参数包配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TpParabarDetail tpParabarDetail)
    {
        return toAjax(tpParabarDetailService.insertTpParabarDetail(tpParabarDetail));
    }

    /**
     * 修改参数包配置
     */
    @Log(title = "参数包配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TpParabarDetail tpParabarDetail)
    {
        return toAjax(tpParabarDetailService.updateTpParabarDetail(tpParabarDetail));
    }

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