package com.rongwei.bscommon.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsentity.domain.FsTrainingStaffDo;
import com.bsentity.domain.FsTrainingStaffRecordDo;
import com.bsentity.enums.BoolEnum;
import com.rongwei.bscommon.sys.dao.FsTrainingStaffRecordDao;
import com.rongwei.bscommon.sys.service.FsTrainingStaffRecordService;
import com.rongwei.rwadmincommon.system.vo.SysUserVo;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 奥克宁可——培训人员清单日志 服务实现类
 * </p>
 *
 * @author trj
 * @since 2023-07-17
 */
@Service
public class FsTrainingStaffRecordServiceImpl extends ServiceImpl<FsTrainingStaffRecordDao, FsTrainingStaffRecordDo> implements FsTrainingStaffRecordService {

    @Override
    public void updateTrainingByMasterId(List<String> fileDataListRecordIds, SysUserVo currentUser, Date val) {
        LambdaUpdateWrapper<FsTrainingStaffRecordDo> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.in(FsTrainingStaffRecordDo::getMasterid,fileDataListRecordIds)
                .eq(FsTrainingStaffRecordDo::getUserid,currentUser.getId())
                .set(FsTrainingStaffRecordDo::getTraining, BoolEnum.yes.getCode())
                .set(FsTrainingStaffRecordDo::getTrainingtime, val)
                .set(FsTrainingStaffRecordDo::getModifydate, val)
                .set(FsTrainingStaffRecordDo::getModifyuserid, currentUser.getId())
                .set(FsTrainingStaffRecordDo::getModifyusername, currentUser.getName());
        update(updateWrapper);
    }
}
