package com.yc.ship.module.resource.controller.app.dock;

import com.yc.ship.framework.common.pojo.CommonResult;
import com.yc.ship.framework.common.util.object.BeanUtils;
import com.yc.ship.module.resource.controller.admin.dock.vo.ResourceDockRespVO;
import com.yc.ship.module.resource.dal.dataobject.dock.ResourceDockDO;
import com.yc.ship.module.resource.service.dock.ResourceDockService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

import static com.yc.ship.framework.common.pojo.CommonResult.success;

@Tag(name = "码头 APP - 码头接口")
@RestController
@RequestMapping("/resource/dock")
@Validated
public class AppResourceDockController {

    @Resource
    private ResourceDockService dockService;
    @GetMapping("/enableList")
    @Operation(summary = "获取码头列表（下拉筛选用）")
    public CommonResult<List<ResourceDockRespVO>> getEnableList() {
        List<ResourceDockDO> list = dockService.getEnableList();
        return success(BeanUtils.toBean(list, ResourceDockRespVO.class));
    }
}
