package com.fdkankan.ucenter.service.impl;

import com.fdkankan.ucenter.entity.SceneCopyLog;
import com.fdkankan.ucenter.mapper.ISceneCopyLogMapper;
import com.fdkankan.ucenter.service.ISceneCopyLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Set;
import java.util.stream.Collectors;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 
 * @since 2022-07-12
 */
@Service
public class SceneCopyLogServiceImpl extends ServiceImpl<ISceneCopyLogMapper, SceneCopyLog> implements ISceneCopyLogService {

    @Override
    public void saveByNum(String oldNum, String newNum, Long userId) {
        SceneCopyLog sceneCopyLog = new SceneCopyLog();
        sceneCopyLog.setOldNum(oldNum);
        sceneCopyLog.setNewNum(newNum);
        sceneCopyLog.setCopyUserId(userId);
        this.save(sceneCopyLog);
    }

    @Override
    public Set<String> getCopyNumSet() {

        return this.list().stream().map(SceneCopyLog::getNewNum).collect(Collectors.toSet());
    }
}
