package com.hai.service;

import com.github.pagehelper.PageInfo;
import com.hai.entity.SecPermission;
import com.hai.model.CommonTreeModel;
import com.hai.model.MenuTreeModel;

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

/**
 * @ClassName SecPermissionService
 * @Description 权限管理
 * @Author 杜江
 * @Date 2020/7/23 14:13
 * @Version 1.0
 */
public interface SecPermissionService {

    /**
     *
     * @Title: findMenuByUserId
     * @Description: 根据用户id查询拥有的菜单树
     * @author: 杜江
     * @Date: 2020/7/23 15:05
     * @param: [userId]
     * @return: java.util.List<com.shinwoten.train.model.MenuTreeModel>
     * @throws
     */
    List<MenuTreeModel> findMenuByUserId(Long userId);

    /**
     *
     * @Title: findBtnByUserId
     * @Description: 查询用户拥有的按钮权限
     * @author: 杜江
     * @Date: 2020/7/23 15:12
     * @param: [userId]
     * @return: java.util.List<com.shinwoten.train.entity.SecPermission>
     * @throws
     */
    List<SecPermission> findBtnByUserId(Long userId);

    /**
     *
     * @Title: findPermissionByUserId
     * @Description: 查询用户拥有的所有权限
     * @author: 杜江
     * @Date: 2020/7/23 15:13
     * @param: [userId]
     * @return: java.util.List<com.shinwoten.train.entity.SecPermission>
     * @throws
     */
    List<SecPermission> findPermissionByUserId(Long userId);

    /**
     *
     * @Title: findByMenuId
     * @Description: 查询菜单对应权限
     * @author: 杜江
     * @Date: 2020/7/7 9:34
     * @param: [menuId]
     * @return: com.shinwoten.plat.entity.SecPermission
     * @throws
     */
    SecPermission findByMenuId(Long menuId);


    /**
     *
     * @Title: findAllMenuTree
     * @Description: 查询所有菜单树
     * @author: 杜江
     * @Date: 2020/7/7 10:51
     * @param: [allotRoleId]
     * @return: java.util.List<com.shinwoten.plat.model.CommonTreeModel>
     * @throws
     */
    List<CommonTreeModel> findAllMenuTree(Long allotRoleId);

    /**
     *
     * @Title: findMenuTreeByRoleId
     * @Description: 根据主角色id查询主角色权限菜单树
     * @author: 杜江
     * @Date: 2020/7/7 10:57
     * @param: [roleId, allotRoleId]
     * @return: java.util.List<com.shinwoten.plat.model.CommonTreeModel>
     * @throws
     */
    List<CommonTreeModel> findMenuTreeByRoleId(Long roleId, Long allotRoleId);

    /**
     *
     * @Title: getAllMenuTree
     * @Description: 查询所有菜单树
     * @author: 杜江
     * @Date: 2020/7/7 11:00
     * @param: [showOnMobile]
     * @return: java.util.List<com.shinwoten.plat.model.CommonTreeModel>
     * @throws
     */
    List<CommonTreeModel> getAllMenuTree(Integer showOnMobile);

    /**
     *
     * @Title: findPage
     * @Description: 分页查询权限
     * @author: 杜江
     * @Date: 2020/7/7 14:20
     * @param: [permissionName, type, pageNum, pageSize]
     * @return: com.github.pagehelper.PageInfo<com.shinwoten.plat.entity.SecPermission>
     * @throws
     */
    PageInfo<SecPermission> findPage(String permissionName, Integer type, Integer pageNum, Integer pageSize);

    /**
     *
     * @Title: getPermissions
     * @Description: 获取所有权限
     * @author: 杜江
     * @Date: 2020/7/7 14:23
     * @param: []
     * @return: java.util.List<com.shinwoten.plat.entity.SecPermission>
     * @throws
     */
    List<SecPermission> getPermissions();

    /**
     *
     * @Title: getNoPermissionsByRoleId
     * @Description: 获取未分配权限
     * @author: 杜江
     * @Date: 2020/7/7 14:24
     * @param: [roleId]
     * @return: java.util.List<com.shinwoten.plat.entity.SecPermission>
     * @throws
     */
    List<SecPermission> getNoPermissionsByRoleId(Long roleId);

    /**
     *
     * @Title: getPermissionsByRoleId
     * @Description: 获取已分配权限
     * @author: 杜江
     * @Date: 2020/7/7 14:25
     * @param: [roleId]
     * @return: java.util.List<com.shinwoten.plat.entity.SecPermission>
     * @throws
     */
    List<SecPermission> getPermissionsByRoleId(Long roleId);

    /**
     *
     * @Title: findPmsIds
     * @Description: 根据菜单查询权限
     * @author: 杜江
     * @Date: 2020/7/7 14:26
     * @param: [menus]
     * @return: java.util.List<java.lang.Long>
     * @throws
     */
    List<Long> findPmsIds(List<Long> menus);

    /**
     *
     * @Title: assignPmsToRole
     * @Description: 给角色分配权限
     * @author: 杜江
     * @Date: 2020/7/7 14:27
     * @param: [roleId, pmsIds]
     * @return: void
     * @throws
     */
    void assignPmsToRole(Long roleId, List<Long> pmsIds);

    /**
     *
     * @Title: deleteRolePms
     * @Description: 删除角色所有权限
     * @author: 杜江
     * @Date: 2020/7/7 14:29
     * @param: [roleId]
     * @return: void
     * @throws
     */
    void deleteRolePms(Long roleId);

    /**
     *
     * @Title: assignTemplatePmsToRole
     * @Description: 给角色模板分配权限
     * @author: 杜江
     * @Date: 2020/7/7 14:34
     * @param: [roleId, newRolePermissionRelIds]
     * @return: void
     * @throws
     */
    void assignTemplatePmsToRole(Long roleId, List<Long> newRolePermissionRelIds);

    /**
     *
     * @Title: deleteRolePmsByRoleAndPms
     * @Description: 从新的权限中筛选出删除的权限
     * @author: 杜江
     * @Date: 2020/7/7 14:35
     * @param: [roleId, pmsId]
     * @return: java.lang.Integer
     * @throws
     */
    Integer deleteRolePmsByRoleAndPms(Long roleId, Long pmsId);

    /**
     *
     * @Title: deleteTemplatePermission
     * @Description: 删除角色 【模板】 权限
     * @author: 杜江
     * @Date: 2020/7/7 14:37
     * @param: [map]
     * @return: void
     * @throws
     */
    void deleteTemplatePermission(Map<String, String> map);
}
