package cn.com.qmth.examcloud.core.questions.service.impl;


import cn.com.qmth.examcloud.core.questions.base.enums.Switch;
import cn.com.qmth.examcloud.core.questions.dao.SettingRepo;
import cn.com.qmth.examcloud.core.questions.dao.entity.Setting;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by songyue on 16/12/28.
 */
@Service
public class SettingService {

    @Autowired
    private SettingRepo settingRepo;

    public void initData() {
        if (settingRepo.count() == 0) {
            Setting importSetting = new Setting();
            Setting genSetting = new Setting();
            importSetting.setCode("import");
            importSetting.setName("试题入库审核");
            importSetting.setStatus(Switch.ON);
            genSetting.setCode("gen");
            genSetting.setName("试卷组成审核");
            genSetting.setStatus(Switch.ON);
            settingRepo.save(importSetting);
            settingRepo.save(genSetting);
        }
    }
}
