use of com.github.liuweijw.business.admin.domain.QUserRole in project fw-cloud-framework by liuweijw.
the class UserServiceImpl method updateUserAndRole.
@Override
@Transactional
public boolean updateUserAndRole(UserForm userForm) {
if (null == userForm.getUserId() || userForm.getUserId() <= 0)
return Boolean.FALSE;
User user = userRepository.findUserByUserId(userForm.getUserId());
if (null == user)
return false;
user.setStatu(userForm.getStatu());
user.setUpdateTime(new Date());
user.setUserId(userForm.getUserId());
user.setUsername(userForm.getUsername());
userRepository.save(user);
QUserRole qUserRole = QUserRole.userRole;
this.queryFactory.delete(qUserRole).where(qUserRole.userId.eq(userForm.getUserId())).execute();
UserRole uRole = new UserRole();
uRole.setRoleId(userForm.getRoleId());
uRole.setUserId(userForm.getUserId());
this.userRoleRepository.saveAndFlush(uRole);
return true;
}
use of com.github.liuweijw.business.admin.domain.QUserRole 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;
}
Aggregations