package com.ynfy.buss.course.category.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ynfy.buss.course.category.entity.CourseCategory;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.SelectTreeModel;

import java.util.List;

/**
 * @Description: 课程分类
 * @Author: jeecg-boot
 * @Date: 2024-01-21
 * @Version: V1.0
 */
public interface ICourseCategoryService extends IService<CourseCategory> {

    /**
     * 根节点父ID的值
     */
    public static final String ROOT_PID_VALUE = "0";

    /**
     * 树节点有子节点状态值
     */
    public static final String HASCHILD = "1";

    /**
     * 树节点无子节点状态值
     */
    public static final String NOCHILD = "0";

    /**
     * 新增节点
     *
     * @param courseCategory
     */
    void addCourseCategory(CourseCategory courseCategory);

    /**
     * 修改节点
     *
     * @param courseCategory
     * @throws JeecgBootException
     */
    void updateCourseCategory(CourseCategory courseCategory) throws JeecgBootException;

    /**
     * 删除节点
     *
     * @param id
     * @throws JeecgBootException
     */
    void deleteCourseCategory(String id) throws JeecgBootException;

    /**
     * 查询所有数据，无分页
     *
     * @param queryWrapper
     * @return List<CourseCategory>
     */
    List<CourseCategory> queryTreeListNoPage(QueryWrapper<CourseCategory> queryWrapper);

    /**
     * 【vue3专用】根据父级编码加载分类字典的数据
     *
     * @param parentCode
     * @return
     */
    List<SelectTreeModel> queryListByCode(String parentCode);

    /**
     * 【vue3专用】根据pid查询子节点集合
     *
     * @param pid
     * @return
     */
    List<SelectTreeModel> queryListByPid(String pid);

}
