package cn.com.qmth.stmms.biz.exam.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.com.qmth.stmms.biz.common.BaseQueryService;
import cn.com.qmth.stmms.biz.exam.dao.ImportQueryDao;
import cn.com.qmth.stmms.biz.exam.model.ImportQuery;
import cn.com.qmth.stmms.biz.exam.service.ImportQueryService;
import cn.com.qmth.stmms.common.enums.ImportType;

@Service
public class ImportQueryServiceImpl extends BaseQueryService<ImportQuery> implements ImportQueryService {

    @Autowired
    private ImportQueryDao queryDao;

    @Transactional
    @Override
    public ImportQuery save(ImportQuery i) {
        i.setCreateTime(new Date());
        return queryDao.save(i);
    }

    @Transactional
    @Override
    public void deleteByExamIdAndUserIdAndType(int examId, Integer userId, ImportType type) {
        queryDao.deleteByExamIdAndUserIdAndType(examId, userId, type);
    }

    @Override
    public ImportQuery findByExamIdAndUserIdAndType(int examId, Integer userId, ImportType type) {
        return queryDao.findByExamIdAndUserIdAndType(examId, userId, type);
    }

}
