|
@@ -1,5 +1,6 @@
|
|
|
package org.dromara.system.service.impl;
|
|
package org.dromara.system.service.impl;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
@@ -17,6 +18,7 @@ import org.dromara.system.domain.vo.GameEventConfigVo;
|
|
|
import org.dromara.system.domain.GameEventConfig;
|
|
import org.dromara.system.domain.GameEventConfig;
|
|
|
import org.dromara.system.mapper.GameEventConfigMapper;
|
|
import org.dromara.system.mapper.GameEventConfigMapper;
|
|
|
import org.dromara.system.service.IGameEventConfigService;
|
|
import org.dromara.system.service.IGameEventConfigService;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -58,13 +60,14 @@ public class GameEventConfigServiceImpl implements IGameEventConfigService {
|
|
|
if (bo.getEventId() == null) {
|
|
if (bo.getEventId() == null) {
|
|
|
Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
|
|
Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
|
|
|
if (cacheObject instanceof Integer) {
|
|
if (cacheObject instanceof Integer) {
|
|
|
- bo.setEventId(((Integer) cacheObject).longValue()); // 显式转换为 Long 类型
|
|
|
|
|
|
|
+ bo.setEventId(((Integer) cacheObject).longValue()); // 显式转换为 Long 类型
|
|
|
} else if (cacheObject instanceof Long) {
|
|
} else if (cacheObject instanceof Long) {
|
|
|
bo.setEventId((Long) cacheObject);
|
|
bo.setEventId((Long) cacheObject);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
LambdaQueryWrapper<GameEventConfig> lqw = buildQueryWrapper(bo);
|
|
LambdaQueryWrapper<GameEventConfig> lqw = buildQueryWrapper(bo);
|
|
|
-// Page<GameEventConfigVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
|
|
|
|
+ // Page<GameEventConfigVo> result = baseMapper.selectVoPage(pageQuery.build(),
|
|
|
|
|
+ // lqw);
|
|
|
Page<GameEventConfigVo> result = baseMapper.selectPageEventConfigList(pageQuery.build(), lqw);
|
|
Page<GameEventConfigVo> result = baseMapper.selectPageEventConfigList(pageQuery.build(), lqw);
|
|
|
return TableDataInfo.build(result);
|
|
return TableDataInfo.build(result);
|
|
|
}
|
|
}
|
|
@@ -80,13 +83,13 @@ public class GameEventConfigServiceImpl implements IGameEventConfigService {
|
|
|
if (bo.getEventId() == null) {
|
|
if (bo.getEventId() == null) {
|
|
|
Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
|
|
Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
|
|
|
if (cacheObject instanceof Integer) {
|
|
if (cacheObject instanceof Integer) {
|
|
|
- bo.setEventId(((Integer) cacheObject).longValue()); // 显式转换为 Long 类型
|
|
|
|
|
|
|
+ bo.setEventId(((Integer) cacheObject).longValue()); // 显式转换为 Long 类型
|
|
|
} else if (cacheObject instanceof Long) {
|
|
} else if (cacheObject instanceof Long) {
|
|
|
bo.setEventId((Long) cacheObject);
|
|
bo.setEventId((Long) cacheObject);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
LambdaQueryWrapper<GameEventConfig> lqw = buildQueryWrapper(bo);
|
|
LambdaQueryWrapper<GameEventConfig> lqw = buildQueryWrapper(bo);
|
|
|
-// return baseMapper.selectVoList(lqw);
|
|
|
|
|
|
|
+ // return baseMapper.selectVoList(lqw);
|
|
|
return baseMapper.selectEventConfigList(lqw);
|
|
return baseMapper.selectEventConfigList(lqw);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -113,7 +116,7 @@ public class GameEventConfigServiceImpl implements IGameEventConfigService {
|
|
|
if (bo.getEventId() == null) {
|
|
if (bo.getEventId() == null) {
|
|
|
Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
|
|
Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
|
|
|
if (cacheObject instanceof Integer) {
|
|
if (cacheObject instanceof Integer) {
|
|
|
- bo.setEventId(((Integer) cacheObject).longValue()); // 显式转换为 Long 类型
|
|
|
|
|
|
|
+ bo.setEventId(((Integer) cacheObject).longValue()); // 显式转换为 Long 类型
|
|
|
} else if (cacheObject instanceof Long) {
|
|
} else if (cacheObject instanceof Long) {
|
|
|
bo.setEventId((Long) cacheObject);
|
|
bo.setEventId((Long) cacheObject);
|
|
|
}
|
|
}
|
|
@@ -138,7 +141,7 @@ public class GameEventConfigServiceImpl implements IGameEventConfigService {
|
|
|
if (bo.getEventId() == null) {
|
|
if (bo.getEventId() == null) {
|
|
|
Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
|
|
Object cacheObject = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
|
|
|
if (cacheObject instanceof Integer) {
|
|
if (cacheObject instanceof Integer) {
|
|
|
- bo.setEventId(((Integer) cacheObject).longValue()); // 显式转换为 Long 类型
|
|
|
|
|
|
|
+ bo.setEventId(((Integer) cacheObject).longValue()); // 显式转换为 Long 类型
|
|
|
} else if (cacheObject instanceof Long) {
|
|
} else if (cacheObject instanceof Long) {
|
|
|
bo.setEventId((Long) cacheObject);
|
|
bo.setEventId((Long) cacheObject);
|
|
|
}
|
|
}
|
|
@@ -152,7 +155,7 @@ public class GameEventConfigServiceImpl implements IGameEventConfigService {
|
|
|
* 保存前的数据校验
|
|
* 保存前的数据校验
|
|
|
*/
|
|
*/
|
|
|
private void validEntityBeforeSave(GameEventConfig entity) {
|
|
private void validEntityBeforeSave(GameEventConfig entity) {
|
|
|
- //TODO 做一些数据校验,如唯一约束
|
|
|
|
|
|
|
+ // TODO 做一些数据校验,如唯一约束
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -165,7 +168,7 @@ public class GameEventConfigServiceImpl implements IGameEventConfigService {
|
|
|
@Override
|
|
@Override
|
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
if (isValid) {
|
|
if (isValid) {
|
|
|
- //TODO 做一些业务上的校验,判断是否需要校验
|
|
|
|
|
|
|
+ // TODO 做一些业务上的校验,判断是否需要校验
|
|
|
}
|
|
}
|
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
|
}
|
|
}
|
|
@@ -173,10 +176,9 @@ public class GameEventConfigServiceImpl implements IGameEventConfigService {
|
|
|
@Override
|
|
@Override
|
|
|
public Long queryBgUrlByEventId(Long eventId) {
|
|
public Long queryBgUrlByEventId(Long eventId) {
|
|
|
GameEventConfig backgroundImg = baseMapper.selectOne(
|
|
GameEventConfig backgroundImg = baseMapper.selectOne(
|
|
|
- Wrappers.lambdaQuery(GameEventConfig.class)
|
|
|
|
|
- .eq(GameEventConfig::getEventId, eventId)
|
|
|
|
|
- .eq(GameEventConfig::getConfigKey, "background_img")
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ Wrappers.lambdaQuery(GameEventConfig.class)
|
|
|
|
|
+ .eq(GameEventConfig::getEventId, eventId)
|
|
|
|
|
+ .eq(GameEventConfig::getConfigKey, "background_img"));
|
|
|
if (backgroundImg == null) {
|
|
if (backgroundImg == null) {
|
|
|
return 0L;
|
|
return 0L;
|
|
|
}
|
|
}
|
|
@@ -186,4 +188,19 @@ public class GameEventConfigServiceImpl implements IGameEventConfigService {
|
|
|
}
|
|
}
|
|
|
return Long.valueOf(ossId);
|
|
return Long.valueOf(ossId);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 批量保存赛事配置(新增或修改)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param bos 赛事配置列表
|
|
|
|
|
+ * @return 是否保存成功
|
|
|
|
|
+ */
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Boolean saveBatch(List<GameEventConfigBo> bos) {
|
|
|
|
|
+ if (bos == null || bos.isEmpty()) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ return baseMapper.insertOrUpdateBatch(BeanUtil.copyToList(bos, GameEventConfig.class));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|