package com.ruoyi.web.controller.dz;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.syzy.domain.BWwwNewsRef;
import com.ruoyi.syzy.service.IBWwwNewsRefService;
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.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 通关指南Controller
 *
 * @author ie
 * @date 2026-01-20
 */
@RestController
@RequestMapping("/system/bWwwNewsRef")
public class BWwwNewsRefController extends BaseController
{
    @Autowired
    private IBWwwNewsRefService bWwwNewsRefService;

    /**
     * 查询通关指南列表
     */
    @PreAuthorize("@ss.hasPermi('system:bWwwNewsRef:list')")
    @GetMapping("/list")
    public TableDataInfo list(BWwwNewsRef bWwwNewsRef)
    {
        startPage();
        List<BWwwNewsRef> list = bWwwNewsRefService.selectBWwwNewsRefList(bWwwNewsRef);
        return getDataTable(list);
    }

    /**
     * 导出通关指南列表
     */
    @PreAuthorize("@ss.hasPermi('system:bWwwNewsRef:export')")
    @Log(title = "通关指南", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BWwwNewsRef bWwwNewsRef)
    {
        List<BWwwNewsRef> list = bWwwNewsRefService.selectBWwwNewsRefList(bWwwNewsRef);
        ExcelUtil<BWwwNewsRef> util = new ExcelUtil<BWwwNewsRef>(BWwwNewsRef.class);
        util.exportExcel(response, list, "通关指南数据");
    }

    /**
     * 获取通关指南详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:bWwwNewsRef:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bWwwNewsRefService.selectBWwwNewsRefById(id));
    }

    /**
     * 新增通关指南
     */
    @PreAuthorize("@ss.hasPermi('system:bWwwNewsRef:add')")
    @Log(title = "通关指南", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BWwwNewsRef bWwwNewsRef)
    {
        return toAjax(bWwwNewsRefService.insertBWwwNewsRef(bWwwNewsRef));
    }

    /**
     * 修改通关指南
     */
    @PreAuthorize("@ss.hasPermi('system:bWwwNewsRef:edit')")
    @Log(title = "通关指南", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BWwwNewsRef bWwwNewsRef)
    {
        return toAjax(bWwwNewsRefService.updateBWwwNewsRef(bWwwNewsRef));
    }

    /**
     * 删除通关指南
     */
    @PreAuthorize("@ss.hasPermi('system:bWwwNewsRef:remove')")
    @Log(title = "通关指南", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bWwwNewsRefService.deleteBWwwNewsRefByIds(ids));
    }
}
