package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.entity.ResourceCategory;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ResourceCategoryMapper extends BaseMapper<ResourceCategory> {
    
    @Select("SELECT * FROM resource_category WHERE parent_id = #{parentId}")
    List<ResourceCategory> selectByParentId(Integer parentId);
    
    @Select("SELECT * FROM resource_category ORDER BY parent_id, id")
    List<ResourceCategory> selectAllCategories();
    
    @Select("SELECT * FROM resource_category WHERE name LIKE CONCAT('%', #{name}, '%') ORDER BY parent_id, id")
    List<ResourceCategory> selectPage(@Param("name") String name);
} 