package org.dromara.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.domain.communityNews.CommentIndex;
import org.dromara.domain.communityNews.vo.CommentChildrenVo;
import org.dromara.domain.communityNews.vo.CommentIndexShVo;
import org.dromara.domain.communityNews.vo.CommentIndexVo;
import org.dromara.domain.communityNews.vo.CommentIndexVoOld;

import java.util.List;

/**
 * 社区资讯评论Mapper接口
 *
 * @author boman
 * @date 2025-04-11
 */
public interface CommentIndexMapper extends BaseMapperPlus<CommentIndex, CommentIndexVo> {

    /**
     * 查询社区资讯评论-----审核列表
     */
    @InterceptorIgnore(tenantLine = "true", dataPermission = "false")
    Page<CommentIndexShVo> commentSh(@Param("page") Page<CommentIndexShVo> page, @Param("commentIndexShVo") CommentIndexShVo commentIndexShVo);

    /**
     * 根据查询所有一级评论组带子集总数组装成前端所需要的数据结构 带分页
     *
     * @param commentIndex
     * @return
     */
    @InterceptorIgnore(tenantLine = "true", dataPermission = "false")
    Page<CommentIndexVoOld> getRootComment(@Param("page") Page<CommentIndex> page, @Param("commentIndex") CommentIndex commentIndex);


    /**
     * 根据parent_id查询所有评论组装成前端所需要的子集数据结构 带分页
     *
     * @param commentIndex
     * @return
     */
    @InterceptorIgnore(tenantLine = "true", dataPermission = "false")
    Page<CommentChildrenVo> getParentComment(@Param("page") Page<CommentIndex> page,@Param("commentIndex")CommentIndex commentIndex);

    /**
     * //查找出所有parent_id = commentId的commentId
     * @param commentId
     * @return
     */
    @InterceptorIgnore(tenantLine = "true", dataPermission = "false")
     List<CommentIndex> selectCommentIdListByCommentId(Long commentId);

}
