package com.ruoyi.project.reliability.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.reliability.domain.TKekaoMgList;
import com.ruoyi.project.reliability.service.ITKekaoMgListService;
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 ruoyi
 * @date 2022-07-07
 */
@RestController
@RequestMapping("/reliability/kekao")
public class TKekaoMgListController extends BaseController
{
    @Autowired
    private ITKekaoMgListService tKekaoMgListService;

    /**
     * 查询可靠性管理清单列表
     */
    @PreAuthorize("@ss.hasPermi('reliability:list:list')")
    @GetMapping("/list")
    public TableDataInfo list(TKekaoMgList tKekaoMgList)
    {
        startPage();
        List<TKekaoMgList> list = tKekaoMgListService.selectTKekaoMgListList(tKekaoMgList);
        return getDataTable(list);
    }

    /**
     * 导出可靠性管理清单列表
     */
    @PreAuthorize("@ss.hasPermi('reliability:list:export')")
    @Log(title = "可靠性管理清单", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TKekaoMgList tKekaoMgList)
    {
        List<TKekaoMgList> list = tKekaoMgListService.selectTKekaoMgListList(tKekaoMgList);
        ExcelUtil<TKekaoMgList> util = new ExcelUtil<TKekaoMgList>(TKekaoMgList.class);
        return util.exportExcel(list, "list");
    }

    /**
     * 获取可靠性管理清单详细信息
     */
    @PreAuthorize("@ss.hasPermi('reliability:list:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tKekaoMgListService.selectTKekaoMgListById(id));
    }

    /**
     * 新增可靠性管理清单
     */
    @PreAuthorize("@ss.hasPermi('reliability:list:add')")
    @Log(title = "可靠性管理清单", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TKekaoMgList tKekaoMgList)
    {
        return toAjax(tKekaoMgListService.insertTKekaoMgList(tKekaoMgList));
    }

    /**
     * 修改可靠性管理清单
     */
    @PreAuthorize("@ss.hasPermi('reliability:list:edit')")
    @Log(title = "可靠性管理清单", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TKekaoMgList tKekaoMgList)
    {
        return toAjax(tKekaoMgListService.updateTKekaoMgList(tKekaoMgList));
    }

    /**
     * 删除可靠性管理清单
     */
    @PreAuthorize("@ss.hasPermi('reliability:list:remove')")
    @Log(title = "可靠性管理清单", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tKekaoMgListService.deleteTKekaoMgListByIds(ids));
    }
}
