package cn.reghao.autodop.dmaster.rbac.db.query;

import cn.reghao.autodop.dmaster.rbac.model.po.UserAuthority;
import cn.reghao.autodop.dmaster.rbac.model.po.Role;
import cn.reghao.autodop.dmaster.rbac.model.po.User;
import cn.reghao.autodop.dmaster.rbac.model.vo.RoleVO;
import cn.reghao.jdkutil.db.BaseQuery;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification;

import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.SetJoin;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * @author reghao
 * @date 2021-07-12 15:32:26
 */
public interface RoleQuery extends BaseQuery<Role> {
    Role findByTitle(String title);
    Page<RoleVO> getRoleVOByPage(PageRequest pageRequest);
    List<RoleVO> getByMatchName(String name);
    RoleVO getRoleVOById(Integer id);
    /**
     * 获取拥有角色的用户
     *
     * @param
     * @return
     * @date 2021-07-14 下午2:57
     */
    List<User> getUsersByRoleId(Integer id);
    List<User> getUsersByRole(Role role);
}
