package com.mosquito.project.persistence.repository;

import com.mosquito.project.persistence.entity.UserTagEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 用户标签仓库
 */
@Repository
public interface UserTagRepository extends JpaRepository<UserTagEntity, Long> {

    /**
     * 根据用户ID查询标签列表
     */
    List<UserTagEntity> findByUserId(Long userId);

    /**
     * 根据用户ID删除标签
     */
    void deleteByUserId(Long userId);

    /**
     * 根据用户ID和标签名查询
     */
    UserTagEntity findByUserIdAndTagName(Long userId, String tagName);

    /**
     * 检查用户是否有某个标签
     */
    boolean existsByUserIdAndTagName(Long userId, String tagName);
}
