package com.lf.server.controller.data;
|
|
import com.lf.server.entity.data.MenusEntity;
|
import com.lf.server.service.data.MenusService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.List;
|
|
/**
|
* 菜单
|
* @author sws
|
* @date 2022-09-23
|
*/
|
|
@RestController
|
@RequestMapping("/Menu")
|
public class MenusController {
|
@Autowired
|
MenusService menuService;
|
|
@RequestMapping(value = "/insertMenu", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
public Integer insertMenu(MenusEntity menusEntity) {
|
|
return menuService.insertMenu(menusEntity);
|
}
|
|
@RequestMapping(value = "/insertMenus", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
public Integer insertMenus(@RequestBody List<MenusEntity> menusEntity) {
|
|
return menuService.insertMenus(menusEntity);
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/deleteMenu", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
public Integer deleteMenu(int id) {
|
return menuService.deleteMenu(id);
|
}
|
|
|
@RequestMapping(value = "/deleteMenus", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
public Integer deleteMenus(@RequestBody List<Integer> ids) {
|
if (!ids.isEmpty()) {
|
return menuService.deleteMenus(ids);
|
} else {
|
return -1;
|
}
|
}
|
|
@ResponseBody
|
@RequestMapping(value = "/updateMenu", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
public Integer updateMenu(MenusEntity menusEntity) {
|
return menuService.updateMenu(menusEntity);
|
}
|
|
@GetMapping(value = "/selectMenu")
|
public MenusEntity selectMenu(int id) {
|
return menuService.selectMenu(id);
|
}
|
|
@GetMapping(value = "/selectMenuAll")
|
public List<MenusEntity> selectMenuAll() {
|
return menuService.selectMenuAll();
|
}
|
|
}
|