package com.bonus.material.devConfig.mapper;

// EquipmentTypeMapper.java

import com.bonus.material.devConfig.domain.EquipmentType;
import com.bonus.material.devConfig.domain.EquipmentTypeEntity;
import com.bonus.material.devConfig.domain.EquipmentTypeQuery;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 装备分类Mapper
 */
@Mapper
public interface EquipmentTypeMapper {

    /**
     * 查询装备分类列表
     */
    List<EquipmentTypeEntity> selectEquipmentTypeList(EquipmentTypeEntity query);

    /**
     * 查询装备分类数量
     */
    Long countEquipmentTypeList(EquipmentTypeQuery query);

    /**
     * 根据父ID查询子分类
     */
    List<EquipmentType> selectChildrenByParentId(@Param("parentId") Long parentId);

    /**
     * 查询所有分类（构建树形结构用）
     */
    List<EquipmentType> selectAllEquipmentTypes();

    /**
     * 根据ID查询分类
     */
    EquipmentType selectEquipmentTypeById(@Param("typeId") Long typeId);

    /**
     * 新增装备分类
     */
    int insertEquipmentType(EquipmentType equipmentType);

    /**
     * 更新装备分类
     */
    int updateEquipmentType(EquipmentType equipmentType);

    /**
     * 删除装备分类
     */
    int deleteEquipmentTypeById(@Param("typeId") Long typeId);

    /**
     * 检查是否存在子分类
     */
    Long countChildrenByParentId(@Param("parentId") Long parentId);

    void deleteTypePropertiesByTypeId(@Param("typeId") Long typeId);

    int getToolByTypeIdAndTypeName(EquipmentType equipmentType);

    int countSameNameInSameLevel(EquipmentType equipmentType);
}
