package com.ruoyi.project.training.bccnew.controller;

import java.util.List;

import com.ruoyi.project.training.bccnew.domain.TTsFlplanContent;
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.training.bccnew.domain.TTsYsplanContent;
import com.ruoyi.project.training.bccnew.service.ITTsYsplanContentService;
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 ssy
 * @date 2024-07-19
 */
@RestController
@RequestMapping("/bccnew/ysContent")
public class TTsYsplanContentController extends BaseController
{
    @Autowired
    private ITTsYsplanContentService tTsYsplanContentService;

    /**
     * 查询压缩培训内容列表
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ysContent:list')")
    @GetMapping("/list")
    public AjaxResult list(TTsYsplanContent tTsYsplanContent)
    {
        return AjaxResult.success(tTsYsplanContentService.selectTTsYsplanContentList(tTsYsplanContent));
    }

    /**
     * 导出压缩培训内容列表
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ysContent:export')")
    @Log(title = "压缩培训内容", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TTsYsplanContent tTsYsplanContent)
    {
        List<TTsYsplanContent> list = tTsYsplanContentService.selectTTsYsplanContentList(tTsYsplanContent);
        ExcelUtil<TTsYsplanContent> util = new ExcelUtil<TTsYsplanContent>(TTsYsplanContent.class);
        return util.exportExcel(list, "ysContent");
    }

    /**
     * 获取压缩培训内容详细信息
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ysContent:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tTsYsplanContentService.selectTTsYsplanContentById(id));
    }

    /**
     * 新增压缩培训内容
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ysContent:add')")
    @Log(title = "压缩培训内容", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TTsYsplanContent tTsYsplanContent)
    {
        return toAjax(tTsYsplanContentService.insertTTsYsplanContent(tTsYsplanContent));
    }

    /**
     * 修改压缩培训内容
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ysContent:edit')")
    @Log(title = "压缩培训内容", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TTsYsplanContent tTsYsplanContent)
    {
        return toAjax(tTsYsplanContentService.updateTTsYsplanContent(tTsYsplanContent));
    }

    /**
     * 删除压缩培训内容
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ysContent:remove')")
    @Log(title = "压缩培训内容", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tTsYsplanContentService.deleteTTsYsplanContentByIds(ids));
    }
}
