package com.ruoyi.test.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.test.domain.KnowledgeTree;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface KnowledgeTreeMapper extends BaseMapper<KnowledgeTree> {

    int addKnowledgeTree(@Param("grade")String grade,@Param("subject") String subject,@Param("pid") Long pid,@Param("content") String content);

    @Delete("Delete from knowledge_tree where grade = #{grade} and subject = #{subject}")
    int resetKnowledgeTree(@Param("grade") String grade,@Param("subject") String subject);

    @Delete("Delete from knowledge_tree where grade = #{grade} and subject = #{subject} and id = #{id}")
    int deleteKnowledgeTree(@Param("grade")String grade,@Param("subject")String subject,@Param("id")Long id);

    @Update("update knowledge_tree set content = #{content} where grade = #{grade} and subject = #{subject} and id = #{id}")
    int update(@Param("grade")String grade,@Param("subject")String subject,@Param("id")Long id,@Param("content")String content);
}
