/**
 * 
 */
package com.xiugou.x1.backstage.module.issueplatform.wabo.service;

import org.gaming.backstage.service.SystemOneToManyService;
import org.gaming.ruler.lifecycle.Lifecycle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiugou.x1.backstage.foundation.starting.ApplicationSettings;
import com.xiugou.x1.backstage.module.issueplatform.wabo.model.WaboSetting;

/**
 * @author YY
 *
 */
@Service
public class WaboSettingService extends SystemOneToManyService<WaboSetting> implements Lifecycle {

	@Autowired
	private ApplicationSettings applicationSettings;
	
	@Override
	public void start() throws Exception {
		if(!applicationSettings.isServerBackstageMain()) {
			return;
		}
		WaboSetting waboSetting = this.getById(1L);
		if(waboSetting != null) {
			return;
		}
		waboSetting = new WaboSetting();
		waboSetting.setId(1L);
		this.insert(waboSetting);
	}
	
	public WaboSetting getSetting() {
		return this.getEntity(1L);
	}
}
