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

import org.jeecg.modules.basedata.entity.FdPersonnel;
import org.jeecg.modules.projectManagement.entity.FdProjectFileMembers;
import org.jeecg.modules.projectManagement.mapper.FdProjectFileMembersMapper;
import org.jeecg.modules.basedata.service.IFdPersonnelService;
import org.jeecg.modules.projectManagement.service.IFdProjectFileMembersService;
import org.springframework.stereotype.Service;

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

import javax.annotation.Resource;

/**
 * @Description: 项目成员表
 * @author： jeecg-boot
 * @date： 2019-05-28
 * @version： V1.0
 */
@Service
@Transactional
public class FdProjectFileMembersServiceImpl extends ServiceImpl<FdProjectFileMembersMapper, FdProjectFileMembers> implements IFdProjectFileMembersService {

    @Resource
    IFdPersonnelService fdPersonnelService;

    /**
     * @Author gurui
     * @Description //TODO  添加人员表信息至项目成员表
     * @Date 13:38 2019/5/29
     * @Param [fdProjectFileMembers]
     * @return void
     **/
    @Override
    public void saveProjectFileMembers(FdProjectFileMembers fdProjectFileMembers) {
        fdProjectFileMembers.setDelFlag("0");
        fdProjectFileMembers.setEnable("0");


        for (FdPersonnel fdPersonnel : fdProjectFileMembers.getFdPersonnelList()) {
            fdProjectFileMembers.setPersonnelId(fdPersonnel.getId());
        }

        // 批量新增人员表信息
        fdPersonnelService.saveBatch(fdProjectFileMembers.getFdPersonnelList());


    }
}
