package com.jwipc.sys.controller.pc;

import cn.hutool.core.lang.Pair;
import com.jwipc.sys.dto.RoleResDTO;
import com.jwipc.sys.dto.UserShortcutDTO;
import com.jwipc.sys.logic.ShortcutLogic;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

import static com.jwipc.sys.constant.ModuleConst.MODULE_ROOT;

/**
 * <p> </p>
 *
 * @author ZhangJie
 * @version 1.0
 * @since JDK 1.8
 */
@RequestMapping(MODULE_ROOT + "/shortcut")
@RequiredArgsConstructor
@Controller
public class ShortcutPageController {
    private final ShortcutLogic shortcutLogic;

    @GetMapping("config")
    public String config(Model model) {
        Pair<List<RoleResDTO>, List<UserShortcutDTO>> result = shortcutLogic.getUserRes();
        model.addAttribute("roleResDtoList", result.getKey());
        model.addAttribute("userShortcutDtoList", result.getValue());
        return MODULE_ROOT + "/shortcut/config";

    }
}
