Newer
Older
huludao / src / main / java / com / newfiber / api / pc / controller / zhz / ButtonsNewController.java
package com.newfiber.api.pc.controller.zhz;

import com.newfiber.api.core.annotation.SysLog;
import com.newfiber.api.core.commons.ResultCode;
import com.newfiber.api.core.commons.ResultObj;
import com.newfiber.api.pc.dto.ButtonDTO;
import com.newfiber.api.pc.model.zhz.Buttons;
import com.newfiber.api.pc.service.impl.ButtonsServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

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

/**
 * @Author:zzh
 * @CreateDate:2020/11/19 15:34
 * @Description:
 */
@RestController
@RequestMapping("/newButtons")
@Api(value = "ButtonsController",tags = "SYS-02、新按钮控制层", position = 102)
public class ButtonsNewController {

    @Autowired
    private ButtonsServiceImpl buttonsService;





    @PostMapping("/add")
    @ApiOperation("新增按钮功能")
    @SysLog(actionType = "1",value = "新增按钮功能")
    public ResultObj  addButtons(@RequestBody ButtonDTO buttonDTO, HttpServletRequest request){
        buttonsService.addButtons(buttonDTO,request);
        return ResultObj.ok();
    }

    @PostMapping("/update")
    @ApiOperation("修改按钮功能")
    @SysLog(actionType = "4",value = "修改按钮功能")
    public ResultObj updateButtons(@RequestBody ButtonDTO buttonDTO){
        buttonsService.updateButtons(buttonDTO);
        return ResultObj.ok();
    }

    @PostMapping("/delete")
    @ApiOperation("删除按钮功能")
    @SysLog(actionType = "2",value = "删除按钮功能")
    public ResultObj deleteButtons(@RequestParam("serial")Integer serial){
        buttonsService.deleteButtons(serial);
        return ResultObj.ok();
    }

    @PostMapping("/queryButtons")
    @ApiOperation("根据菜单编号查询该菜单的所有按钮")
    @SysLog(actionType = "4",value = "根据菜单编号查询该菜单的所有按钮")
    public ResultObj<List<Buttons>> queryButtonsByMenuId(@RequestParam("menuNo")String menuNo){
        return new ResultObj<List<Buttons>>(ResultCode.OK,buttonsService.queryButtonsByMenuId(menuNo));
    }

}