package org.jeecg.modules.projectManagement.service.impl;

import org.jeecg.modules.projectManagement.entity.FdProjectQuotation;
import org.jeecg.modules.projectManagement.entity.FdProjectQuotationUpload;
import org.jeecg.modules.projectManagement.mapper.FdProjectQuotationUploadMapper;
import org.jeecg.modules.projectManagement.service.IFdProjectQuotationService;
import org.jeecg.modules.projectManagement.service.IFdProjectQuotationUploadService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

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

/**
 * @Description: 项目报价上传附件表
 * @author： jeecg-boot
 * @date：   2019-09-06
 * @version： V1.0
 */
@Service
@Transactional
public class FdProjectQuotationUploadServiceImpl extends ServiceImpl<FdProjectQuotationUploadMapper, FdProjectQuotationUpload> implements IFdProjectQuotationUploadService {

    @Resource
    IFdProjectQuotationService iFdProjectQuotationService;

    @Override
    public void quotationIsUpload(FdProjectQuotation fdProjectQuotation){
        List<FdProjectQuotationUpload> fdProjectQuotationUploadList=fdProjectQuotation.getFdProjectQuotationUploadList();
        FdProjectQuotation updateProjectQuotation=new FdProjectQuotation();
        updateProjectQuotation.setId(fdProjectQuotation.getId());
        //判断附件集合是否有值
        if(!fdProjectQuotationUploadList.isEmpty()&&fdProjectQuotationUploadList.size()>0){
            updateProjectQuotation.setIsUploadEnclosure("1");
        }else{
            updateProjectQuotation.setIsUploadEnclosure("0");
        }
        iFdProjectQuotationService.updateById(updateProjectQuotation);
    }

}
