package com.ruoyi.web.controller.warehouse.quotation;

import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.quotation.domain.TSeapriceQueryLog;
import com.ruoyi.quotation.service.ITSeapriceQueryLogService;
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.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 海运价格查询日志记录Controller
 * 
 * @author frank
 * @date 2021-07-16
 */
@RestController
@RequestMapping("/quotation/queryseapricelog")
public class TSeapriceQueryLogController extends BaseController
{
    @Autowired
    private ITSeapriceQueryLogService tSeapriceQueryLogService;

    /**
     * 查询海运价格查询日志记录列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TSeapriceQueryLog tSeapriceQueryLog)
    {
        tSeapriceQueryLog.setfUserId(SecurityUtils.getLoginUser().getUser().getUserId());
        startPage();
        List<TSeapriceQueryLog> list = tSeapriceQueryLogService.selectTSeapriceQueryLogList(tSeapriceQueryLog);
        return getDataTable(list);
    }

    /**
     * 导出海运价格查询日志记录列表
     */
    @Log(title = "海运价格查询日志记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TSeapriceQueryLog tSeapriceQueryLog)
    {
        List<TSeapriceQueryLog> list = tSeapriceQueryLogService.selectTSeapriceQueryLogList(tSeapriceQueryLog);
        ExcelUtil<TSeapriceQueryLog> util = new ExcelUtil<TSeapriceQueryLog>(TSeapriceQueryLog.class);
        return util.exportExcel(list, "queryseapricelog");
    }

    /**
     * 获取海运价格查询日志记录详细信息
     */
    @GetMapping(value = "/{fId}")
    public AjaxResult getInfo(@PathVariable("fId") Long fId)
    {
        return AjaxResult.success(tSeapriceQueryLogService.selectTSeapriceQueryLogById(fId));
    }

    /**
     * 新增海运价格查询日志记录
     */
    @Log(title = "海运价格查询日志记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TSeapriceQueryLog tSeapriceQueryLog)
    {
        return toAjax(tSeapriceQueryLogService.insertTSeapriceQueryLog(tSeapriceQueryLog));
    }

    /**
     * 修改海运价格查询日志记录
     */
    @Log(title = "海运价格查询日志记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TSeapriceQueryLog tSeapriceQueryLog)
    {
        return toAjax(tSeapriceQueryLogService.updateTSeapriceQueryLog(tSeapriceQueryLog));
    }

    /**
     * 删除海运价格查询日志记录
     */
    @Log(title = "海运价格查询日志记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{fIds}")
    public AjaxResult remove(@PathVariable Long[] fIds)
    {
        return toAjax(tSeapriceQueryLogService.deleteTSeapriceQueryLogByIds(fIds));
    }
}
