package com.uas.platform.b2b.mobile.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.uas.platform.b2b.mobile.model.AdvancedSettings;
import com.uas.platform.b2b.mobile.service.AdvancedSettingsService;

@Controller("mobile.AdvancedSettingsController")
@RequestMapping("/mobile/advancedSettings")
public class AdvancedSettingsController {

	@Autowired
	private AdvancedSettingsService advancedSettingsService;

	/**
	 * 保存高级设置
	 * 
	 * @param formStore
	 */
	@RequestMapping(value = "/saveAdvancedSettings", method = RequestMethod.POST)
	@ResponseBody
	private ModelMap saveAdvancedSettings(String formStore) {
		AdvancedSettings advancedSettings = JSON.parseObject(formStore, AdvancedSettings.class);
		return advancedSettingsService.saveAdvancedSettings(advancedSettings);
	}

	/**
	 * 得到高级设置
	 * 
	 * @param enuu
	 * @return
	 */
	@RequestMapping(value = "/getAdvancedSettings", method = RequestMethod.GET)
	@ResponseBody
	private AdvancedSettings getAdvancedSettings(Long enuu) {
		return advancedSettingsService.getSettingsByEnuu(enuu);
	}
}
