package com.cf.imes.module.system.api.assemblyconfig;

import cn.hutool.core.bean.BeanUtil;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.module.system.api.assemblyconfig.dto.AssemblyConfigRespDTO;
import com.cf.imes.module.system.controller.admin.assemblyconfig.vo.AssemblyConfigRespVO;
import com.cf.imes.module.system.service.assemblyconfig.AssemblyConfigService;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 *
 *
 * @author Gqr
 * @since 2026/2/28 15:30
 */
@RestController
@Validated
public class AssemblyConfigApiImpl implements AssemblyConfigApi {
    @Resource
    private AssemblyConfigService assemblyConfigService;

    @Override
    public CommonResult<List<AssemblyConfigRespDTO>> getAssemblyConfigByPartNameList(List<String> componentNameList) {
        List<AssemblyConfigRespVO> assemblyConfigByComponentNameList = assemblyConfigService.getAssemblyConfigByComponentNameList(componentNameList);
        return CommonResult.success(BeanUtil.copyToList(assemblyConfigByComponentNameList, AssemblyConfigRespDTO.class));
    }

    @Override
    public CommonResult<List<AssemblyConfigRespDTO>> getNotProcessAssemblyConfigByPartNameList(List<String> componentNameList) {
        List<AssemblyConfigRespVO> assemblyConfigByComponentNameList = assemblyConfigService.getNotProcessAssemblyConfigByComponentNameList(componentNameList);
        return CommonResult.success(BeanUtil.copyToList(assemblyConfigByComponentNameList, AssemblyConfigRespDTO.class));
    }
}
