LogisticsManagementController.java 3.65 KB
package com.trash.office.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.trash.common.annotation.Log;
import com.trash.common.core.controller.BaseController;
import com.trash.common.core.domain.AjaxResult;
import com.trash.common.enums.BusinessType;
import com.trash.office.domain.LogisticsManagement;
import com.trash.office.service.ILogisticsManagementService;
import com.trash.common.utils.poi.ExcelUtil;
import com.trash.common.core.page.TableDataInfo;

/**
 * 后勤管理Controller
 * 
 * @author 2c
 * @date 2023-05-08
 */
@RestController
@RequestMapping("/office/logistics")
public class LogisticsManagementController extends BaseController
{
    @Autowired
    private ILogisticsManagementService logisticsManagementService;

    /**
     * 查询后勤管理列表
     */
    @PreAuthorize("@ss.hasPermi('office:logistics:list')")
    @GetMapping("/list")
    public TableDataInfo list(LogisticsManagement logisticsManagement)
    {
        startPage();
        List<LogisticsManagement> list = logisticsManagementService.selectLogisticsManagementList(logisticsManagement);
        return getDataTable(list);
    }

    /**
     * 导出后勤管理列表
     */
    @PreAuthorize("@ss.hasPermi('office:logistics:export')")
    @Log(title = "后勤管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(LogisticsManagement logisticsManagement)
    {
        List<LogisticsManagement> list = logisticsManagementService.selectLogisticsManagementList(logisticsManagement);
        ExcelUtil<LogisticsManagement> util = new ExcelUtil<LogisticsManagement>(LogisticsManagement.class);
        return util.exportExcel(list, "logistics");
    }

    /**
     * 获取后勤管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('office:logistics:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(logisticsManagementService.selectLogisticsManagementById(id));
    }

    /**
     * 新增后勤管理
     */
    @PreAuthorize("@ss.hasPermi('office:logistics:add')")
    @Log(title = "后勤管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LogisticsManagement logisticsManagement)
    {
        return toAjax(logisticsManagementService.insertLogisticsManagement(logisticsManagement));
    }

    /**
     * 修改后勤管理
     */
    @PreAuthorize("@ss.hasPermi('office:logistics:edit')")
    @Log(title = "后勤管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LogisticsManagement logisticsManagement)
    {
        return toAjax(logisticsManagementService.updateLogisticsManagement(logisticsManagement));
    }

    /**
     * 删除后勤管理
     */
    @PreAuthorize("@ss.hasPermi('office:logistics:remove')")
    @Log(title = "后勤管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(logisticsManagementService.deleteLogisticsManagementByIds(ids));
    }
}