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

import java.util.List;
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.TTsLjplanTmplContent;
import com.ruoyi.project.training.bccnew.service.ITTsLjplanTmplContentService;
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/ljTmplContent")
public class TTsLjplanTmplContentController extends BaseController
{
    @Autowired
    private ITTsLjplanTmplContentService tTsLjplanTmplContentService;

    /**
     * 查询裂解培训模版内容列表
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ljTmplContent:list')")
    @GetMapping("/list")
    public TableDataInfo list(TTsLjplanTmplContent tTsLjplanTmplContent)
    {
        startPage();
        List<TTsLjplanTmplContent> list = tTsLjplanTmplContentService.selectTTsLjplanTmplContentList(tTsLjplanTmplContent);
        return getDataTable(list);
    }

    /**
     * 导出裂解培训模版内容列表
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ljTmplContent:export')")
    @Log(title = "裂解培训模版内容", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TTsLjplanTmplContent tTsLjplanTmplContent)
    {
        List<TTsLjplanTmplContent> list = tTsLjplanTmplContentService.selectTTsLjplanTmplContentList(tTsLjplanTmplContent);
        ExcelUtil<TTsLjplanTmplContent> util = new ExcelUtil<TTsLjplanTmplContent>(TTsLjplanTmplContent.class);
        return util.exportExcel(list, "ljTmplContent");
    }

    /**
     * 获取裂解培训模版内容详细信息
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ljTmplContent:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tTsLjplanTmplContentService.selectTTsLjplanTmplContentById(id));
    }

    /**
     * 新增裂解培训模版内容
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ljTmplContent:add')")
    @Log(title = "裂解培训模版内容", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TTsLjplanTmplContent tTsLjplanTmplContent)
    {
        return toAjax(tTsLjplanTmplContentService.insertTTsLjplanTmplContent(tTsLjplanTmplContent));
    }

    /**
     * 修改裂解培训模版内容
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ljTmplContent:edit')")
    @Log(title = "裂解培训模版内容", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TTsLjplanTmplContent tTsLjplanTmplContent)
    {
        return toAjax(tTsLjplanTmplContentService.updateTTsLjplanTmplContent(tTsLjplanTmplContent));
    }

    /**
     * 删除裂解培训模版内容
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ljTmplContent:remove')")
    @Log(title = "裂解培训模版内容", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tTsLjplanTmplContentService.deleteTTsLjplanTmplContentByIds(ids));
    }
}
