package com.ruoyi.project.production.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.production.domain.TPpeStaffLocker;
import com.ruoyi.project.production.service.ITPpeStaffLockerService;
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;

/**
 * 自行车棚员工PPE柜Controller
 *
 * @author ssy
 * @date 2023-11-30
 */
@RestController
@RequestMapping("/production/staffLocker")
public class TPpeStaffLockerController extends BaseController
{
    @Autowired
    private ITPpeStaffLockerService tPpeStaffLockerService;

    /**
     * 查询自行车棚员工PPE柜列表
     */

    @GetMapping("/list")
    public TableDataInfo list(TPpeStaffLocker tPpeStaffLocker)
    {
        startPage();
        List<TPpeStaffLocker> list = tPpeStaffLockerService.selectTPpeStaffLockerList(tPpeStaffLocker);
        return getDataTable(list);
    }

    /**
     * 导出自行车棚员工PPE柜列表
     */

    @Log(title = "自行车棚员工PPE柜", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TPpeStaffLocker tPpeStaffLocker)
    {
        List<TPpeStaffLocker> list = tPpeStaffLockerService.selectTPpeStaffLockerList(tPpeStaffLocker);
        ExcelUtil<TPpeStaffLocker> util = new ExcelUtil<TPpeStaffLocker>(TPpeStaffLocker.class);
        return util.exportExcel(list, "staffLocker");
    }

    /**
     * 获取自行车棚员工PPE柜详细信息
     */

    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tPpeStaffLockerService.selectTPpeStaffLockerById(id));
    }

    /**
     * 新增自行车棚员工PPE柜
     */

    @Log(title = "自行车棚员工PPE柜", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TPpeStaffLocker tPpeStaffLocker)
    {
        return toAjax(tPpeStaffLockerService.insertTPpeStaffLocker(tPpeStaffLocker));
    }

    /**
     * 修改自行车棚员工PPE柜
     */

    @Log(title = "自行车棚员工PPE柜", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TPpeStaffLocker tPpeStaffLocker)
    {
        return toAjax(tPpeStaffLockerService.updateTPpeStaffLocker(tPpeStaffLocker));
    }

    /**
     * 删除自行车棚员工PPE柜
     */

    @Log(title = "自行车棚员工PPE柜", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tPpeStaffLockerService.deleteTPpeStaffLockerByIds(ids));
    }
}
