|
@@ -0,0 +1,86 @@
|
|
|
+package com.zanxiang.game.data.serve.service.impl;
|
|
|
+
|
|
|
+import com.zanxiang.game.data.serve.pojo.vo.GameListVO;
|
|
|
+import com.zanxiang.game.data.serve.service.IGameListService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.nutz.dao.Dao;
|
|
|
+import org.nutz.dao.Sqls;
|
|
|
+import org.nutz.dao.sql.Sql;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author tianhua
|
|
|
+ * @time 2023/9/25
|
|
|
+ * @Description
|
|
|
+ **/
|
|
|
+@Service
|
|
|
+@Slf4j
|
|
|
+public class GameListServiceImpl implements IGameListService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private Dao dao;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public GameListVO getGameList() {
|
|
|
+ //查询游戏列表
|
|
|
+ Sql gameListSql = Sqls.create("""
|
|
|
+ SELECT
|
|
|
+ game_name ,
|
|
|
+ id
|
|
|
+ FROM dm_game_order.t_game
|
|
|
+ WHERE source_system = 'ZX_ONE';
|
|
|
+ """);
|
|
|
+ gameListSql.setCallback(Sqls.callback.maps());
|
|
|
+ dao.execute(gameListSql);
|
|
|
+
|
|
|
+ //查询父游戏列表
|
|
|
+ Sql parentGameListSql = Sqls.create("""
|
|
|
+ SELECT
|
|
|
+ parent_game_id,
|
|
|
+ parent_game_name
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ a.source_system ,
|
|
|
+ IFNULL(a.parent_id, a.id) as parent_game_id ,
|
|
|
+ IFNULL(b.game_name, a.game_name ) as parent_game_name
|
|
|
+ FROM dm_game_order.t_game a
|
|
|
+ LEFT JOIN dm_game_order.t_game b
|
|
|
+ on a.source_system = b.source_system AND a.parent_id = b.id
|
|
|
+ ) a
|
|
|
+ WHERE a.source_system = 'ZX_ONE'
|
|
|
+ GROUP BY parent_game_id, source_system, parent_game_name;
|
|
|
+ """);
|
|
|
+ parentGameListSql.setCallback(Sqls.callback.maps());
|
|
|
+ dao.execute(parentGameListSql);
|
|
|
+
|
|
|
+ //查询超父游戏列表
|
|
|
+ Sql superGameListSql = Sqls.create("""
|
|
|
+ SELECT
|
|
|
+ super_game_id,
|
|
|
+ super_game_name
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ a.source_system ,
|
|
|
+ IFNULL(a.super_game_id, a.id) as super_game_id ,
|
|
|
+ IFNULL(b.name, a.game_name ) as super_game_name
|
|
|
+ FROM dm_game_order.t_game a
|
|
|
+ LEFT JOIN dm_game_order.t_game_super b
|
|
|
+ on a.source_system = b.source_system AND a.super_game_id = b.id
|
|
|
+ ) a
|
|
|
+ WHERE a.source_system = 'ZX_ONE'
|
|
|
+ GROUP BY super_game_id, source_system, super_game_name;
|
|
|
+ """);
|
|
|
+ superGameListSql.setCallback(Sqls.callback.maps());
|
|
|
+ dao.execute(superGameListSql);
|
|
|
+
|
|
|
+ return GameListVO.builder()
|
|
|
+ .gameList(gameListSql.getList(Map.class))
|
|
|
+ .parentGameList(parentGameListSql.getList(Map.class))
|
|
|
+ .superGameList(superGameListSql.getList(Map.class))
|
|
|
+ .build();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|