package com.zzsmart.qomo.kn.cost.manage.controller;

import com.zzsmart.qomo.kn.cost.manage.service.BomTreeService;
import com.zzsmart.qomo.kn.cost.manage.vo.BomTreeInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "cost-结构树查询")
@RestController
@RequestMapping("//bomTree")
@Slf4j
public class BomTreeController {
    @Autowired
    BomTreeService bomTreeService;

    @ApiOperation(value = "结构树查询", notes = "结构树查询")
    @GetMapping(value = "/queryBomTree")
    public Result<List<BomTreeInfoVO>> queryBomTree(@RequestParam(name = "materialNumber", required = false) String materialNumber, @RequestParam(name = "versionNumber", required = false) String versionNumber) {
        List<BomTreeInfoVO> bomTreeInfoVOS = bomTreeService.getBomTreeByMaterialNumber(materialNumber, versionNumber);
        return Result.OK(bomTreeInfoVOS);
    }
}
