suochencheng 7 лет назад
Родитель
Сommit
fb48a4c2d2

+ 2 - 0
src/main/java/com/izouma/awesomeadmin/dao/CompetitionSeasonMapper.java

@@ -28,6 +28,8 @@ public interface CompetitionSeasonMapper{
 
     CompetitionSeason queryCompetitionSeason(CompetitionSeason record);
 
+    CompetitionSeason queryStartCompetitionSeason(CompetitionSeason record);
+
     List<CompetitionSeason> query(CompetitionSeason record);
 }
 

+ 59 - 0
src/main/java/com/izouma/awesomeadmin/dao/CompetitionSeasonMapper.xml

@@ -513,6 +513,65 @@
             </if>
 
 
+        </where>
+        LIMIT 1
+    </select>
+    <select id="queryStartCompetitionSeason" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.CompetitionSeason">
+        select
+        <include refid="Base_Column_List"/>
+        from competition_season
+        <where>
+            and del_flag = 'N'
+            and status_flag = 1
+            <if test="id != null and !&quot;&quot;.equals(id)">
+                and id = #{id}
+            </if>
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+                and del_flag = #{delFlag}
+            </if>
+            <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
+                and update_time = #{updateTime}
+            </if>
+            <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
+                and update_user = #{updateUser}
+            </if>
+            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
+                and create_time = #{createTime}
+            </if>
+            <if test="createUser != null and !&quot;&quot;.equals(createUser)">
+                and create_user = #{createUser}
+            </if>
+            <if test="season != null and !&quot;&quot;.equals(season)">
+                and season = #{season}
+            </if>
+            <if test="shortName != null and !&quot;&quot;.equals(shortName)">
+                and short_name = #{shortName}
+            </if>
+            <if test="beginTime != null and !&quot;&quot;.equals(beginTime)">
+                and begin_time = #{beginTime}
+            </if>
+            <if test="endTime != null and !&quot;&quot;.equals(endTime)">
+                and end_time = #{endTime}
+            </if>
+            <if test="bonus != null and !&quot;&quot;.equals(bonus)">
+                and bonus = #{bonus}
+            </if>
+            <if test="remark != null and !&quot;&quot;.equals(remark)">
+                and remark = #{remark}
+            </if>
+            <if test="rank != null and !&quot;&quot;.equals(rank)">
+                and rank = #{rank}
+            </if>
+            <if test="statusFlag != null and !&quot;&quot;.equals(statusFlag)">
+                and status_flag = #{statusFlag}
+            </if>
+
+            <if test="gameId != null and !&quot;&quot;.equals(gameId)">
+                and game_id = #{gameId}
+            </if>
+
+
         </where>
         LIMIT 1
     </select>

+ 2 - 0
src/main/java/com/izouma/awesomeadmin/dao/GameInfoMapper.java

@@ -29,5 +29,7 @@ public interface GameInfoMapper{
     GameInfo queryGameInfo(GameInfo record);
 
     List<GameInfo> query(GameInfo record);
+
+    List<GameInfo> getGameInfoSeasonsList(GameInfo record);
 }
 

+ 118 - 0
src/main/java/com/izouma/awesomeadmin/dao/GameInfoMapper.xml

@@ -420,6 +420,114 @@
 
         id desc
     </select>
+    <select id="getGameInfoSeasonsList" parameterType="java.util.Map"
+            resultMap="SeasonResult">
+        select
+        <include refid="Base_Column_List"/>
+        from game_info
+        <where>
+            and del_flag = 'N'
+            <if test="idStr != null and !&quot;&quot;.equals(idStr)">
+                and id in (${idStr})
+            </if>
+            <if test="id != null and !&quot;&quot;.equals(id)">
+                and id = #{id}
+            </if>
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+                and del_flag = #{delFlag}
+            </if>
+            <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
+                and update_time = #{updateTime}
+            </if>
+            <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
+                and update_user = #{updateUser}
+            </if>
+            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
+                and create_time = #{createTime}
+            </if>
+            <if test="createUser != null and !&quot;&quot;.equals(createUser)">
+                and create_user = #{createUser}
+            </if>
+            <if test="gameName != null and !&quot;&quot;.equals(gameName)">
+                and game_name = #{gameName}
+            </if>
+            <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
+                and type_flag = #{typeFlag}
+            </if>
+            <if test="icon != null and !&quot;&quot;.equals(icon)">
+                and icon = #{icon}
+            </if>
+            <if test="rank != null and !&quot;&quot;.equals(rank)">
+                and rank = #{rank}
+            </if>
+            <if test="remark != null and !&quot;&quot;.equals(remark)">
+                and remark = #{remark}
+            </if>
+            <if test="useFlag != null and !&quot;&quot;.equals(useFlag)">
+                and use_flag = #{useFlag}
+            </if>
+            <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR">
+                    OR game_name LIKE concat('%',#{searchKey},'%')
+                    OR type_flag LIKE concat('%',#{searchKey},'%')
+                    OR icon LIKE concat('%',#{searchKey},'%')
+                    OR rank LIKE concat('%',#{searchKey},'%')
+                    OR remark LIKE concat('%',#{searchKey},'%')
+                    OR use_flag LIKE concat('%',#{searchKey},'%')
+                </trim>
+            </if>
+            <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
+                <foreach item="item" index="index" collection="advancedQuery.split('_;')">
+                    <choose>
+                        <when test="item.indexOf('like') != -1">
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    concat('%',#{itemDetail},'%')
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    #{itemDetail}
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </otherwise>
+                    </choose>
+
+
+                </foreach>
+
+
+            </if>
+        </where>
+        order by
+
+        <if test="orderByStr != null and !&quot;&quot;.equals(orderByStr)">
+
+
+            <trim suffixOverrides=",">
+                <foreach item="item" index="index" separator="," collection="orderByStr.split('_;')">
+                    <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                        ${itemDetail}
+                    </foreach>
+                </foreach>
+            </trim>
+            ,
+        </if>
+
+        id desc
+    </select>
     <select id="queryGameInfo" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.GameInfo">
         select
         <include refid="Base_Column_List"/>
@@ -486,5 +594,15 @@
         </where>
         order by id desc
     </select>
+
+    <resultMap id="SeasonResult" type="com.izouma.awesomeadmin.model.GameInfo" extends="BaseResultMap">
+
+        <association property="competitionSeason"
+                     javaType="com.izouma.awesomeadmin.model.CompetitionSeason"
+                     select="com.izouma.awesomeadmin.dao.CompetitionSeasonMapper.queryStartCompetitionSeason"
+                     column="{ gameId = id }"/>
+
+    </resultMap>
+
 </mapper>
 

+ 11 - 0
src/main/java/com/izouma/awesomeadmin/model/GameInfo.java

@@ -28,6 +28,9 @@ private String idStr;
 
 private String searchKey;
 
+private CompetitionSeason competitionSeason;
+
+
 /**
 * and,test_name,like,value;or,remark,=,123
 */
@@ -170,5 +173,13 @@ public void setIdStr(String idStr) {
     public void setProfile(String profile) {
         this.profile = profile;
     }
+
+    public CompetitionSeason getCompetitionSeason() {
+        return competitionSeason;
+    }
+
+    public void setCompetitionSeason(CompetitionSeason competitionSeason) {
+        this.competitionSeason = competitionSeason;
+    }
 }
 

+ 2 - 0
src/main/java/com/izouma/awesomeadmin/service/GameInfoService.java

@@ -23,5 +23,7 @@ public interface GameInfoService{
     boolean deleteGameInfo(GameInfo record);
 
     boolean updateGameInfo(GameInfo record);
+
+    List<GameInfo> getGameInfoSeasonsList(GameInfo record);
 }
 

+ 34 - 18
src/main/java/com/izouma/awesomeadmin/service/impl/GameInfoServiceImpl.java

@@ -1,6 +1,7 @@
 package com.izouma.awesomeadmin.service.impl;
 
 import java.util.*;
+
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -11,10 +12,10 @@ import com.izouma.awesomeadmin.service.GameInfoService;
 import com.izouma.awesomeadmin.dao.GameInfoMapper;
 
 /**
-*  service接口实现类
-*/
+ * service接口实现类
+ */
 @Service
-public class GameInfoServiceImpl implements GameInfoService{
+public class GameInfoServiceImpl implements GameInfoService {
 
     private static Logger logger = Logger.getLogger(GameInfoServiceImpl.class);
 
@@ -27,26 +28,41 @@ public class GameInfoServiceImpl implements GameInfoService{
         logger.info("getGameInfoList");
         try {
 
-        return gameInfoMapper.queryAllGameInfo(record);
+            return gameInfoMapper.queryAllGameInfo(record);
+        } catch (Exception e) {
+            logger.error("getGameInfoList", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public List<GameInfo> getGameInfoSeasonsList(GameInfo record) {
+
+        logger.info("getGameInfoSeasonsList");
+        try {
+
+            return gameInfoMapper.getGameInfoSeasonsList(record);
         } catch (Exception e) {
-        logger.error("getGameInfoList", e);
+            logger.error("getGameInfoSeasonsList", e);
         }
 
         return null;
     }
+
     @Override
     public List<GameInfo> getGameInfoByPage(Page page, GameInfo record) {
 
         logger.info("getGameInfoByPage");
         try {
 
-        Map<String, Object> parameter = new HashMap<String, Object>();
-        parameter.put("record", record);
-        parameter.put(AppConstant.PAGE, page);
+            Map<String, Object> parameter = new HashMap<String, Object>();
+            parameter.put("record", record);
+            parameter.put(AppConstant.PAGE, page);
 
-        return gameInfoMapper.queryGameInfoByPage(parameter);
+            return gameInfoMapper.queryGameInfoByPage(parameter);
         } catch (Exception e) {
-        logger.error("getGameInfoByPage", e);
+            logger.error("getGameInfoByPage", e);
         }
 
         return null;
@@ -60,7 +76,7 @@ public class GameInfoServiceImpl implements GameInfoService{
 
             return gameInfoMapper.selectByPrimaryKey(Integer.valueOf(id));
         } catch (Exception e) {
-        logger.error("getGameInfoById", e);
+            logger.error("getGameInfoById", e);
         }
 
         return null;
@@ -74,7 +90,7 @@ public class GameInfoServiceImpl implements GameInfoService{
 
             return gameInfoMapper.queryGameInfo(record);
         } catch (Exception e) {
-        logger.error("getGameInfo", e);
+            logger.error("getGameInfo", e);
         }
 
         return null;
@@ -89,7 +105,7 @@ public class GameInfoServiceImpl implements GameInfoService{
             int updates = gameInfoMapper.insertSelective(record);
 
             if (updates > 0) {
-                 return true;
+                return true;
             }
         } catch (Exception e) {
             logger.error("createGameInfo", e);
@@ -104,13 +120,13 @@ public class GameInfoServiceImpl implements GameInfoService{
         logger.info("deleteGameInfo");
         try {
 
-             int updates = gameInfoMapper.delete(record);
+            int updates = gameInfoMapper.delete(record);
 
             if (updates > 0) {
-                 return true;
+                return true;
             }
         } catch (Exception e) {
-             logger.error("deleteGameInfo", e);
+            logger.error("deleteGameInfo", e);
         }
 
         return false;
@@ -125,10 +141,10 @@ public class GameInfoServiceImpl implements GameInfoService{
             int updates = gameInfoMapper.updateByPrimaryKeySelective(record);
 
             if (updates > 0) {
-                 return true;
+                return true;
             }
         } catch (Exception e) {
-             logger.error("updateGameInfo", e);
+            logger.error("updateGameInfo", e);
         }
 
         return false;

+ 53 - 44
src/main/java/com/izouma/awesomeadmin/web/GameInfoController.java

@@ -18,8 +18,8 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 /**
-*  controller类
-*/
+ * controller类
+ */
 @Controller
 @RequestMapping("/gameInfo")
 public class GameInfoController {
@@ -28,8 +28,8 @@ public class GameInfoController {
     private GameInfoService gameInfoService;
 
     /**
-    * <p>获取全部记录。</p>
-    */
+     * <p>获取全部记录。</p>
+     */
     @RequiresAuthentication
     @RequestMapping(value = "/all", method = RequestMethod.GET)
     @ResponseBody
@@ -39,8 +39,8 @@ public class GameInfoController {
     }
 
     /**
-    * <p>根据Id。</p>
-    */
+     * <p>根据Id。</p>
+     */
     @RequestMapping(value = "/getGameInfo", method = RequestMethod.GET)
     @ResponseBody
     public Result getGameInfo(@RequestParam(required = false, value = "id") String id) {
@@ -49,8 +49,8 @@ public class GameInfoController {
     }
 
     /**
-    * <p>根据条件获取。</p>
-    */
+     * <p>根据条件获取。</p>
+     */
     @RequestMapping(value = "/getOne", method = RequestMethod.GET)
     @ResponseBody
     public Result getOne(GameInfo record) {
@@ -60,14 +60,14 @@ public class GameInfoController {
 
 
     /**
-    * <p>分页查询。</p>
-    */
+     * <p>分页查询。</p>
+     */
     @RequestMapping(value = "/page", method = RequestMethod.GET)
     @ResponseBody
     public Result page(Page page, GameInfo record) {
         Map<String, Object> result = new HashMap<>();
 
-        List<GameInfo> pp =gameInfoService.getGameInfoByPage(page, record);
+        List<GameInfo> pp = gameInfoService.getGameInfoByPage(page, record);
 
         result.put(AppConstant.PAGE, page);
         result.put("pp", pp);
@@ -76,88 +76,97 @@ public class GameInfoController {
 
 
     /**
-    * <p>保存。</p>
-    */
+     * <p>保存。</p>
+     */
     @RequestMapping(value = "/save", method = RequestMethod.POST)
     @ResponseBody
     public Result save(GameInfo record) {
         boolean num = gameInfoService.createGameInfo(record);
         if (num) {
-        return new Result(true, record.getId());
+            return new Result(true, record.getId());
         }
         return new Result(false, "保存异常");
     }
 
     /**
-    * <p>更新信息。</p>
-    */
+     * <p>更新信息。</p>
+     */
     @RequestMapping(value = "/update", method = RequestMethod.POST)
     @ResponseBody
     public Result updateGameInfo(GameInfo record) {
         boolean num = gameInfoService.updateGameInfo(record);
         if (num) {
-        return new Result(true, "保存成功");
+            return new Result(true, "保存成功");
         }
         return new Result(false, "保存异常");
     }
 
     /**
-    * <p>删除。</p>
-    */
+     * <p>删除。</p>
+     */
     @RequestMapping(value = "/del", method = RequestMethod.POST)
     @ResponseBody
     public Result deleteGameInfo(GameInfo record) {
 
         boolean num = gameInfoService.deleteGameInfo(record);
         if (num) {
-        return new Result(true, "删除成功");
+            return new Result(true, "删除成功");
         }
         return new Result(false, "删除异常");
     }
 
     /**
-    * 导出Excel
-    * @param request
-    * @param response
-    * @param record
-    * @throws Exception
-    */
+     * 导出Excel
+     *
+     * @param request
+     * @param response
+     * @param record
+     * @throws Exception
+     */
     @RequestMapping(value = "/exportExcel", method = RequestMethod.GET)
     @ResponseBody
     public void exportExcel(HttpServletRequest request, HttpServletResponse response, GameInfo record) throws Exception {
 
-    List<GameInfo> gameInfos = gameInfoService.getGameInfoList(record);
+        List<GameInfo> gameInfos = gameInfoService.getGameInfoList(record);
 
 
         String sheetName = "game_info";
         String titleName = "游戏数据表";
         String fileName = "游戏表";
         int columnNumber = 12;
-        int[] columnWidth = { 20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20 };
-        String[] columnName = {  "ID" ,   "删除标识" ,   "更新时间" ,   "更新人" ,   "创建时间" ,   "创建人" ,   "游戏名" ,   "类型" ,   "图标" ,   "排序" ,   "备注" ,   "可用"  };
+        int[] columnWidth = {20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20};
+        String[] columnName = {"ID", "删除标识", "更新时间", "更新人", "创建时间", "创建人", "游戏名", "类型", "图标", "排序", "备注", "可用"};
         String[][] dataList = new String[gameInfos.size()][12];
 
         for (int i = 0; i < gameInfos.size(); i++) {
 
-                        dataList[i][0] = String.valueOf(gameInfos.get(i).getId());
-                        dataList[i][1] = String.valueOf(gameInfos.get(i).getDelFlag());
-                        dataList[i][2] = String.valueOf(gameInfos.get(i).getUpdateTime());
-                        dataList[i][3] = String.valueOf(gameInfos.get(i).getUpdateUser());
-                        dataList[i][4] = String.valueOf(gameInfos.get(i).getCreateTime());
-                        dataList[i][5] = String.valueOf(gameInfos.get(i).getCreateUser());
-                        dataList[i][6] = String.valueOf(gameInfos.get(i).getGameName());
-                        dataList[i][7] = String.valueOf(gameInfos.get(i).getTypeFlag());
-                        dataList[i][8] = String.valueOf(gameInfos.get(i).getIcon());
-                        dataList[i][9] = String.valueOf(gameInfos.get(i).getRank());
-                        dataList[i][10] = String.valueOf(gameInfos.get(i).getRemark());
-                        dataList[i][11] = String.valueOf(gameInfos.get(i).getUseFlag());
-                    }
+            dataList[i][0] = String.valueOf(gameInfos.get(i).getId());
+            dataList[i][1] = String.valueOf(gameInfos.get(i).getDelFlag());
+            dataList[i][2] = String.valueOf(gameInfos.get(i).getUpdateTime());
+            dataList[i][3] = String.valueOf(gameInfos.get(i).getUpdateUser());
+            dataList[i][4] = String.valueOf(gameInfos.get(i).getCreateTime());
+            dataList[i][5] = String.valueOf(gameInfos.get(i).getCreateUser());
+            dataList[i][6] = String.valueOf(gameInfos.get(i).getGameName());
+            dataList[i][7] = String.valueOf(gameInfos.get(i).getTypeFlag());
+            dataList[i][8] = String.valueOf(gameInfos.get(i).getIcon());
+            dataList[i][9] = String.valueOf(gameInfos.get(i).getRank());
+            dataList[i][10] = String.valueOf(gameInfos.get(i).getRemark());
+            dataList[i][11] = String.valueOf(gameInfos.get(i).getUseFlag());
+        }
 
 
         ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,
-        columnNumber, columnWidth, columnName, dataList, response);
+                columnNumber, columnWidth, columnName, dataList, response);
 
 
-        }
     }
 
+    @RequestMapping(value = "/seasons", method = RequestMethod.GET)
+    @ResponseBody
+    public Result seasons(GameInfo record) {
+        List<GameInfo> pp = gameInfoService.getGameInfoSeasonsList(record);
+        return new Result(true, pp);
+    }
+
+}
+