框架集成MyBatis-Plus使得编码更加方便1
parent
6653d88b69
commit
74728a6194
|
|
@ -1,13 +1,5 @@
|
||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
|
@ -41,6 +33,13 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.File;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 比赛信息Service业务层处理
|
* 比赛信息Service业务层处理
|
||||||
|
|
@ -50,8 +49,7 @@ import javax.annotation.Resource;
|
||||||
*/
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Service
|
@Service
|
||||||
public class CompetitionServiceImpl extends ServiceImpl<CompetitionMapper, Competition> implements ICompetitionService
|
public class CompetitionServiceImpl extends ServiceImpl<CompetitionMapper, Competition> implements ICompetitionService {
|
||||||
{
|
|
||||||
@Resource
|
@Resource
|
||||||
private CompetitionMapper competitionMapper;
|
private CompetitionMapper competitionMapper;
|
||||||
@Resource
|
@Resource
|
||||||
|
|
@ -87,6 +85,7 @@ public class CompetitionServiceImpl extends ServiceImpl<CompetitionMapper, Compe
|
||||||
private String winLocation;
|
private String winLocation;
|
||||||
@Value("${image.domainName}")
|
@Value("${image.domainName}")
|
||||||
private String domainName;
|
private String domainName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询比赛信息
|
* 查询比赛信息
|
||||||
*
|
*
|
||||||
|
|
@ -94,8 +93,7 @@ public class CompetitionServiceImpl extends ServiceImpl<CompetitionMapper, Compe
|
||||||
* @return 比赛信息
|
* @return 比赛信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Competition selectCompetitionById(Long id)
|
public Competition selectCompetitionById(Long id) {
|
||||||
{
|
|
||||||
return competitionMapper.selectCompetitionById(id);
|
return competitionMapper.selectCompetitionById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -106,8 +104,7 @@ public class CompetitionServiceImpl extends ServiceImpl<CompetitionMapper, Compe
|
||||||
* @return 比赛信息
|
* @return 比赛信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Competition> selectCompetitionList(Competition competition)
|
public List<Competition> selectCompetitionList(Competition competition) {
|
||||||
{
|
|
||||||
return competitionMapper.selectCompetitionList(competition);
|
return competitionMapper.selectCompetitionList(competition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,8 +115,7 @@ public class CompetitionServiceImpl extends ServiceImpl<CompetitionMapper, Compe
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertCompetition(Competition competition)
|
public int insertCompetition(Competition competition) {
|
||||||
{
|
|
||||||
return competitionMapper.insertCompetition(competition);
|
return competitionMapper.insertCompetition(competition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,8 +126,7 @@ public class CompetitionServiceImpl extends ServiceImpl<CompetitionMapper, Compe
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateCompetition(Competition competition)
|
public int updateCompetition(Competition competition) {
|
||||||
{
|
|
||||||
return competitionMapper.updateCompetition(competition);
|
return competitionMapper.updateCompetition(competition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -142,8 +137,7 @@ public class CompetitionServiceImpl extends ServiceImpl<CompetitionMapper, Compe
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteCompetitionByIds(Long[] ids)
|
public int deleteCompetitionByIds(Long[] ids) {
|
||||||
{
|
|
||||||
return competitionMapper.deleteCompetitionByIds(ids);
|
return competitionMapper.deleteCompetitionByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -154,8 +148,7 @@ public class CompetitionServiceImpl extends ServiceImpl<CompetitionMapper, Compe
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteCompetitionById(Long id)
|
public int deleteCompetitionById(Long id) {
|
||||||
{
|
|
||||||
return competitionMapper.deleteCompetitionById(id);
|
return competitionMapper.deleteCompetitionById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,7 +166,22 @@ public class CompetitionServiceImpl extends ServiceImpl<CompetitionMapper, Compe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Competition> getCompetitionByCondition(CompetitionVo competition) {
|
public List<Competition> getCompetitionByCondition(CompetitionVo competition) {
|
||||||
return competitionMapper.getCompetitionByCondition(competition);
|
List<Competition> competitionList = competitionMapper.getCompetitionByCondition(competition);
|
||||||
|
for (Competition comp : competitionList) {
|
||||||
|
if (comp.getCompetitionNature() == 0) {
|
||||||
|
WxBasketballTeam mainTeam = wxBasketballTeamMapper.selectWxBasketballTeamById(comp.getMainTeamId());
|
||||||
|
if (ObjectUtil.isNotEmpty(mainTeam)) {
|
||||||
|
comp.setMainTeamLogo(mainTeam.getTeamLogo());
|
||||||
|
}
|
||||||
|
if (comp.getGuestTeamId() != null) {
|
||||||
|
WxBasketballTeam guestTeam = wxBasketballTeamMapper.selectWxBasketballTeamById(comp.getGuestTeamId());
|
||||||
|
if (ObjectUtil.isNotEmpty(guestTeam)) {
|
||||||
|
comp.setGuestTeamLogo(guestTeam.getTeamLogo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return competitionList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -362,6 +370,7 @@ public class CompetitionServiceImpl extends ServiceImpl<CompetitionMapper, Compe
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Boolean add(Competition entity) {
|
public Boolean add(Competition entity) {
|
||||||
|
|
@ -439,6 +448,7 @@ public class CompetitionServiceImpl extends ServiceImpl<CompetitionMapper, Compe
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean edit(Competition entity) {
|
public Boolean edit(Competition entity) {
|
||||||
LoginUser user = SecurityUtils.getLoginUser();
|
LoginUser user = SecurityUtils.getLoginUser();
|
||||||
|
|
|
||||||
|
|
@ -320,8 +320,8 @@ public class CompetitionTeamVsTeamServiceImpl extends ServiceImpl<CompetitionTea
|
||||||
public Boolean deleteBatchByIds(Ids ids) {
|
public Boolean deleteBatchByIds(Ids ids) {
|
||||||
Long[] idList = ids.getIdList().stream().toArray(Long[]::new);
|
Long[] idList = ids.getIdList().stream().toArray(Long[]::new);
|
||||||
//删除赛程的时候同时删除比赛结果
|
//删除赛程的时候同时删除比赛结果
|
||||||
competitionResultService.lambdaUpdate().in(CompetitionResult::getCompetitionVsId,ids).remove();
|
competitionResultService.lambdaUpdate().in(CompetitionResult::getCompetitionVsId,idList).remove();
|
||||||
competitionMembersScoreService.lambdaUpdate().in(CompetitionMembersScore::getCompetitionVsId,ids).remove();
|
competitionMembersScoreService.lambdaUpdate().in(CompetitionMembersScore::getCompetitionVsId,idList).remove();
|
||||||
competitionTeamVsTeamMapper.deleteCompetitionTeamVsTeamByIds(idList);
|
competitionTeamVsTeamMapper.deleteCompetitionTeamVsTeamByIds(idList);
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue