package io.renren.modules.business.controller;

import io.renren.common.utils.R;
import io.renren.modules.sys.service.SysRoleService;
import io.renren.modules.sys.service.SysUserService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author lsr
 * 权限控制controller
 * @version 2022/10/27
 */
@RestController
@RequestMapping("business/businesspermissions")
public class BusinessPermissionsController {

    @Autowired
    private SysUserService sysUserService;

    @Autowired
    private SysRoleService sysRoleService;

    /**
     * 获取所有用户的信息
     */
    @RequestMapping("/sysList")
    @RequiresPermissions("business:businesspermissions:list")
    public R list(@RequestParam Map<String, Object> params){
        Map<String, Object> page = sysUserService.queryUserList(params);
        return R.ok().put("page", page);
    }

    /**
     * 保存角色权限
     */
    @RequestMapping("/update")
    public R qxSave(@RequestParam Map<String, Object> params){
        sysRoleService.qxSave(params);
        return R.ok();
    }
}
