package com.dk.mdm.controller.mst;

import com.dk.common.response.ResponseResultVO;
import com.dk.mdm.model.pojo.mst.RoleFun;
import com.dk.common.service.BaseService;
import com.dk.mdm.model.vo.mst.RoleVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.Api;
import com.dk.mdm.service.mst.RoleFunService;

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

@Api(tags = "角色权限API接口")
@RestController
@RequestMapping("/mst/roleFun")
public class RoleFunController {

    public BaseService<RoleFun> getService() {
        return roleFunService;
    }

    @Autowired
    private RoleFunService roleFunService;

    /**
     * @desc : 获取角色权限
     * @author : 于继渤
     * @date : 2024/2/26 10:36
     */
    @ApiOperation(
            value = "获取角色权限",
            notes = "获取角色权限"
    )
    @PostMapping("get_role_fun")
    public ResponseResultVO<Map<String, Object>> getRoleFun(@RequestBody Map<String, Object> param) {
        return roleFunService.getRoleFun(param);
    }

    /**
     * @desc : 新建角色权限
     * @author : 于继渤
     * @date : 2023/1/5 9:39
     */
    @ApiOperation(value = "新建角色(权限)", notes = "新建角色权限")
    @PostMapping({"insert_batch"})
    public ResponseResultVO<?> insertBatch(@RequestBody List<RoleFun> roleFun) {
        return roleFunService.saveRoleFun(roleFun);
    }


    /**
     * @desc : 批量修改功能权限
     * @author : 于继渤
     * @date : 2023/1/5 9:39
     */
    @ApiOperation(value = "批量修改功能权限", notes = "批量修改功能权限")
    @PostMapping({"update_batch"})
    public ResponseResultVO<?> updateBatch(@RequestBody RoleVo roleVo) {
        return roleFunService.updateBatch(roleVo);
    }
}
