package com.mcwl.communityCenter.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.Question;
import com.mcwl.communityCenter.domain.dto.QuestionPageRes;
import com.mcwl.communityCenter.domain.vo.QuestionVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import javax.validation.constraints.NotNull;
import java.util.List;

@Mapper
public interface QuestionMapper extends BaseMapper<Question> {
    @InterceptorIgnore(tenantLine = "true")
    List<QuestionVo> list(Page<Question> page,
                          @NotNull(message = "租户不能为空")
                          @Param("tenantId")
                          Long tenantId,
                          @NotNull(message = "社区不能为空")
                          @Param("communityId")
                          Long communityId);

    @InterceptorIgnore(tenantLine = "true")
    Question selectByIdAndTenantIdAndCommunityId(@Param("id")
                                                 Long id,
                                                 @Param("tenantId")
                                                 Long tenantId,
                                                 @Param("communityId")
                                                 Long communityId);

    @InterceptorIgnore(tenantLine = "true")
    Page<Question> listImage(Page<Question> page,
                             @NotNull(message = "租户不能为空")
                             @Param("tenantId")
                             Long tenantId,
                             @NotNull(message = "社区不能为空")
                             @Param("communityId")
                             Long communityId);

    @InterceptorIgnore(tenantLine = "true")
    List<QuestionVo> myQuestionList(Page<Question> page,
                                  @Param("questionPageRes") QuestionPageRes questionPageRes,
                                  @Param("userId") Long userId);
}
