package com.ruoyi.hezhi.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.hezhi.domain.TbConferenceNotice;
import com.ruoyi.hezhi.service.ITbConferenceNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

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

/**
 * 数字教育大会通知Controller
 *
 * @author ruoyi
 * @date 2024-10-29
 */
@RestController
@RequestMapping("/hezhi/conferenceNotice")
public class TbConferenceNoticeController extends BaseController
{
    @Autowired
    private ITbConferenceNoticeService tbConferenceNoticeService;

    /**
     * 查询数字教育大会通知列表
     */
    @PreAuthorize("@ss.hasPermi('hezhi:conferenceNotice:list')")
    @GetMapping("/list")
    public TableDataInfo list(TbConferenceNotice tbConferenceNotice)
    {
        startPage();
        List<TbConferenceNotice> list = tbConferenceNoticeService.selectTbConferenceNoticeList(tbConferenceNotice);
        return getDataTable(list);
    }

    /**
     * 导出数字教育大会通知列表
     */
    @PreAuthorize("@ss.hasPermi('hezhi:conferenceNotice:export')")
    @Log(title = "数字教育大会通知", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbConferenceNotice tbConferenceNotice)
    {
        List<TbConferenceNotice> list = tbConferenceNoticeService.selectTbConferenceNoticeList(tbConferenceNotice);
        ExcelUtil<TbConferenceNotice> util = new ExcelUtil<TbConferenceNotice>(TbConferenceNotice.class);
        util.exportExcel(response, list, "数字教育大会通知数据");
    }

    /**
     * 获取数字教育大会通知详细信息
     */
    @PreAuthorize("@ss.hasPermi('hezhi:conferenceNotice:query')")
    @GetMapping(value = "/{conferenceNoticeId}")
    public AjaxResult getInfo(@PathVariable("conferenceNoticeId") Long conferenceNoticeId)
    {
        return success(tbConferenceNoticeService.selectTbConferenceNoticeByConferenceNoticeId(conferenceNoticeId));
    }

    /**
     * 新增数字教育大会通知
     */
    @PreAuthorize("@ss.hasPermi('hezhi:conferenceNotice:add')")
    @Log(title = "数字教育大会通知", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TbConferenceNotice tbConferenceNotice)
    {
        return toAjax(tbConferenceNoticeService.insertTbConferenceNotice(tbConferenceNotice));
    }

    /**
     * 修改数字教育大会通知
     */
    @PreAuthorize("@ss.hasPermi('hezhi:conferenceNotice:edit')")
    @Log(title = "数字教育大会通知", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TbConferenceNotice tbConferenceNotice)
    {
        return toAjax(tbConferenceNoticeService.updateTbConferenceNotice(tbConferenceNotice));
    }

    /**
     * 删除数字教育大会通知
     */
    @PreAuthorize("@ss.hasPermi('hezhi:conferenceNotice:remove')")
    @Log(title = "数字教育大会通知", businessType = BusinessType.DELETE)
	@DeleteMapping("/{conferenceNoticeIds}")
    public AjaxResult remove(@PathVariable Long[] conferenceNoticeIds)
    {
        return toAjax(tbConferenceNoticeService.deleteTbConferenceNoticeByConferenceNoticeIds(conferenceNoticeIds));
    }
}
