package com.zcxk.rmcp.web.service.impl;

import com.zcxk.rmcp.api.vo.MeasuringPointVo;
import com.zcxk.rmcp.core.dao.ProductMeasuringDictMapper;
import com.zcxk.rmcp.core.dao.ProductMeasuringPointMapper;
import com.zcxk.rmcp.web.service.ProductMeasuringPointService;
import org.springframework.stereotype.Service;

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

/**
 * @author Andy
 * @version V1.0
 **/
@Service
public class ProductMeasuringPointServiceImpl implements ProductMeasuringPointService {

    @Resource
    private ProductMeasuringPointMapper productMeasuringPointMapper;

    @Resource
    private ProductMeasuringDictMapper productMeasuringDictMapper;

    @Override
    public List<MeasuringPointVo> getMeasuringPoint(Integer productId) {
        List<MeasuringPointVo> list = productMeasuringPointMapper.getList(productId);
        list.forEach(measuringPointDto -> {
            measuringPointDto.setDictList(productMeasuringDictMapper.getList(measuringPointDto.getId()));
        });
        return list;
    }
}
