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.TTsYsplanTmplContent;
import com.ruoyi.project.training.bccnew.service.ITTsYsplanTmplContentService;
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/ysTmplContent")
public class TTsYsplanTmplContentController extends BaseController
{
    @Autowired
    private ITTsYsplanTmplContentService tTsYsplanTmplContentService;

    /**
     * 查询转岗培训模版内容列表
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ysTmplContent:list')")
    @GetMapping("/list")
    public TableDataInfo list(TTsYsplanTmplContent tTsYsplanTmplContent)
    {
        startPage();
        List<TTsYsplanTmplContent> list = tTsYsplanTmplContentService.selectTTsYsplanTmplContentList(tTsYsplanTmplContent);
        return getDataTable(list);
    }

    /**
     * 导出转岗培训模版内容列表
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ysTmplContent:export')")
    @Log(title = "转岗培训模版内容", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TTsYsplanTmplContent tTsYsplanTmplContent)
    {
        List<TTsYsplanTmplContent> list = tTsYsplanTmplContentService.selectTTsYsplanTmplContentList(tTsYsplanTmplContent);
        ExcelUtil<TTsYsplanTmplContent> util = new ExcelUtil<TTsYsplanTmplContent>(TTsYsplanTmplContent.class);
        return util.exportExcel(list, "ysTmplContent");
    }

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

    /**
     * 新增转岗培训模版内容
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ysTmplContent:add')")
    @Log(title = "转岗培训模版内容", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TTsYsplanTmplContent tTsYsplanTmplContent)
    {
        return toAjax(tTsYsplanTmplContentService.insertTTsYsplanTmplContent(tTsYsplanTmplContent));
    }

    /**
     * 修改转岗培训模版内容
     */
    //@PreAuthorize("@ss.hasPermi('bccnew:ysTmplContent:edit')")
    @Log(title = "转岗培训模版内容", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TTsYsplanTmplContent tTsYsplanTmplContent)
    {
        return toAjax(tTsYsplanTmplContentService.updateTTsYsplanTmplContent(tTsYsplanTmplContent));
    }

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