package com.huimv.admin.controller.primary;

import com.huimv.admin.domain.primary.SysMenuEntity;
import com.huimv.admin.service.primary.IMenuService;
import com.huimv.admin.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/menu")
public class MenuController {
    @Autowired
    private IMenuService menuService;

    @RequestMapping("/add")
    public Result addMenu(SysMenuEntity menu){
        return menuService.addMenu(menu);
    }


    @RequestMapping("/edit")
    public Result editMenu( SysMenuEntity menu){
        return menuService.editMenu(menu);
    }


    @RequestMapping("/remove")
    public Result removeMenu(@RequestParam(name = "menuId") Integer menuId){
        return menuService.removeMenu(menuId);
    }

   /* @RequestMapping("/list")
    public List<Map> listMenu() {
        return menuService.listMenu();
    }*/

    @PostMapping("/list")
    public Result optimizeList() {
        return menuService.optimizeList();
    }
}
