package com.gkhy.exam.institutionalaccess.service.serviceImpl; import cn.hutool.core.collection.ListUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.gkhy.exam.institutionalaccess.entity.ThBatchCourse; import com.gkhy.exam.institutionalaccess.entity.ThBatchCourseChapter; import com.gkhy.exam.institutionalaccess.entity.ThCourseChapter; import com.gkhy.exam.institutionalaccess.mapper.ThBatchCourseChapterMapper; import com.gkhy.exam.institutionalaccess.service.ThBatchCourseChapterService; import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Collections; import java.util.List; @Service("ThBatchCourseChapterService") public class ThBatchCourseChapterServiceImpl extends ServiceImpl implements ThBatchCourseChapterService { @Override public void deleteByBatchUuid(String batchUuid) { baseMapper.deleteByBatchUuid(batchUuid); } @Override public List getByBatchUuid(String batchUuid) { return baseMapper.selectList(new LambdaQueryWrapper() .eq(ThBatchCourseChapter::getBatchUuid, batchUuid) .eq(ThBatchCourseChapter::getDelFlag, DeleteStatusEnum.NO.getStatus())); } @Override public ThBatchCourseChapter getByUuid(String batchUuid, String courseUuid, String chapterUuid) { return baseMapper.selectOne(new LambdaQueryWrapper() .eq(ThBatchCourseChapter::getBatchUuid, batchUuid) .eq(ThBatchCourseChapter::getCourseUuid, courseUuid) .eq(ThBatchCourseChapter::getChapterUuid, chapterUuid) .eq(ThBatchCourseChapter::getDelFlag, DeleteStatusEnum.NO.getStatus())); } @Override public List getListByBatchUuids(List batchUuids) { List allBatchCourseChapterList = new ArrayList<>(); List> split = ListUtil.split(batchUuids, 900); for (List list : split) { List thBatchCourseChapterList = baseMapper.getByBatchUuids(list); allBatchCourseChapterList.addAll(thBatchCourseChapterList); } return allBatchCourseChapterList; } @Override public Integer insertBatch(List chapterList) { return baseMapper.insertBatch(chapterList); } @Override public Integer updateBatch(List chapterList) { return baseMapper.updateBatch(chapterList); } @Override public List getByChapterUuids(List chapterUuids) { List allBatchCourseChapterList = new ArrayList<>(); List> split = ListUtil.split(chapterUuids, 900); for (List list : split) { List thBatchCourseChapterList = baseMapper.getByChapterUuids(list); allBatchCourseChapterList.addAll(thBatchCourseChapterList); } return allBatchCourseChapterList; } }