package com.srs.web.controller.stureg;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.srs.common.annotation.Log;
import com.srs.common.core.controller.BaseController;
import com.srs.common.core.domain.AjaxResult;
import com.srs.common.enums.BusinessType;
import com.srs.stureg.domain.ArrivalInformation;
import com.srs.stureg.service.IArrivalInformationService;
import com.srs.common.utils.poi.ExcelUtil;
import com.srs.common.core.page.TableDataInfo;

/**
 * 到站信息登记Controller
 * 
 * @author 邓
 * @date 2023-05-20
 */
@RestController
@RequestMapping("/stureg/ArrivalInformation")
public class ArrivalInformationController extends BaseController
{
    @Autowired
    private IArrivalInformationService arrivalInformationService;

    /**
     * 查询到站信息登记列表
     */
//    @PreAuthorize("@ss.hasPermi('stureg:ArrivalInformation:list')")
    @GetMapping("/list")
    public TableDataInfo list(ArrivalInformation arrivalInformation)
    {
        startPage();
        List<ArrivalInformation> list = arrivalInformationService.selectArrivalInformationList(arrivalInformation);
        return getDataTable(list);
    }

    /**
     * 导出到站信息登记列表
     */
//    @PreAuthorize("@ss.hasPermi('stureg:ArrivalInformation:export')")
    @Log(title = "到站信息登记", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ArrivalInformation arrivalInformation)
    {
        List<ArrivalInformation> list = arrivalInformationService.selectArrivalInformationList(arrivalInformation);
        ExcelUtil<ArrivalInformation> util = new ExcelUtil<ArrivalInformation>(ArrivalInformation.class);
        util.exportExcel(response, list, "到站信息登记数据");
    }

    /**
     * 获取到站信息登记详细信息
     */
//    @PreAuthorize("@ss.hasPermi('stureg:ArrivalInformation:query')")
    @GetMapping(value = "/{arriveId}")
    public AjaxResult getInfo(@PathVariable("arriveId") Long arriveId)
    {
        return success(arrivalInformationService.selectArrivalInformationByArriveId(arriveId));
    }

    /**
     * 新增到站信息登记
     */
//    @PreAuthorize("@ss.hasPermi('stureg:ArrivalInformation:add')")
    @Log(title = "到站信息登记", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ArrivalInformation arrivalInformation)
    {
        return toAjax(arrivalInformationService.insertArrivalInformation(arrivalInformation));
    }

    /**
     * 修改到站信息登记
     */
//    @PreAuthorize("@ss.hasPermi('stureg:ArrivalInformation:edit')")
    @Log(title = "到站信息登记", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    public AjaxResult edit(@RequestBody ArrivalInformation arrivalInformation)
    {
        return toAjax(arrivalInformationService.updateArrivalInformation(arrivalInformation));
    }

    /**
     * 删除到站信息登记
     */
//    @PreAuthorize("@ss.hasPermi('stureg:ArrivalInformation:remove')")
    @Log(title = "到站信息登记", businessType = BusinessType.DELETE)
	@PostMapping("/delete/{arriveIds}")
    public AjaxResult remove(@PathVariable Long[] arriveIds)
    {
        return toAjax(arrivalInformationService.deleteArrivalInformationByArriveIds(arriveIds));
    }
}
