package com.palmnest.webapp.controller;

import com.palmnest.service.AppMenuManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ExtendedModelMap;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * 系统菜单Controller
 *
 * @author yb
 * @since 2014-05-28
 */
@Controller
@RequestMapping("/admin/menu/*")
public class AppMenuController {
	
	private AppMenuManager appMenuManager;

	@Autowired
	public void setMenuManager(AppMenuManager appMenuManager) {
		this.appMenuManager = appMenuManager;
	}

	@RequestMapping(value = "/form")
	public ModelAndView formRequest() throws Exception {
		Model model      = new ExtendedModelMap();
		int   totalcount = appMenuManager.maxMenuId();
		model.addAttribute("totalcount", totalcount);
		return new ModelAndView("admin/menuForm", model.asMap());
	}

}
