package com.trade.admin.trade.salesorder;

import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;

import com.github.pagehelper.PageInfo;
import com.trade.common.core.domain.ResponseResult;
import com.trade.service.trade.salesorder.service.ISalesOrderLogisticsService;
import com.trade.service.trade.salesorder.vo.SalesOrderLogisticsDtlVO;
import com.trade.service.trade.salesorder.vo.SalesOrderLogisticsSearch;
import com.trade.service.trade.salesorder.vo.SalesOrderLogisticsVO;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/salesOrderLogisticsB")
@Validated
public class SalesOrderLogisticsBController {

    @Resource
    private ISalesOrderLogisticsService salesOrderLogisticsService;

    /**
     * 获取物流列表
     */
    @RequestMapping("/queryList")
    @PreAuthorize("@ss.hasPermi('trade:salesLogistics:list')")
    public ResponseResult<PageInfo<SalesOrderLogisticsVO>> queryList(SalesOrderLogisticsSearch search) {
        return ResponseResult.success(salesOrderLogisticsService.queryListBySearch(search));
    }

    /**
     * 根据订单号获取物流信息
     */
    @RequestMapping("/getDetailByOrderNo")
    @PreAuthorize("@ss.hasPermi('trade:salesLogistics:detail')")
    public ResponseResult<SalesOrderLogisticsDtlVO> getDetailByOrderNo(
            @NotBlank(message = "订单编号不能为空") String orderNo) {
        return ResponseResult.success(salesOrderLogisticsService.getDetailByOrderNo(orderNo));
    }
}
