PaperDictServiceImpl.java
1.74 KB
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
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.common.exception.HttpException;
import com.subsidy.model.PaperDictDO;
import com.subsidy.mapper.PaperDictMapper;
import com.subsidy.service.PaperDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.vo.paper.QueryPapersVO;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 试卷字典表 服务实现类
* </p>
*
* @author DengMin
* @since 2021-12-03
*/
@Service
public class PaperDictServiceImpl extends ServiceImpl<PaperDictMapper, PaperDictDO> implements PaperDictService {
public List<QueryPapersVO> queryPapers(PaperDictDO paperDictDO){
return this.baseMapper.queryPapers(paperDictDO.getCourseId(),paperDictDO.getPaperName(),null);
}
public String deletePaper(PaperDictDO paperDictDO){
this.baseMapper.deleteById(paperDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public String updateStatus(PaperDictDO paperDictDO){
this.baseMapper.updateById(paperDictDO);
return ConstantUtils.SET_SUCCESS;
}
public String addPaper(PaperDictDO paperDictDO){
Integer count = this.baseMapper.selectCount(new QueryWrapper<PaperDictDO>()
.lambda()
.eq(PaperDictDO::getCourseId,paperDictDO.getCourseId())
.eq(PaperDictDO::getPaperName,paperDictDO.getPaperName()));
if (count>0){
throw new HttpException(50001);
}
paperDictDO.setPaperStatus(0);
this.baseMapper.insert(paperDictDO);
return ConstantUtils.ADD_SUCCESS;
}
}