package com.ruoyi.web.controller.dz;

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

import com.ruoyi.syzy.domain.BWwwNews;
import com.ruoyi.syzy.service.IBWwwNewsService;
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/bWwwNews")
public class BWwwNewsController extends BaseController
{
    @Autowired
    private IBWwwNewsService bWwwNewsService;

    /**
     * 查询资讯管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:bWwwNews:list')")
    @GetMapping("/list")
    public TableDataInfo list(BWwwNews bWwwNews)
    {
        startPage();
        List<BWwwNews> list = bWwwNewsService.selectBWwwNewsList(bWwwNews);
        return getDataTable(list);
    }

    /**
     * 导出资讯管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:bWwwNews:export')")
    @Log(title = "资讯管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BWwwNews bWwwNews)
    {
        List<BWwwNews> list = bWwwNewsService.selectBWwwNewsList(bWwwNews);
        ExcelUtil<BWwwNews> util = new ExcelUtil<BWwwNews>(BWwwNews.class);
        util.exportExcel(response, list, "资讯管理数据");
    }

    /**
     * 获取资讯管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:bWwwNews:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bWwwNewsService.selectBWwwNewsById(id));
    }

    /**
     * 新增资讯管理
     */
    @PreAuthorize("@ss.hasPermi('system:bWwwNews:add')")
    @Log(title = "资讯管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BWwwNews bWwwNews)
    {
        return toAjax(bWwwNewsService.insertBWwwNews(bWwwNews));
    }

    /**
     * 修改资讯管理
     */
    @PreAuthorize("@ss.hasPermi('system:bWwwNews:edit')")
    @Log(title = "资讯管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BWwwNews bWwwNews)
    {
        return toAjax(bWwwNewsService.updateBWwwNews(bWwwNews));
    }

    /**
     * 删除资讯管理
     */
    @PreAuthorize("@ss.hasPermi('system:bWwwNews:remove')")
    @Log(title = "资讯管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bWwwNewsService.deleteBWwwNewsByIds(ids));
    }
}
