package com.aircraft.modules.article.mapper;

import com.aircraft.modules.article.domain.CpLabel;
import com.aircraft.modules.article.domain.dto.CpLabelDTO;
import com.aircraft.modules.article.domain.dto.CpLabelVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 标签表 Mapper 接口
 * </p>
 *
 * @author cli
 * @since 2025-07-10
 */
@Mapper
public interface CpLabelMapper extends BaseMapper<CpLabel> {
    @Select("SELECT * FROM cp_label WHERE  name = #{labelName}")
    CpLabelDTO findByName(String labelName);

    List<CpLabel> selectLabelTreeByModuleId(Integer moduleId);

    void updateDelFlagById(Integer id, Integer delFlag);

    @Select("SELECT * FROM cp_label WHERE  id = #{labelId}")
    CpLabel findById(int labelId);

    IPage<CpLabelVo> selectVoPage(Page<CpLabelVo> page, String name);

    void updateModuleIdById(int moduleId);
}
