package com.gree.mall.manager.controller.admin;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gree.mall.manager.bean.admin.AdminModuleBean;
import com.gree.mall.manager.bean.admin.AdminModuleVO;
import com.gree.mall.manager.helper.ResponseHelper;
import com.gree.mall.manager.logic.admin.AdminModuleLogic;
import com.gree.mall.manager.plus.entity.AdminModule;
import com.gree.mall.manager.plus.entity.AdminRole;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@Api(value = "系统菜单管理", tags ={"系统菜单管理"} )
@RequestMapping(value = "/admin/module", produces = "application/json; charset=utf-8")
public class AdminModuleController {

    @Autowired
    AdminModuleLogic adminModuleLogic;

    @GetMapping("/detail")
    @ApiOperation("详情")
    public ResponseHelper<AdminModuleVO> detail(@RequestParam String moduleId){
        AdminModuleVO detail = adminModuleLogic.detail(moduleId);
        return ResponseHelper.success(detail);
    }

    @PostMapping("/add")
    @ApiOperation("新增")
    public ResponseHelper add(@RequestBody AdminModuleBean adminModule){
        adminModuleLogic.add(adminModule);
        return ResponseHelper.success();
    }


    @PostMapping("/update")
    @ApiOperation("修改")
    public ResponseHelper update(@RequestBody AdminModule adminModule){
        adminModuleLogic.update(adminModule);
        return ResponseHelper.success();
    }

    @PostMapping("/delete")
    @ApiOperation("删除")
    public ResponseHelper delete(@RequestParam String id){
        adminModuleLogic.delete(id);
        return ResponseHelper.success();
    }



}
