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.TBrithstaffmgr;
import com.ruoyi.project.plant.service.ITBrithstaffmgrService;
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 2021-01-18
 */
@RestController
@RequestMapping("/plant/brithstaffmgr")
public class TBrithstaffmgrController extends BaseController
{
    @Autowired
    private ITBrithstaffmgrService tBrithstaffmgrService;

    /**
     * 查询生日提醒列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TBrithstaffmgr tBrithstaffmgr)
    {
        startPage();
        List<TBrithstaffmgr> list = tBrithstaffmgrService.selectTBrithstaffmgrList(tBrithstaffmgr);
        return getDataTable(list);
    }

    /**
     * 导出生日提醒列表
     */
    @Log(title = "生日提醒", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TBrithstaffmgr tBrithstaffmgr)
    {
        List<TBrithstaffmgr> list = tBrithstaffmgrService.selectTBrithstaffmgrList(tBrithstaffmgr);
        ExcelUtil<TBrithstaffmgr> util = new ExcelUtil<TBrithstaffmgr>(TBrithstaffmgr.class);
        return util.exportExcel(list, "brithstaffmgr");
    }

    /**
     * 获取生日提醒详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tBrithstaffmgrService.selectTBrithstaffmgrById(id));
    }

    /**
     * 新增生日提醒
     */
    @Log(title = "生日提醒", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TBrithstaffmgr tBrithstaffmgr)
    {
        return toAjax(tBrithstaffmgrService.insertTBrithstaffmgr(tBrithstaffmgr));
    }

    /**
     * 修改生日提醒
     */
    @Log(title = "生日提醒", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TBrithstaffmgr tBrithstaffmgr)
    {
        return toAjax(tBrithstaffmgrService.updateTBrithstaffmgr(tBrithstaffmgr));
    }

    /**
     * 删除生日提醒
     */
    @Log(title = "生日提醒", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tBrithstaffmgrService.deleteTBrithstaffmgrByIds(ids));
    }
}
