zhangf
2024-07-24 790c2ba4a0b46edf191e3bac84931f796bd42b8f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.exam.institutionalaccess.entity.ThCourse;
import com.gkhy.exam.institutionalaccess.entity.ThCourseChapter;
import com.gkhy.exam.institutionalaccess.mapper.ThCourseChapterMapper;
import com.gkhy.exam.institutionalaccess.model.vo.ThCourseChapterVO;
import com.gkhy.exam.institutionalaccess.model.vo.ThStatisticStudentVO;
import com.gkhy.exam.institutionalaccess.service.ThCourseChapterService;
import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
 
@Service("ThCourseChapterService")
public class ThCourseChapterServiceImpl extends ServiceImpl<ThCourseChapterMapper, ThCourseChapter> implements ThCourseChapterService {
    @Autowired
    private ThCourseChapterMapper courseChapterMapper;
    @Override
    public List<ThCourseChapterVO> listByCourseUuids(List<String> courseUuids) {
 
        return courseChapterMapper.listByCourseUuids(courseUuids);
    }
 
    @Override
    public List<ThCourseChapterVO> listByCourseUuid(String courseUuid) {
        return courseChapterMapper.listByCourseUuid(courseUuid);
    }
 
    @Override
    public List<ThCourseChapter> listByInstitutionId(Long institutionId) {
        return courseChapterMapper.selectList(new LambdaQueryWrapper<ThCourseChapter>().eq(ThCourseChapter::getInstitutionId, institutionId).eq(ThCourseChapter::getDelFlag, DeleteStatusEnum.NO.getStatus()));
    }
 
    @Override
    public ThCourseChapter getByUuid(String batchUuid) {
        return courseChapterMapper.selectOne(new LambdaQueryWrapper<ThCourseChapter>().eq(ThCourseChapter::getUuid, batchUuid).eq(ThCourseChapter::getDelFlag, DeleteStatusEnum.NO.getStatus()));
    }
 
    @Override
    public List<ThCourseChapter> getByUuids(List<String> chapterUuids) {
        List<ThCourseChapter> allList = new ArrayList<>();
        //分批量查询
        List<List<String>> list = ListUtil.split(chapterUuids, 900);
        for (List<String> uuids : list) {
            List<ThCourseChapter> courseListList = courseChapterMapper.getByUuids(uuids);
            allList.addAll(courseListList);
        }
        return allList;
    }
 
    @Override
    public Integer insertBatch(List<ThCourseChapter> courseChapterList) {
        return courseChapterMapper.insertBatch(courseChapterList);
    }
 
    @Override
    public Integer updateBatch(List<ThCourseChapter> courseChapterList) {
        return courseChapterMapper.updateBatch(courseChapterList);
    }
 
    @Override
    public List<ThCourseChapter> getChapterNameByUuids(List<String> chapterUuids) {
        return courseChapterMapper.getChapterNameByUuids(chapterUuids);
    }
 
 
}