
package com.tmerclub.cloud.order.controller.app;


import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.order.model.OrderSelfStation;
import com.tmerclub.cloud.order.service.OrderSelfStationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Lanhai
 */
@RestController("OrderSelfStationController")
@RequestMapping("/order_self_station")
@Tag(name = "用户自提订单信息接口")
public class OrderSelfStationController {

    @Autowired
    private OrderSelfStationService orderSelfStationService;

    @GetMapping("/get_station_user_info")
    @Operation(summary = "获取常用提货人信息", description = "用户创建订单时，获取常用提货人信息")
    public ServerResponseEntity<List<OrderSelfStation>> getStationUserInfo() {
        Long userId = AuthUserContext.get().getUserId();
        List<OrderSelfStation> orderSelfStationList = orderSelfStationService.getStationUserInfo(userId);
        return ServerResponseEntity.success(orderSelfStationList);
    }
}
