package com.dk.mdm.controller.core;

import com.dk.common.response.ResponseResultVO;
import com.dk.mdm.model.pojo.core.RoleRight;
import com.dk.common.service.BaseService;
import com.dk.mdm.model.vo.core.RoleRightVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import com.dk.mdm.service.core.RoleRightService;

import java.util.List;
import java.util.Map;

@Api(tags = "角色权限API接口")
@RestController
@RequestMapping("/core/roleRight")
public class RoleRightController{

    public BaseService<RoleRight> getService() {
        return roleRightService;
    }

    @Autowired
    private RoleRightService roleRightService;

    /**
     * @desc   : 获取角色权限
     * @author : 夏常明
     * @date   : 2023/1/13 11:46
     */
    @ApiOperation(
            value = "获取角色权限",
            notes = "获取角色权限"
    )
    @PostMapping("get_role_right")
    public ResponseResultVO<List<Map<String, Object>>> getDefectType(@RequestBody Map<String, Object> param) {
        return roleRightService.getRoleRight(param);
    }

    /**
     * @desc : 新建角色权限
     * @author : 夏常明
     * @date : 2023/1/5 9:39
     */
    @ApiOperation( value = "新建角色权限", notes = "新建角色权限" )
    @PostMapping({"insert"})
    public ResponseResultVO<?> insert(@RequestBody List<RoleRightVO> roleRightVO) {
        return roleRightService.saveRoleRight(roleRightVO);
    }
}
