package com.lesingle.creation.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lesingle.creation.entity.DictItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 字典项 Mapper 接口
 */
@Mapper
public interface DictItemMapper extends BaseMapper<DictItem> {

    /**
     * 根据字典 ID 查询字典项列表
     *
     * @param dictId 字典 ID
     * @return 字典项列表
     */
    @Select("SELECT * FROM t_sys_dict_item WHERE dict_id = #{dictId} AND deleted = 0 ORDER BY sort ASC")
    List<DictItem> selectByDictId(@Param("dictId") Long dictId);

    /**
     * 批量插入字典项
     *
     * @param dictItems 字典项列表
     * @return 插入数量
     */
    int insertBatch(@Param("list") List<DictItem> dictItems);
}
