package com.yuanchu.mom.service.impl; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.yuanchu.mom.exception.ErrorException; import com.yuanchu.mom.pojo.ShiftTime; import com.yuanchu.mom.mapper.ShiftTimeMapper; import com.yuanchu.mom.service.ShiftTimeService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; import java.util.stream.Collectors; /** *

* 班次对应的时间 服务实现类 *

* * @author 江苏鵷雏网络科技有限公司 * @since 2024-07-24 11:22:17 */ @Service public class ShiftTimeServiceImpl extends ServiceImpl implements ShiftTimeService { @Resource ShiftTimeMapper shiftTimeMapper; @Override public void shiftTimeAdd(ShiftTime shiftTime) { List shiftTimes = shiftTimeMapper.selectList(Wrappers.lambdaQuery().eq(ShiftTime::getShift, shiftTime.getShift())); if (shiftTimes.size() > 0) { throw new ErrorException("已存在该班次的时间配置,请删掉后再新增!"); } shiftTimeMapper.insert(shiftTime); } @Override public List shiftTimeList() { return shiftTimeMapper.selectList(null); } }