package com.ruoyi.web.controller.syzy;

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.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.syzy.domain.BBusiWishUniversitiesEnrollBrochure;
import com.ruoyi.syzy.service.IBBusiWishUniversitiesEnrollBrochureService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 院校招生简章Controller
 * 
 * @author voluntary
 * @date 2024-09-27
 */
@RestController
@RequestMapping("/syzy/bBusiWishUniversitiesEnrollBrochure")
public class BBusiWishUniversitiesEnrollBrochureController extends BaseController
{
    @Autowired
    private IBBusiWishUniversitiesEnrollBrochureService bBusiWishUniversitiesEnrollBrochureService;

    /**
     * 查询院校招生简章列表
     */
    @PreAuthorize("@ss.hasPermi('syzy:bBusiWishUniversitiesEnrollBrochure:list')")
    @GetMapping("/list")
    public TableDataInfo list(BBusiWishUniversitiesEnrollBrochure bBusiWishUniversitiesEnrollBrochure)
    {
        startPage();
        List<BBusiWishUniversitiesEnrollBrochure> list = bBusiWishUniversitiesEnrollBrochureService.selectBBusiWishUniversitiesEnrollBrochureList(bBusiWishUniversitiesEnrollBrochure);
        return getDataTable(list);
    }

    /**
     * 导出院校招生简章列表
     */
    @PreAuthorize("@ss.hasPermi('syzy:bBusiWishUniversitiesEnrollBrochure:export')")
    @Log(title = "院校招生简章", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BBusiWishUniversitiesEnrollBrochure bBusiWishUniversitiesEnrollBrochure)
    {
        List<BBusiWishUniversitiesEnrollBrochure> list = bBusiWishUniversitiesEnrollBrochureService.selectBBusiWishUniversitiesEnrollBrochureList(bBusiWishUniversitiesEnrollBrochure);
        ExcelUtil<BBusiWishUniversitiesEnrollBrochure> util = new ExcelUtil<BBusiWishUniversitiesEnrollBrochure>(BBusiWishUniversitiesEnrollBrochure.class);
        util.exportExcel(response, list, "院校招生简章数据");
    }

    /**
     * 获取院校招生简章详细信息
     */
    @PreAuthorize("@ss.hasPermi('syzy:bBusiWishUniversitiesEnrollBrochure:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bBusiWishUniversitiesEnrollBrochureService.selectBBusiWishUniversitiesEnrollBrochureById(id));
    }

    /**
     * 新增院校招生简章
     */
    @PreAuthorize("@ss.hasPermi('syzy:bBusiWishUniversitiesEnrollBrochure:add')")
    @Log(title = "院校招生简章", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BBusiWishUniversitiesEnrollBrochure bBusiWishUniversitiesEnrollBrochure)
    {
        return toAjax(bBusiWishUniversitiesEnrollBrochureService.insertBBusiWishUniversitiesEnrollBrochure(bBusiWishUniversitiesEnrollBrochure));
    }

    /**
     * 修改院校招生简章
     */
    @PreAuthorize("@ss.hasPermi('syzy:bBusiWishUniversitiesEnrollBrochure:edit')")
    @Log(title = "院校招生简章", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BBusiWishUniversitiesEnrollBrochure bBusiWishUniversitiesEnrollBrochure)
    {
        return toAjax(bBusiWishUniversitiesEnrollBrochureService.updateBBusiWishUniversitiesEnrollBrochure(bBusiWishUniversitiesEnrollBrochure));
    }

    /**
     * 删除院校招生简章
     */
    @PreAuthorize("@ss.hasPermi('syzy:bBusiWishUniversitiesEnrollBrochure:remove')")
    @Log(title = "院校招生简章", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bBusiWishUniversitiesEnrollBrochureService.deleteBBusiWishUniversitiesEnrollBrochureByIds(ids));
    }
}
