package lingtao.net.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

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

import lingtao.net.bean.SysPermission;
import lingtao.net.service.SysPermissionService;

@RequestMapping("/sysPermission")
@Controller
public class SysPermissionController {

	@Autowired
	private SysPermissionService sysPermissionService;

	@RequestMapping("/index")
	public String index() throws Exception {
		return "system/permission/index";
	}

	@RequestMapping("/parentList")
	@ResponseBody
	public List<SysPermission> parentList() {
		return sysPermissionService.getParentPers();
	}

	@RequestMapping("/list")
	@ResponseBody
	public Map<String, Object> list() throws Exception {
		Map<String, Object> map = new HashMap<>();
		map.put("code", 0);
		map.put("msg", null);
		map.put("data", sysPermissionService.getAll());
		return map;
	}
}
