package com.rongwei.bsserver.sys.controller;


import com.rongwei.bscommon.sys.service.EquBomService;
import com.rongwei.bscommon.sys.utils.ExceptionUtils;
import com.rongwei.bsentity.dto.EquBomCopyDto;
import com.rongwei.rwcommon.base.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 * 设备子系统——设备bom 前端控制器
 * </p>
 *
 * @author sc
 * @since 2023-11-24
 */
@RestController
@RequestMapping("/equBom")
public class EquBomController {

    private static final Logger logger = LoggerFactory.getLogger(EquBomController.class);

    @Autowired
    private EquBomService equBomService;


    /**
     * 复制设备BOM子项
     * @param request
     * @return
     */
    @RequestMapping("/copyChilds")
    public R copyChilds(@RequestBody EquBomCopyDto request){
        try {
            logger.info("复制设备BOM子项");
            equBomService.copyChilds(request);
        } catch (Exception e) {
            ExceptionUtils.printExceptionDetail(e,"复制设备BOM子项异常:");
        }
        return R.ok("复制设备BOM子项成功");
    }

}

