package com.qianwen.smartman.modules.smis.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import java.util.List; import java.util.stream.Collectors; import com.qianwen.smartman.modules.smis.dto.ShiftRestTimeDTO; import com.qianwen.smartman.modules.smis.entity.ShiftRestTime; import com.qianwen.smartman.modules.smis.mapper.ShiftRestTimeMapper; import com.qianwen.smartman.modules.smis.service.IShiftRestTimeService; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @Service public class ShiftRestTimeServiceImpl extends ServiceImpl implements IShiftRestTimeService { private final ShiftRestTimeMapper shiftRestTimeMapper; public ShiftRestTimeServiceImpl(final ShiftRestTimeMapper shiftRestTimeMapper) { this.shiftRestTimeMapper = shiftRestTimeMapper; } public void saveRestTime(List shiftRestTimeDTOList, Long modelId, Long shiftId) { List restList = (List) shiftRestTimeDTOList.stream().map(shiftRestTimeDTO -> { ShiftRestTime shiftRestTime = new ShiftRestTime(); BeanUtils.copyProperties(shiftRestTimeDTO, shiftRestTime); shiftRestTime.setShiftId(shiftId); shiftRestTime.setModelId(modelId); return shiftRestTime; }).collect(Collectors.toList()); this.shiftRestTimeMapper.saveBatch(restList); } }