package digital.laboratory.platform.reagent.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import digital.laboratory.platform.reagent.entity.WarehousingContent;
import digital.laboratory.platform.reagent.mapper.WarehousingContentMapper;
import digital.laboratory.platform.reagent.service.WarehousingBatchListService;
import digital.laboratory.platform.reagent.service.WarehousingContentService;
import digital.laboratory.platform.reagent.vo.WarehousingBatchListVO;
import digital.laboratory.platform.reagent.vo.WarehousingContentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WarehousingContentServiceImpl extends ServiceImpl<WarehousingContentMapper, WarehousingContent> implements WarehousingContentService {

    @Autowired
    private WarehousingBatchListService warehousingBatchListService;

    @Override
    public List<WarehousingContentVO> getWarehousingContentVOList(String warehousingRecordFormId) {

        List<WarehousingContentVO> warehousingContentVOList = baseMapper.getWarehousingContentVOList(warehousingRecordFormId);

        for (WarehousingContentVO warehousingContentVO : warehousingContentVOList) {

            List<WarehousingBatchListVO> warehousingBatchListVOList = warehousingBatchListService.getWarehousingBatchListVOList(warehousingContentVO.getWarehousingContentId());

            warehousingContentVO.setWarehousingBatchListVOList(warehousingBatchListVOList);

        }
        return warehousingContentVOList;
    }
}
