|
@@ -0,0 +1,50 @@
|
|
|
|
|
+package com.td.boss.game.complayersattri.service;
|
|
|
|
|
+
|
|
|
|
|
+import com.td.boss.common.pojo.Result;
|
|
|
|
|
+import com.td.boss.common.service.CommonServiceImpl;
|
|
|
|
|
+import com.td.boss.game.complayersattri.pojo.ComPlayersLuckyLog;
|
|
|
|
|
+import com.td.boss.game.complayersattri.pojo.ComPlayersLuckyTools;
|
|
|
|
|
+import com.td.boss.game.complayersattri.repository.ComPlayersLuckyLogRepository;
|
|
|
|
|
+import com.td.boss.game.complayersattri.repository.ComPlayersLuckyToolsRepository;
|
|
|
|
|
+import com.td.boss.game.complayersattri.vo.ComPlayersLuckyLogVo;
|
|
|
|
|
+import com.td.boss.game.complayersattri.vo.ComPlayersLuckyToolsVo;
|
|
|
|
|
+import com.td.boss.util.CopyUtil;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
+
|
|
|
|
|
+import javax.persistence.EntityManager;
|
|
|
|
|
+import javax.persistence.PersistenceContext;
|
|
|
|
|
+import java.util.Optional;
|
|
|
|
|
+
|
|
|
|
|
+@Service
|
|
|
|
|
+@Transactional
|
|
|
|
|
+public class ComPlayersLuckyLogServiceImpl extends CommonServiceImpl<ComPlayersLuckyLogVo, ComPlayersLuckyLog, Integer> implements ComPlayersLuckyLogService {
|
|
|
|
|
+
|
|
|
|
|
+ @PersistenceContext
|
|
|
|
|
+ private EntityManager em;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ComPlayersLuckyLogRepository repository;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ComPlayersLuckyToolsRepository luckyToolsRepository;
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public ComPlayersLuckyLogVo findByUserId(String userId) {
|
|
|
|
|
+ ComPlayersLuckyLog comPlayersLuckyLog = repository.findByUserId(userId).orElse(null);
|
|
|
|
|
+ return comPlayersLuckyLog == null ? null : CopyUtil.copy(comPlayersLuckyLog, ComPlayersLuckyLogVo.class);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public Result useLuckyTools(Integer id) {
|
|
|
|
|
+ if (id == null || id.equals(0)) {
|
|
|
|
|
+ Result.of(null, false, "无效工具");
|
|
|
|
|
+ }
|
|
|
|
|
+ ComPlayersLuckyTools tools = luckyToolsRepository.findById(id).orElse(null);
|
|
|
|
|
+ if (tools == null) {
|
|
|
|
|
+ Result.of(null, false, "无效工具");
|
|
|
|
|
+ }
|
|
|
|
|
+ return Result.of(null);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|