kongzy
2024-10-12 3402a6cdef63a87cf046a8bbfdc2898bb842c93f
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
package com.gkhy.exam.institutionalaccess.service.serviceImpl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.exam.institutionalaccess.entity.ThCert;
import com.gkhy.exam.institutionalaccess.entity.ThQuestionBank;
import com.gkhy.exam.institutionalaccess.mapper.ThCertMapper;
import com.gkhy.exam.institutionalaccess.model.query.ThCertQuery;
import com.gkhy.exam.institutionalaccess.service.ThCertService;
import com.ruoyi.common.constant.ResultConstants;
import com.ruoyi.common.enums.coalmineEnums.DeleteStatusEnum;
import com.ruoyi.common.exception.BusinessException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.List;
 
@Service("ThCertService")
public class ThCertServiceImpl extends ServiceImpl<ThCertMapper, ThCert> implements ThCertService {
    @Autowired
    private ThCertMapper certMapper;
    @Override
    public ThCert getCertByUuid(String uuid) {
        return getOne(Wrappers.<ThCert>lambdaQuery()
                .eq(true,ThCert::getUuid,uuid)
                .last(" limit 1"));
    }
 
    @Override
    public List<ThCert> listByPage(ThCertQuery query) {
        List<ThCert> certs = certMapper.listByPage(query);
        return certs;
    }
 
 
    @Transactional
    @Override
    public Integer updateBatch(List<ThCert> certList) {
        boolean b= updateBatchById(certList);
        if(b){
            return certList.size();
        }else{
            throw new BusinessException(this.getClass(), ResultConstants.BUSINESS_ERROR,"学时证书更新失败");
        }
    }
 
    @Transactional
    @Override
    public Integer insertBatch(List<ThCert> certList) {
        boolean b = saveBatch(certList);
        if(b){
            return certList.size();
        }else{
            throw new BusinessException(this.getClass(), ResultConstants.BUSINESS_ERROR,"学时证书新增失败");
        }
    }
 
}