package com.ssj.service.sys.opentest;

import com.ssj.bean.sys.opentest.OpenTestTemplate;
import com.ssj.dao.sys.opentest.OpenTestTemplateDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.framework.core.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Mount Liu
 * @date 2020/2/12
 */
@Service
@Transactional
public class OpenTestTemplateServiceImpl extends BaseServiceImpl<OpenTestTemplate, String> implements OpenTestTemplateService {

    @Autowired
    private OpenTestTemplateDao dao;

    @Override
    public PagingAndSortingRepository<OpenTestTemplate, String> getDao() {
        return dao;
    }

    @Override
    public OpenTestTemplate findTemplate(String module, String rightNum, String subject, String grade, String version) {
        if (StringUtil.isBlank(version)) {
            return dao.findTemplate(module, rightNum, subject, grade);
        } else {
            return dao.findTemplate(module, rightNum, subject, grade, version);
        }
    }

}
