use of com.github.liuweijw.business.admin.domain.QRoleMenuPermission in project fw-cloud-framework by liuweijw.
the class MenuServiceImpl method findMenuPermissions.
@Override
@Cacheable(value = AdminCacheKey.PERMISSION_INFO, key = AdminCacheKey.PERMISSION_INFO_KEY_ROLECODE)
public Set<String> findMenuPermissions(String roleCode) {
Set<String> permissions = new HashSet<>();
// 查询Role
Role role = roleRepository.findRoleByRoleCode(roleCode.trim());
if (null == role)
return permissions;
// 查询菜单
QRoleMenu qRoleMenu = QRoleMenu.roleMenu;
QRoleMenuPermission qRoleMenuPermission = QRoleMenuPermission.roleMenuPermission;
List<RoleMenuPermission> rList = this.queryFactory.select(qRoleMenuPermission).from(qRoleMenuPermission, qRoleMenu).where(qRoleMenu.roleId.eq(role.getRoleId())).where(qRoleMenuPermission.roleMenuId.eq(qRoleMenu.id)).fetch();
if (null == rList || rList.size() == 0)
return permissions;
rList.stream().forEach(r -> {
permissions.add(r.getPermission());
});
return permissions;
}
use of com.github.liuweijw.business.admin.domain.QRoleMenuPermission in project fw-cloud-framework by liuweijw.
the class PermissionServiceImpl method delRoleMenuPermissionByRoleMenuId.
private boolean delRoleMenuPermissionByRoleMenuId(Integer... roleMenuArray) {
QRoleMenuPermission qRoleMenuPermission = QRoleMenuPermission.roleMenuPermission;
long num = this.queryFactory.delete(qRoleMenuPermission).where(qRoleMenuPermission.roleMenuId.in(roleMenuArray)).execute();
return num > 0;
}
use of com.github.liuweijw.business.admin.domain.QRoleMenuPermission in project fw-cloud-framework by liuweijw.
the class PermissionServiceImpl method findMenuPermissionByRoleId.
@Override
@Cacheable(cacheNames = AdminCacheKey.PERMISSION_INFO, key = "'permission_' + #roleId")
public List<RoleMenuPermission> findMenuPermissionByRoleId(Integer roleId) {
if (null == roleId)
return null;
// 查询菜单
QRoleMenu qRoleMenu = QRoleMenu.roleMenu;
QRoleMenuPermission qRoleMenuPermission = QRoleMenuPermission.roleMenuPermission;
List<RoleMenuPermission> rList = this.queryFactory.select(qRoleMenuPermission).from(qRoleMenuPermission, qRoleMenu).where(qRoleMenu.roleId.eq(roleId)).where(qRoleMenuPermission.roleMenuId.eq(qRoleMenu.id)).fetch();
return rList;
}
Aggregations