package com.ssj.service.kmt.kmt.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestionKnow;
import com.ssj.dao.kmt.kmt.dao.KmtExerciseQueryDao;
import com.ssj.dao.kmt.kmt.dao.KmtExerciseQuestionKnowDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.service.kmt.service.KmtExerciseQuestionKnowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Transactional
@Service(version ="1.0")
public class KmtExerciseQuestionServiceKnowImpl extends BaseServiceImpl<KmtExerciseQuestionKnow, String> implements KmtExerciseQuestionKnowService {

    @Autowired
    private KmtExerciseQuestionKnowDao kmtExerciseQuestionKnowDao;

    @Autowired
    private KmtExerciseQueryDao queryDao;

    @Override
    public PagingAndSortingRepository<KmtExerciseQuestionKnow, String> getDao() {
        return kmtExerciseQuestionKnowDao;
    }

    @Override
    @Transactional(propagation = Propagation.NOT_SUPPORTED)
    public List<Map<String, Object>> findQuestionKnowByQuestionIds(List<String> questionIds, int versionType) {
        return queryDao.findHowDetailNameByQuestionIds(questionIds, versionType);
    }

    @Override
    public List<KmtExerciseQuestionKnow> findByQuestionId(String questionId) {
        return kmtExerciseQuestionKnowDao.findByQuestionId(questionId);
    }

    @Override
    public List<KmtExerciseQuestionKnow> findByQuestionIdIn(List<String> questionIdList) {
        return kmtExerciseQuestionKnowDao.findByQuestionIdIn(questionIdList);
    }

    @Override
    public void deleteByQuestionId (List<String> questionIds) {
        kmtExerciseQuestionKnowDao.deleteByQuestionId(questionIds);

    }

    @Override
    public void flush() {
        kmtExerciseQuestionKnowDao.flush();
    }
}