教育训练处考试制证系统后端
zhangf
2024-06-24 21362fd048558832cdcaca8ee957d2d7aa753be2
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
package com.gkhy.exam.institutionalaccess.service.serviceImpl;
 
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.ThStudentCourse;
import com.gkhy.exam.institutionalaccess.mapper.ThBatchCourseMapper;
import com.gkhy.exam.institutionalaccess.model.vo.ThBatchCourseVO;
import com.gkhy.exam.institutionalaccess.service.ThBatchCourseService;
import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
 
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
 
@Service("ThBatchCourseService")
public class ThBatchCourseServiceImpl extends ServiceImpl<ThBatchCourseMapper, ThBatchCourse> implements ThBatchCourseService {
    @Autowired
    private ThBatchCourseMapper batchCourseMapper;
    @Override
    public List<ThBatchCourse> getByBatchUuid(String batchUuid) {
        List<ThBatchCourse> batchCourseList = batchCourseMapper.selectList(new LambdaQueryWrapper<ThBatchCourse>().eq(ThBatchCourse::getBatchUuid,batchUuid)
                .eq(ThBatchCourse::getDelFlag, DeleteStatusEnum.NO.getStatus()));
        return batchCourseList;
    }
    public List<String> getCourseUuisByBatchUuid(String batchUuid){
        List<String> courseUuis = new ArrayList<String>();
        List<ThBatchCourse> list = this.getByBatchUuid(batchUuid);
        if(!CollectionUtils.isEmpty(list)){
           courseUuis = list.stream().map(ThBatchCourse::getCourseUuid).collect(Collectors.toList());
        }
 
        return courseUuis;
    }
 
    @Override
    public void deleteByBatchUuidAndCourseUuid(List<ThBatchCourse> deleteBatchCourseList) {
        batchCourseMapper.deleteByBatchUuidAndCourseUuid(deleteBatchCourseList);
    }
 
    @Override
    public List<ThBatchCourseVO> getListByBatchUuids(List<String> batchUuids) {
        return batchCourseMapper.getListByBatchUuids(batchUuids);
    }
    @Override
    public List<ThBatchCourseVO> getListByBatchUuid(String batchUuid) {
        List<ThBatchCourseVO> thBatchCourseVOS = batchCourseMapper.getListByBatchUuid(batchUuid);
        return thBatchCourseVOS;
    }
 
    @Override
    public boolean isExsit(String courseUuid) {
        Long count = batchCourseMapper.selectCount(new LambdaQueryWrapper<ThBatchCourse>().eq(ThBatchCourse::getCourseUuid,courseUuid).eq(ThBatchCourse::getDelFlag, DeleteStatusEnum.NO.getStatus()));
        if(count > 0){
            return true;
        }
        return false;
    }
 
    @Override
    public List<ThBatchCourse> listByInstitutionId(Long institutionId) {
        return batchCourseMapper.selectList(new LambdaQueryWrapper<ThBatchCourse>()
                .eq(ThBatchCourse::getInstitutionId,institutionId).eq(ThBatchCourse::getDelFlag,DeleteStatusEnum.NO.getStatus()));
    }
}