package com.boman.domain.dto;


import java.util.List;

/**
 * @author shiqian
 * @date 2021年05月06日 17:25
 **/
public class RoleMenuDto {

    private Long menuId;
    private Long roleId;
    /** A M D..... **/
    private List<String> head;

    /**
     * 功能描述: 返回A M D......
     *
     * @param perms perms
     * @return java.lang.String
     */
    public static String getBtnFromPerms(String perms) {
        // sys_user:A
        String[] split = perms.split(":");
        if (split.length == 0) {
            throw new IllegalArgumentException("menu对应的perms未配置");
        }
        // A
        return split[1];
    }

    /**
     * 功能描述: 返回tableName, menu表中有sys_table_name
     *
     * @param perms perms
     * @return java.lang.String
     */
    @Deprecated
    public static String getTableNameFromPerms(String perms) {
        // sys_user:A
        String[] split = perms.split(":");
        assert split.length == 2;
        // sys_user
        return split[0];
    }

    public Long getMenuId() {
        return menuId;
    }

    public void setMenuId(Long menuId) {
        this.menuId = menuId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public List<String> getHead() {
        return head;
    }

    public void setHead(List<String> head) {
        this.head = head;
    }
}
