DrawLotsScenesServiceImpl.java
3.68 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package com.zhongzhi.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhongzhi.common.constant.OpenStatus;
import com.zhongzhi.common.exception.HttpException;
import com.zhongzhi.common.utils.ConstantUtils;
import com.zhongzhi.dao.DrawLotGroupDictMapper;
import com.zhongzhi.dao.DrawLotsGroupItemsMapper;
import com.zhongzhi.model.DrawLotGroupDictDO;
import com.zhongzhi.model.DrawLotsGroupItemsDO;
import com.zhongzhi.model.DrawLotsScenesDO;
import com.zhongzhi.dao.DrawLotsScenesMapper;
import com.zhongzhi.service.DrawLotsScenesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhongzhi.vo.project.AllMatchScenesVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author DengMin
* @since 2025-06-19
*/
@Service
public class DrawLotsScenesServiceImpl extends ServiceImpl<DrawLotsScenesMapper, DrawLotsScenesDO> implements DrawLotsScenesService {
@Autowired
private DrawLotGroupDictMapper drawLotGroupDictMapper;
@Autowired
private DrawLotsGroupItemsMapper drawLotsGroupItemsMapper;
@Override
public List<AllMatchScenesVO> allMatchScenes(DrawLotsScenesDO drawLotsScenesDO) {
List<AllMatchScenesVO> allMatchScenesVOS = this.baseMapper.allMatchScenes(drawLotsScenesDO.getMatchId(), drawLotsScenesDO.getOpenStatus());
for (AllMatchScenesVO allMatchScenesVO : allMatchScenesVOS){
//小组项目数量
int projectCnt = drawLotsGroupItemsMapper.selectCount(new QueryWrapper<DrawLotsGroupItemsDO>()
.lambda()
.eq(DrawLotsGroupItemsDO::getSceneId,allMatchScenesVO.getId()));
allMatchScenesVO.setProjectCnt(projectCnt);
//赛组数量
int groupCnt = drawLotGroupDictMapper.selectCount(new QueryWrapper<DrawLotGroupDictDO>()
.lambda()
.eq(DrawLotGroupDictDO::getSceneId,allMatchScenesVO.getId()));
allMatchScenesVO.setGroupCnt(groupCnt);
//评委数量
allMatchScenesVO.setJudgeCnt(0);
//排位项目数量
allMatchScenesVO.setRankCnt(0);
}
return allMatchScenesVOS;
}
@Override
public String addMatchScene(DrawLotsScenesDO drawLotsScenesDO) {
int count = this.baseMapper.selectCount(new QueryWrapper<DrawLotsScenesDO>()
.lambda()
.eq(DrawLotsScenesDO::getSceneName,drawLotsScenesDO.getSceneName())
.eq(DrawLotsScenesDO::getMatchId, drawLotsScenesDO.getMatchId()));
if (count > 0) {
throw new HttpException(10034);
}
drawLotsScenesDO.setOpenStatus(OpenStatus.TODO);
drawLotsScenesDO.setRankStatus("未排位");
this.baseMapper.insert(drawLotsScenesDO);
return ConstantUtils.ADD_SUCCESS;
}
@Override
public String updateMatchScene(DrawLotsScenesDO drawLotsScenesDO) {
int count = this.baseMapper.selectCount(new QueryWrapper<DrawLotsScenesDO>()
.lambda()
.ne(DrawLotsScenesDO::getMatchId, drawLotsScenesDO.getMatchId())
.ne(DrawLotsScenesDO::getId, drawLotsScenesDO.getId()));
if (count > 0) {
throw new HttpException(10034);
}
this.baseMapper.updateById(drawLotsScenesDO);
return ConstantUtils.SUCCESS_UPDATE;
}
@Override
public String deleteMatchScene(DrawLotsScenesDO drawLotsScenesDO) {
this.baseMapper.deleteById(drawLotsScenesDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
}