Kaynağa Gözat

feat(tournaments): 添加排期配置ID支持

- 在TournamentConfig、TournamentConfigBo、Tournaments、TournamentsDto、TournamentsTemplate实体中添加configId字段
- 在TournamentsMapper.xml中为相关查询语句添加config_id字段映射
- 在TournamentsServiceImpl.java中修改状态检查逻辑,优化编辑权限控制
- 在TournamentsTemplateMapper.xml中为模板相关操作添加config_id字段支持
- 在ScheduleTask.java中设置赛事配置ID以支持任务调度功能
fugui001 2 hafta önce
ebeveyn
işleme
b1407211b8

+ 4 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/TournamentConfig.java

@@ -82,5 +82,8 @@ public class TournamentConfig extends BaseEntity {
      */
     private Long updatedAt;
 
-
+    /**
+     * 排期配置id
+     */
+    private Long configId;
 }

+ 1 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/Tournaments.java

@@ -157,5 +157,5 @@ public class Tournaments extends BaseEntity {
     private Integer delayShow;
 
     private String remark;
-
+    private Long configId;
 }

+ 2 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/TournamentsTemplate.java

@@ -150,4 +150,6 @@ public class TournamentsTemplate extends BaseEntity {
     private Integer delayShow;
     private String remark;
 
+    private Long configId;
+
 }

+ 4 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/bo/TournamentConfigBo.java

@@ -90,5 +90,8 @@ public class TournamentConfigBo extends BaseEntity {
     //@NotNull(message = "更新时间(毫秒时间戳)不能为空", groups = { AddGroup.class, EditGroup.class })
     private Long updatedAt;
 
-
+    /**
+     * 排期配置id
+     */
+    private Long configId;
 }

+ 2 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/dto/TournamentsDto.java

@@ -117,4 +117,6 @@ public class TournamentsDto {
     private Integer delayShow;
 
     private String remark;
+
+    private Long configId;
 }

+ 1 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/vo/TournamentsVo.java

@@ -314,4 +314,5 @@ public class TournamentsVo implements Serializable {
     @ExcelProperty(value = "赛事类目")
     private  String categoryNameIds;
     private String remark;
+
 }

+ 3 - 4
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/impl/TournamentsServiceImpl.java

@@ -595,15 +595,14 @@ public class TournamentsServiceImpl implements ITournamentsService {
             //增加已经报名限制
 
             TournamentsVo tournamentsVo = baseMapper.selectVoByIdInfo(bo.getId());
-            if(tournamentsVo != null && (tournamentsVo.getStatus() != 0 || tournamentsVo.getStatus() != -1)){
+            // 只有当状态不是-1(未发布)且不是0(未开始)时,才禁止编辑
+            if(tournamentsVo != null && tournamentsVo.getStatus() != -1 && tournamentsVo.getStatus() != 0){
                 throw new RuntimeException("本场赛事已经开始或已关闭!禁止编辑调整!");
             }
-
-         /*   int selectParticipantsTotal = participantsMapper.selectParticipantsInfoTotal(bo.getId());
+            /*   int selectParticipantsTotal = participantsMapper.selectParticipantsInfoTotal(bo.getId());
             if(selectParticipantsTotal>0){
                 throw new RuntimeException("本场赛事已经有人报名参加!禁止编辑调整!");
             }*/
-
             // 转换 BO -> Entity
             Tournaments update = new Tournaments();
             BeanUtils.copyProperties(bo, update);

+ 1 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/job/business/ScheduleTask.java

@@ -313,7 +313,7 @@ public class ScheduleTask {
                 // 使用指定的格式器格式化 LocalDateTime 对象
                 String startTime = triggerTime.format(formatter);
                 bo.setStartTime(startTime);
-
+                bo.setConfigId(tournamentsVo.getConfigId());
                 // 设置基础字段
                 bo.setName(tournamentsVo.getName());
                 bo.setGameType(tournamentsVo.getGameType()); // 假设有5种类型

+ 5 - 3
ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/TournamentsMapper.xml

@@ -8,13 +8,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT * FROM tournaments ${ew.customSqlSegment}
     </select>
 
-
     <select id="selectTournamentsVoList" resultType="org.dromara.business.domain.vo.TournamentsVo">
-        SELECT id, name, start_time, end_time,game_type, starting_chips, level_duration, late_registration_level, max_players, status, created_at, updated_at,sign_time,competition_icon,tournaments_bi_id,robot_count,is_delete,delay_card_time,delay_card_num,action_time,competition_bg,min_players,game_variant,target_tournament_id,qualifier_value,qualifier_type,start_blind_level,rebuy,delay_show,remark FROM tournaments  ${ew.customSqlSegment}
+        SELECT id, name, start_time, end_time,game_type, starting_chips, level_duration, late_registration_level, max_players, status, created_at, updated_at,sign_time,competition_icon,tournaments_bi_id,robot_count,is_delete,delay_card_time,delay_card_num,action_time,competition_bg,min_players,game_variant,target_tournament_id,qualifier_value,qualifier_type,start_blind_level,rebuy,delay_show,remark,config_id FROM tournaments  ${ew.customSqlSegment}
     </select>
 
     <select id="selectVoByIdInfo" resultType="org.dromara.business.domain.vo.TournamentsVo">
-       SELECT id, name, start_time, end_time,game_type, starting_chips, level_duration, late_registration_level, max_players, status, created_at, updated_at,sign_time,competition_icon,tournaments_bi_id,robot_count,is_delete,delay_card_time,delay_card_num,action_time,competition_bg,min_players,game_variant,target_tournament_id,qualifier_value,qualifier_type,start_blind_level,rebuy,delay_show,remark FROM tournaments WHERE id =  #{id}
+       SELECT id, name, start_time, end_time,game_type, starting_chips, level_duration, late_registration_level, max_players, status, created_at, updated_at,sign_time,competition_icon,tournaments_bi_id,robot_count,is_delete,delay_card_time,delay_card_num,action_time,competition_bg,min_players,game_variant,target_tournament_id,qualifier_value,qualifier_type,start_blind_level,rebuy,delay_show,remark,config_id FROM tournaments WHERE id =  #{id}
     </select>
     <update id="updateTournamentsBeginById">
        UPDATE tournaments SET status = #{status} WHERE id = #{id}
@@ -50,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="qualifierValue != null">qualifier_value = #{qualifierValue},</if>
             <if test="rebuy != null">rebuy = #{rebuy},</if>
             <if test="remark != null">remark = #{remark},</if>
+            <if test="configId != null">config_id = #{configId},</if>
             <if test="delayShow != null">delay_show = #{delayShow}</if>
          </set>
         WHERE id = #{id}
@@ -87,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="rebuy != null">rebuy,</if>
             <if test="delayShow != null">delay_show,</if>
             <if test="remark != null">remark,</if>
+            <if test="configId != null">config_id,</if>
         </trim>
         VALUES
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -118,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="rebuy != null">#{rebuy},</if>
             <if test="delayShow != null">#{delayShow},</if>
             <if test="remark != null">#{remark},</if>
+            <if test="configId != null">#{configId},</if>
         </trim>
     </insert>
 

+ 6 - 3
ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/TournamentsTemplateMapper.xml

@@ -10,15 +10,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <select id="selectTournamentsVoListTemplate" resultType="org.dromara.business.domain.vo.TournamentsVo">
-        SELECT id, name, start_time, end_time,game_type, starting_chips, level_duration, late_registration_level, max_players, status, created_at, updated_at,sign_time,competition_icon,tournaments_bi_id,reward_players,total_signup,robot_count,delay_card_time,delay_card_num,action_time,competition_bg,min_players,game_variant,target_tournament_id,qualifier_value,qualifier_type,start_blind_level,rebuy,delay_show,remark FROM tournaments_template  ${ew.customSqlSegment}
+        SELECT id, name, start_time, end_time,game_type, starting_chips, level_duration, late_registration_level, max_players, status, created_at, updated_at,sign_time,competition_icon,tournaments_bi_id,reward_players,total_signup,robot_count,delay_card_time,delay_card_num,action_time,competition_bg,min_players,game_variant,target_tournament_id,qualifier_value,qualifier_type,start_blind_level,rebuy,delay_show,remark,config_id FROM tournaments_template  ${ew.customSqlSegment}
     </select>
 
     <select id="selectVoByIdInfoTemplate" resultType="org.dromara.business.domain.vo.TournamentsVo">
-       SELECT id, name, start_time, end_time,game_type, starting_chips, level_duration, late_registration_level, max_players, status, created_at, updated_at,sign_time,competition_icon,tournaments_bi_id,reward_players,total_signup,robot_count,delay_card_time,delay_card_num,action_time,competition_bg,min_players,game_variant,target_tournament_id,qualifier_value,qualifier_type,start_blind_level,rebuy,delay_show,remark FROM tournaments_template WHERE id =  #{id}
+       SELECT id, name, start_time, end_time,game_type, starting_chips, level_duration, late_registration_level, max_players, status, created_at, updated_at,sign_time,competition_icon,tournaments_bi_id,reward_players,total_signup,robot_count,delay_card_time,delay_card_num,action_time,competition_bg,min_players,game_variant,target_tournament_id,qualifier_value,qualifier_type,start_blind_level,rebuy,delay_show,remark,config_id FROM tournaments_template WHERE id =  #{id}
     </select>
 
     <select id="selectTournamentsVoListTemplateList" resultType="org.dromara.business.domain.vo.TournamentsVo">
-        SELECT id, name, start_time, end_time,game_type, starting_chips, level_duration, late_registration_level, max_players, status, created_at, updated_at,sign_time,competition_icon,tournaments_bi_id,reward_players,total_signup,robot_count,delay_card_time,delay_card_num,action_time,competition_bg,min_players,game_variant,target_tournament_id,qualifier_value,qualifier_type,start_blind_level,rebuy,delay_show,remark FROM tournaments_template  ${ew.customSqlSegment}
+        SELECT id, name, start_time, end_time,game_type, starting_chips, level_duration, late_registration_level, max_players, status, created_at, updated_at,sign_time,competition_icon,tournaments_bi_id,reward_players,total_signup,robot_count,delay_card_time,delay_card_num,action_time,competition_bg,min_players,game_variant,target_tournament_id,qualifier_value,qualifier_type,start_blind_level,rebuy,delay_show,remark,config_id FROM tournaments_template  ${ew.customSqlSegment}
     </select>
 
     <update id="updateTournamentsByIdTemplate">
@@ -52,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="qualifierValue != null">qualifier_value = #{qualifierValue},</if>
             <if test="rebuy != null">rebuy = #{rebuy},</if>
             <if test="remark != null">remark = #{remark},</if>
+            <if test="configId != null">config_id = #{configId},</if>
             <if test="delayShow != null">delay_show = #{delayShow}</if>
         </set>
         WHERE id = #{id}
@@ -88,6 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="rebuy != null">rebuy,</if>
             <if test="delayShow != null">delay_show,</if>
             <if test="remark != null">remark,</if>
+            <if test="configId != null">config_id,</if>
         </trim>
         VALUES
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -118,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="rebuy != null">#{rebuy},</if>
             <if test="delayShow != null">#{delayShow},</if>
             <if test="remark != null">#{remark},</if>
+            <if test="configId != null">#{configId},</if>
         </trim>
     </insert>