package com.community.huiju.controller;


import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.community.commom.mode.ResponseBean;
import com.community.commom.session.UserElement;
import com.community.huiju.common.base.BaseController;
import com.community.huiju.model.SysMenu;
import com.community.huiju.service.ISysMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * <p>
 * 物业web端菜单表 前端控制器
 * </p>
 *
 * @author jobob
 * @since 2019-01-17
 */
@RestController
@RefreshScope
@RequestMapping("/")
@Api(value = "物业端菜单API", description = "物业端菜单API")
public class SysMenuController extends BaseController {
	
	@Autowired
	private ISysMenuService sysMenuService;
	
	@ApiOperation(value = "根据搜索条件获取菜单列表", notes = "根据搜索条件获取菜单列表")
	@ApiImplicitParams({
			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token"),
			@ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "Login-Type", value = "值为 web"),
	})
	@RequestMapping(value = "/menus",method = RequestMethod.GET)
	public ResponseBean getInfo(HttpSession session) {
		ResponseBean responseBean = new ResponseBean();
		UserElement userElement = getUserElement(session);
		responseBean = sysMenuService.getMenuList(userElement);
		return responseBean;
	}
}
