Kaynağa Gözat

feat(system): 新增类目与标签选择列表接口及赛事相关字段

- 在 CategoryTagController 中新增 selectTagSelList 和 selectCategorySelList 接口
- 实现 categoryTagService.selectCategoryTagSelList 方法并支持按类型查询
- 在 TournamentCategoryTagMapper 中新增 selectCategoryOrTagId 查询方法
- 扩展 Tournaments、TournamentsDto 和 TournamentsVo 类,增加 rebuy、delayShow、tagId 和 categoryId 字段
- 更新 TournamentsMapper.xml 中的 SQL 查询和插入语句以支持新字段
- 在 TournamentsServiceImpl 中实现类目和标签的关联保存与更新逻辑
- 完善赛事详情查询时返回关联的类目和标签 ID 信息
fugui001 1 hafta önce
ebeveyn
işleme
69abea2346

+ 12 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/controller/CategoryTagController.java

@@ -92,7 +92,7 @@ public class CategoryTagController extends BaseController {
 
     /**
      * 删除类目与标签合并
-     *
+     *selectCategoryTagSelList
      * @param ids 主键串
      */
     @SaCheckPermission("business:tag:remove")
@@ -102,4 +102,15 @@ public class CategoryTagController extends BaseController {
                           @PathVariable Long[] ids) {
         return toAjax(categoryTagService.deleteWithValidByIds(List.of(ids), true));
     }
+
+
+    @GetMapping("/selectTagSelList")
+    public R<List<CategoryTagVo>> selectTagSelList() {
+        return R.ok(categoryTagService.selectCategoryTagSelList("TAG"));
+    }
+
+    @GetMapping("/selectCategorySelList")
+    public R<List<CategoryTagVo>> selectCategorySelList() {
+        return R.ok(categoryTagService.selectCategoryTagSelList("CATEGORY"));
+    }
 }

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

@@ -149,4 +149,11 @@ public class Tournaments extends BaseEntity {
      */
     private Integer gameVariant;
 
+
+
+    // 重复买入:<0不可重复买入,0-不限制,>0限制次数
+    private Integer rebuy;
+    //0-默认不开启延迟看牌,1-开启
+    private Integer delayShow;
+
 }

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

@@ -108,5 +108,11 @@ public class TournamentsDto {
      */
     private  Integer qualifierValue;
 
+    private  Long tagId;
+    private  Long categoryId;
 
+    // 重复买入:<0不可重复买入,0-不限制,>0限制次数
+    private Integer rebuy;
+    //0-默认不开启延迟看牌,1-开启
+    private Integer delayShow;
 }

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

@@ -295,4 +295,14 @@ public class TournamentsVo implements Serializable {
      */
     private Integer gameVariant;
 
+
+
+    // 重复买入:<0不可重复买入,0-不限制,>0限制次数
+    private Integer rebuy;
+    //0-默认不开启延迟看牌,1-开启
+    private Integer delayShow;
+
+    private  Long tagId;
+    private  Long categoryId;
+
 }

+ 5 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/mapper/CategoryTagMapper.java

@@ -42,4 +42,9 @@ public interface CategoryTagMapper extends BaseMapperPlus<CategoryTag, CategoryT
     @InterceptorIgnore(tenantLine = "true")
     CategoryTagVo selectCategoryTagExit(@Param("id") Long id, @Param("name") String name, @Param("type") String type);
 
+    @InterceptorIgnore(tenantLine = "true")
+    List<CategoryTagVo> selectCategoryTagSelList(@Param("type") String type);
+
+
+
 }

+ 3 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/mapper/TournamentCategoryTagMapper.java

@@ -25,4 +25,7 @@ public interface TournamentCategoryTagMapper extends BaseMapperPlus<TournamentCa
     @InterceptorIgnore(tenantLine = "true")
     int deleteTournamentCategoryTagByIds(@Param("tournamentId") Long tournamentId, @Param("categoryTagId") Long categoryTagId);
 
+    @InterceptorIgnore(tenantLine = "true")
+    Long selectCategoryOrTagId(@Param("type") String type,@Param("tournamentId") Long tournamentId);
+
 }

+ 3 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/ICategoryTagService.java

@@ -65,4 +65,7 @@ public interface ICategoryTagService {
      * @return 是否删除成功
      */
     Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+
+    List<CategoryTagVo> selectCategoryTagSelList(String type);
 }

+ 5 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/impl/CategoryTagServiceImpl.java

@@ -141,4 +141,9 @@ public class CategoryTagServiceImpl implements ICategoryTagService {
         }
         return baseMapper.deleteCategoryTagById(ids) > 0;
     }
+
+    @Override
+    public List<CategoryTagVo> selectCategoryTagSelList(String type) {
+        return baseMapper.selectCategoryTagSelList(type);
+    }
 }

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

@@ -88,6 +88,7 @@ public class TournamentsServiceImpl implements ITournamentsService {
 
     private final ScheduleTournamentsReletionMapper scheduleTournamentsReletionMapper;
 
+    private final TournamentCategoryTagMapper tournamentCategoryTagMapper;
 
     @Autowired
     RedisUtil redisUtil;
@@ -156,6 +157,11 @@ public class TournamentsServiceImpl implements ITournamentsService {
         }else{
             tournamentsVo.setIsComplaints(false);
         }
+        //查询类目和标签ID
+        Long category = tournamentCategoryTagMapper.selectCategoryOrTagId("CATEGORY", tournamentId);
+        tournamentsVo.setCategoryId(category);
+        Long tag = tournamentCategoryTagMapper.selectCategoryOrTagId("TAG", tournamentId);
+        tournamentsVo.setTagId(tag);
         return tournamentsVo;
     }
 
@@ -416,6 +422,8 @@ public class TournamentsServiceImpl implements ITournamentsService {
             // 处理奖励分布
             processPrizeDistributions(tournamentId, prizeList);
 
+            addCategoryTag(tournamentId, bo.getCategoryId(),bo.getTagId());
+
             bo.setId(tournamentId);
             return true;
 
@@ -501,6 +509,27 @@ public class TournamentsServiceImpl implements ITournamentsService {
         tournamentEntryConditionsMapper.insert(condition);
     }
 
+    //
+    private void addCategoryTag(Long tournamentId, Long categoryId,Long tagId) {
+        // 如果 categoryId 有值,则插入一条记录
+        if (categoryId != null) {
+            TournamentCategoryTag categoryTag = new TournamentCategoryTag();
+            categoryTag.setTournamentId(tournamentId);
+            categoryTag.setCategoryTagId(categoryId);
+            tournamentCategoryTagMapper.insertTournamentCategoryTag(categoryTag);
+        }
+
+        // 如果 tagId 有值,则插入一条记录
+        if (tagId != null) {
+            TournamentCategoryTag tag = new TournamentCategoryTag();
+            tag.setTournamentId(tournamentId);
+            tag.setCategoryTagId(tagId);
+            tournamentCategoryTagMapper.insertTournamentCategoryTag(tag);
+        }
+    }
+
+
+
     private void processPrizeDistributions(Long tournamentId, List<ItemsPrizeDto> itemsPrizeList) {
         // 排序(按排名正序)
         Collections.sort(itemsPrizeList, Comparator.comparing(ItemsPrizeDto::getRanking));
@@ -586,6 +615,9 @@ public class TournamentsServiceImpl implements ITournamentsService {
             //重新处理奖励分布
             processPrizeDistributions(tournamentId, prizeList);
 
+            tournamentCategoryTagMapper.deleteByTournamentCategoryTagTournamentId(tournamentId);
+            addCategoryTag(tournamentId, bo.getCategoryId(),bo.getTagId());
+
             JSONObject jsonObject = new JSONObject();
             jsonObject.put("channelType", "tournament_edit");
             jsonObject.put("value", tournamentId);

+ 6 - 0
ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/CategoryTagMapper.xml

@@ -27,6 +27,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM category_tag  where id=#{id}
     </select>
 
+    <select id="selectCategoryTagSelList" resultType="org.dromara.business.domain.vo.CategoryTagVo">
+        SELECT <include refid="Base_Column_List"/>
+        FROM category_tag  where  1=1  and status = 1
+        <if test="type != null and type != ''">and type=#{type}</if>
+    </select>
+
     <insert id="insertCategoryTag" useGeneratedKeys="true" keyProperty="id">
         INSERT INTO category_tag (
         name,

+ 4 - 2
ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/TournamentCategoryTagMapper.xml

@@ -37,6 +37,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND category_tag_id = #{categoryTagId}
     </delete>
 
+    <select id="selectCategoryOrTagId" resultType="Long">
+        select a.category_tag_id from tournament_category_tag  a left join  category_tag b  on a.category_tag_id=b.id  where b.type=#{type} and  a.tournament_id=#{tournamentId}
+    </select>
 
-
-</mapper>
+ </mapper>

+ 9 - 6
ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/TournamentsMapper.xml

@@ -10,11 +10,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <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 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 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 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 FROM tournaments WHERE id =  #{id}
     </select>
 
 
@@ -46,7 +46,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="targetTournamentId != null">target_tournament_id = #{targetTournamentId},</if>
             <if test="qualifierType != null">qualifier_type = #{qualifierType},</if>
             <if test="startBlindLevel != null">start_blind_level = #{startBlindLevel},</if>
-            <if test="qualifierValue != null">qualifier_value = #{qualifierValue}</if>
+            <if test="qualifierValue != null">qualifier_value = #{qualifierValue},</if>
+            <if test="rebuy != null">rebuy = #{rebuy},</if>
+            <if test="delayShow != null">delay_show = #{delayShow}</if>
          </set>
         WHERE id = #{id}
     </update>
@@ -75,13 +77,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="actionTime != null">action_time,</if>
             <if test="competitionBg != null">competition_bg,</if>
             <if test="minPlayers != null">min_players,</if>
-
             <if test="gameVariant != null">game_variant,</if>
             <if test="targetTournamentId != null">target_tournament_id,</if>
             <if test="qualifierType != null">qualifier_type,</if>
             <if test="qualifierValue != null">qualifier_value,</if>
             <if test="startBlindLevel != null">start_blind_level,</if>
-
+            <if test="rebuy != null">rebuy,</if>
+            <if test="delayShow != null">delay_show,</if>
         </trim>
         VALUES
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -105,12 +107,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="actionTime != null">#{actionTime},</if>
             <if test="competitionBg != null">#{competitionBg},</if>
             <if test="minPlayers != null">#{minPlayers},</if>
-
             <if test="gameVariant != null">#{gameVariant},</if>
             <if test="targetTournamentId != null">#{targetTournamentId},</if>
             <if test="qualifierType != null">#{qualifierType},</if>
             <if test="qualifierValue != null">#{qualifierValue},</if>
             <if test="startBlindLevel != null">#{startBlindLevel},</if>
+            <if test="rebuy != null">#{rebuy},</if>
+            <if test="delayShow != null">#{delayShow},</if>
         </trim>
     </insert>