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
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.ThBatch;
import com.gkhy.exam.institutionalaccess.mapper.ThBatchMapper;
import com.gkhy.exam.institutionalaccess.model.query.ThBatchQuery;
import com.gkhy.exam.institutionalaccess.model.vo.ThBatchVO;
import com.gkhy.exam.institutionalaccess.service.ThBatchService;
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("ThBatchService")
public class ThBatchServiceImpl extends ServiceImpl<ThBatchMapper, ThBatch> implements ThBatchService {
    @Autowired
    private ThBatchMapper batchMapper;
    @Override
    public ThBatch getByUuid(String uuid) {
        return batchMapper.selectOne(new LambdaQueryWrapper<ThBatch>().eq(ThBatch::getUuid, uuid).eq(ThBatch::getDelFlag, DeleteStatusEnum.NO.getStatus()));
    }
 
    @Override
    public List<ThBatch> listByInstitutionId(Long institutionId) {
        return batchMapper.selectList(new LambdaQueryWrapper<ThBatch>().eq(ThBatch::getInstitutionId, institutionId).eq(ThBatch::getDelFlag, DeleteStatusEnum.NO.getStatus()));
    }
 
    @Override
    public List<ThBatchVO> listByPage(ThBatchQuery query) {
        return batchMapper.listByPage(query);
    }
 
    @Override
    public List<ThBatch> getByUuids(List<String> batchUuids) {
        List<ThBatch> allBatchList = new ArrayList<>();
        List<List<String>> split = ListUtil.split(batchUuids, 900);
        for (List<String> splitBatchUuids : split) {
            List<ThBatch> batchList = batchMapper.getByUuids(splitBatchUuids);
            allBatchList.addAll(batchList);
        }
        return allBatchList;
    }
 
    @Override
    public Integer insertBatch(List<ThBatch> batchList) {
        return batchMapper.insertBatch(batchList);
    }
 
    @Override
    public Integer updateBatch(List<ThBatch> batchList) {
        return batchMapper.updateBatch(batchList);
    }
 
    @Override
    public List<ThBatch> getBatchNameByUuids(List<String> batchUuids) {
        return batchMapper.getBatchNameByUuids(batchUuids);
    }
}