Search in sources :

Example 1 with QRole

use of com.github.liuweijw.business.admin.domain.QRole in project fw-cloud-framework by liuweijw.

the class RoleServiceImpl method getRoleListByDeptId.

@Override
public List<Role> getRoleListByDeptId(Integer deptId) {
    if (null == deptId || deptId <= 0)
        return null;
    // load role
    QRoleDept qRoleDept = QRoleDept.roleDept;
    QRole qRole = QRole.role;
    List<Role> rList = this.queryFactory.select(qRole).from(qRoleDept, qRole).where(qRoleDept.deptId.eq(deptId)).where(qRoleDept.roleId.eq(qRole.roleId)).fetch();
    return rList;
}
Also used : QRole(com.github.liuweijw.business.admin.domain.QRole) Role(com.github.liuweijw.business.admin.domain.Role) QRoleDept(com.github.liuweijw.business.admin.domain.QRoleDept) QRole(com.github.liuweijw.business.admin.domain.QRole)

Example 2 with QRole

use of com.github.liuweijw.business.admin.domain.QRole in project fw-cloud-framework by liuweijw.

the class RoleServiceImpl method findRoleListByDeptId.

@Override
@Cacheable(key = "'role_deptid_' + #deptId")
public List<Role> findRoleListByDeptId(Integer deptId) {
    if (null == deptId || deptId <= 0)
        return null;
    // load role
    QRoleDept qRoleDept = QRoleDept.roleDept;
    QRole qRole = QRole.role;
    List<Role> rList = this.queryFactory.select(qRole).from(qRoleDept, qRole).where(qRoleDept.deptId.eq(deptId)).where(qRoleDept.roleId.eq(qRole.roleId)).fetch();
    return rList;
}
Also used : Role(com.github.liuweijw.business.admin.domain.Role) QRole(com.github.liuweijw.business.admin.domain.QRole) QRoleDept(com.github.liuweijw.business.admin.domain.QRoleDept) QRole(com.github.liuweijw.business.admin.domain.QRole) Cacheable(org.springframework.cache.annotation.Cacheable)

Example 3 with QRole

use of com.github.liuweijw.business.admin.domain.QRole in project fw-cloud-framework by liuweijw.

the class RoleServiceImpl method delById.

@Override
@Transactional
@CacheEvict(allEntries = true)
public boolean delById(Integer roleId) {
    if (null == roleId || roleId <= 0)
        return Boolean.FALSE;
    QRole qRole = QRole.role;
    long num = this.queryFactory.update(qRole).set(qRole.statu, // 0 正常 1删除
    1).where(qRole.roleId.eq(roleId.intValue())).execute();
    return num > 0;
}
Also used : QRole(com.github.liuweijw.business.admin.domain.QRole) CacheEvict(org.springframework.cache.annotation.CacheEvict) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with QRole

use of com.github.liuweijw.business.admin.domain.QRole in project fw-cloud-framework by liuweijw.

the class UserServiceImpl method findRoleListByUserId.

public List<Role> findRoleListByUserId(Integer userId) {
    if (null == userId)
        return null;
    // load role
    QUserRole qUserRole = QUserRole.userRole;
    QRole qRole = QRole.role;
    List<Role> rList = this.queryFactory.select(qRole).from(qUserRole, qRole).where(qUserRole.userId.eq(userId)).where(qUserRole.roleId.eq(qRole.roleId)).fetch();
    return rList;
}
Also used : QUserRole(com.github.liuweijw.business.admin.domain.QUserRole) AuthRole(com.github.liuweijw.system.api.model.AuthRole) Role(com.github.liuweijw.business.admin.domain.Role) QRole(com.github.liuweijw.business.admin.domain.QRole) UserRole(com.github.liuweijw.business.admin.domain.UserRole) QRole(com.github.liuweijw.business.admin.domain.QRole) QUserRole(com.github.liuweijw.business.admin.domain.QUserRole)

Aggregations

QRole (com.github.liuweijw.business.admin.domain.QRole)4 Role (com.github.liuweijw.business.admin.domain.Role)3 QRoleDept (com.github.liuweijw.business.admin.domain.QRoleDept)2 QUserRole (com.github.liuweijw.business.admin.domain.QUserRole)1 UserRole (com.github.liuweijw.business.admin.domain.UserRole)1 AuthRole (com.github.liuweijw.system.api.model.AuthRole)1 CacheEvict (org.springframework.cache.annotation.CacheEvict)1 Cacheable (org.springframework.cache.annotation.Cacheable)1 Transactional (org.springframework.transaction.annotation.Transactional)1