package com.ycwl.basic.puzzle.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycwl.basic.puzzle.entity.PuzzleFillRuleItemEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 拼图自动填充规则明细 Mapper
 */
@Mapper
public interface PuzzleFillRuleItemMapper extends BaseMapper<PuzzleFillRuleItemEntity> {

    /**
     * 根据规则ID查询所有明细(按item_order升序)
     *
     * @param ruleId 规则ID
     * @return 明细列表
     */
    List<PuzzleFillRuleItemEntity> listByRuleId(@Param("ruleId") Long ruleId);

    /**
     * 批量插入明细
     *
     * @param items 明细列表
     * @return 插入数量
     */
    int batchInsert(@Param("items") List<PuzzleFillRuleItemEntity> items);

    /**
     * 根据规则ID删除所有明细
     *
     * @param ruleId 规则ID
     * @return 删除数量
     */
    int deleteByRuleId(@Param("ruleId") Long ruleId);
}
