package com.ruoyi.system.service.impl.customerServiceImpl;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.system.datasource.DynamicDataSourceContextHolder;
import com.ruoyi.system.domain.customer.QuestionEntity;
import com.ruoyi.system.mapper.customerServiceMapper.QuestionMapper;
import com.ruoyi.system.service.impl.customerService.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
@Service
@DataSource(value = DataSourceType.GIG_CUSTOMER)
public class QuestionServiceImpl implements QuestionService {
    @Autowired
    private QuestionMapper questionMapper;

    @Override
    public List<QuestionEntity> findAnswerByQuestion(String questionContent, Long userId) {
        return Collections.emptyList();
    }
    /**
     *
     * @param questionEntity 会话信息
     * @return
     */
    @Override
    public List<QuestionEntity> selectQuestionList(QuestionEntity questionEntity) {
        try {
            return questionMapper.selectQuestionList(questionEntity);
        } finally {
            DynamicDataSourceContextHolder.clearDataSourceType();
        }
    }
}
