package com.ruoyi.project.plant.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.plant.domain.TMtdItem;
import com.ruoyi.project.plant.service.ITMtdItemService;
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 2023-11-15
 */
@RestController
@RequestMapping("/plant/dailyMeetingitem")
public class TMtdItemController extends BaseController
{
    @Autowired
    private ITMtdItemService tMtdItemService;

    /**
     * 查询调度会议详情列表
     */
    @PreAuthorize("@ss.hasPermi('plant:dailyMeetingitem:list')")
    @GetMapping("/list")
    public TableDataInfo list(TMtdItem tMtdItem)
    {
        startPage();
        List<TMtdItem> list = tMtdItemService.selectTMtdItemList(tMtdItem);
        return getDataTable(list);
    }

    /**
     * 导出调度会议详情列表
     */
    @PreAuthorize("@ss.hasPermi('plant:dailyMeetingitem:export')")
    @Log(title = "调度会议详情", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TMtdItem tMtdItem)
    {
        List<TMtdItem> list = tMtdItemService.selectTMtdItemList(tMtdItem);
        ExcelUtil<TMtdItem> util = new ExcelUtil<TMtdItem>(TMtdItem.class);
        return util.exportExcel(list, "dailyMeetingitem");
    }

    /**
     * 获取调度会议详情详细信息
     */
    @PreAuthorize("@ss.hasPermi('plant:dailyMeetingitem:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tMtdItemService.selectTMtdItemById(id));
    }

    /**
     * 新增调度会议详情
     */
    @PreAuthorize("@ss.hasPermi('plant:dailyMeetingitem:add')")
    @Log(title = "调度会议详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TMtdItem tMtdItem)
    {
        return toAjax(tMtdItemService.insertTMtdItem(tMtdItem));
    }

    /**
     * 修改调度会议详情
     */
    @PreAuthorize("@ss.hasPermi('plant:dailyMeetingitem:edit')")
    @Log(title = "调度会议详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TMtdItem tMtdItem)
    {
        return toAjax(tMtdItemService.updateTMtdItem(tMtdItem));
    }

    /**
     * 删除调度会议详情
     */
    @PreAuthorize("@ss.hasPermi('plant:dailyMeetingitem:remove')")
    @Log(title = "调度会议详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tMtdItemService.deleteTMtdItemByIds(ids));
    }
}
