package com.ssm.controller;


import com.ssm.manage.service.SsmSysMenuPowerService;
import com.ssm.manage.service.SsmSysMenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/demay/ssm/menu")
public class SsmSysMenuController {
    @Autowired
    SsmSysMenuService ssmSysMenuService;
    @Autowired
    SsmSysMenuPowerService ssmSysMenuPowerService;

//    @ApiOperation(value = "分页获取菜单信息", httpMethod = "POST", response = PageResponse.class, notes = "分页获取菜单信息")
//    @RequestMapping(value = "/page", method = RequestMethod.POST)
//    public PageResponse<SysMenu> selectByPage(@RequestBody MenuRequest menuRequest) {
//        PageResponse<SysMenu> pageResponse = new PageResponse<>();
//        PageInfo<SysMenu> pageInfo;
//        try {
//            pageInfo = ssmSysMenuService.selectPage(menuRequest);
//        } catch (Exception e) {
//            log.error("SsmSysMenuController.selectPage:", e);
//            pageResponse.setCodeAndMsg(ResponseCode.FAILED);
//            return pageResponse;
//        }
//        pageResponse.setCodeAndMsg(ResponseCode.OK);
//        pageResponse.setPageInfo(pageInfo);
//        return pageResponse;
//    }

//    @ApiOperation(value = "菜单权限列表", httpMethod = "POST", response = GenericResponse.class, notes = "")
//    @RequestMapping(value = "/list", method = RequestMethod.POST)
//    public GenericResponse list(@RequestBody MenuPowerRequest menuPowerRequest) {
//        GenericResponse genericResponse = new GenericResponse();
//
//        List<SysMenuPower> list = new ArrayList<>();
//        try {
//            list = ssmSysMenuPowerService.listMenuPower(menuPowerRequest);
//        } catch (Exception e) {
//            log.error("SsmSysMenuController.list:", e);
//            genericResponse.setCodeAndMsg(ResponseCode.FAILED);
//            return genericResponse;
//        }
//       genericResponse.setData(list);
//        genericResponse.setCodeAndMsg(ResponseCode.OK);
//        return genericResponse;
//    }
//
//
//    @ApiOperation(value = "菜单分配权限", httpMethod = "POST", response = GenericResponse.class, notes = "")
//    @RequestMapping(value = "/addMenuPower", method = RequestMethod.POST)
//    public GenericResponse addMenuPower(@RequestBody MenuPowerRequest menuPowerRequest) {
//        GenericResponse genericResponse = new GenericResponse();
//
//        int i = 0;
//        try {
//            i = ssmSysMenuPowerService.saveMenuPower(menuPowerRequest);
//        } catch (Exception e) {
//            log.error("SsmSysMenuController.addMenuPower:", e);
//            genericResponse.setCodeAndMsg(ResponseCode.FAILED);
//            return genericResponse;
//        }
//        if (i > 0) {
//            genericResponse.setCodeAndMsg(ResponseCode.OK);
//        } else {
//            genericResponse.setCodeAndMsg(ResponseCode.FAILED);
//        }
//        return genericResponse;
//    }


}
