package org.springblade.modules.system.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wn.common.controller.BaseController;
import com.wn.common.datamodel.ResultDTO;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.secure.annotation.PreAuth;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.RoleConstant;
import org.springblade.modules.app.common.dto.TransportDTO;
import org.springblade.modules.app.common.query.AdminWaybillQuery;
import org.springblade.modules.app.manager.TransportManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@NonDS
@RestController
@AllArgsConstructor
@RequestMapping(AppConstant.APPLICATION_SYSTEM_NAME + "/transportBill")
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public class TransportController extends BladeController {
    @Autowired
    private TransportManager transportManager;

    //@ApiOperation(value = "分页查询运输单")
    @GetMapping("/page")
    public R<Page<TransportDTO>> pageTransport(AdminWaybillQuery transportQuery) {
        return R.data(transportManager.pageTransport(transportQuery));
    }

    //@ApiOperation(value = "查询运输单详情", notes = "返回运输单阶段信息")
    @GetMapping("/{id}")
    public R<TransportDTO> getTransportStageDetail(@PathVariable Long id) {
        return R.data(transportManager.getAdminTransportDetail(id));
    }
}
