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

import org.jeecg.modules.projectManagement.entity.FdContract;
import org.jeecg.modules.projectManagement.entity.FdContractUpload;
import org.jeecg.modules.projectManagement.mapper.FdContractUploadMapper;
import org.jeecg.modules.projectManagement.service.IFdContractService;
import org.jeecg.modules.projectManagement.service.IFdContractUploadService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

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

/**
 * @Description: 合同附件表
 * @author： jeecg-boot
 * @date：   2019-11-27
 * @version： V1.0
 */
@Service
public class FdContractUploadServiceImpl extends ServiceImpl<FdContractUploadMapper, FdContractUpload> implements IFdContractUploadService {

    @Resource
    IFdContractService iFdContractService;

    @Override
    public void contractIsUpload(FdContract fdContract) {
        List<FdContractUpload> fdContractUploadList=fdContract.getFdContractUploadList();
        FdContract updateFdContract=new FdContract();
        updateFdContract.setId(fdContract.getId());
        //判断附件集合是否有值
        if(!fdContractUploadList.isEmpty()&&fdContractUploadList.size()>0){
            updateFdContract.setIsUploadEnclosure("1");
        }else{
            updateFdContract.setIsUploadEnclosure("0");
        }
        iFdContractService.updateById(updateFdContract);
    }
}
