use of com.zyd.blog.persistence.beans.SysUser in project OneBlog by zhangyd-c.
the class SysUserServiceImpl method listByRoleId.
/**
* 通过角色Id获取用户列表
*
* @param roleId
* @return
*/
@Override
public List<User> listByRoleId(Long roleId) {
List<SysUser> sysUsers = sysUserMapper.listByRoleId(roleId);
if (CollectionUtils.isEmpty(sysUsers)) {
return null;
}
List<User> users = new ArrayList<>();
for (SysUser su : sysUsers) {
su.setUserType(new User(su).getUserTypeDescEnum().toString());
users.add(new User(su));
}
return users;
}
use of com.zyd.blog.persistence.beans.SysUser in project OneBlog by zhangyd-c.
the class SysUserServiceImpl method listAll.
@Override
public List<User> listAll() {
List<SysUser> sysUsers = sysUserMapper.selectAll();
if (CollectionUtils.isEmpty(sysUsers)) {
return null;
}
List<User> users = new ArrayList<>();
for (SysUser sysUser : sysUsers) {
users.add(new User(sysUser));
}
return users;
}
use of com.zyd.blog.persistence.beans.SysUser in project OneBlog by zhangyd-c.
the class SysUserServiceImpl method insertList.
@Override
@Transactional(rollbackFor = Exception.class)
public void insertList(List<User> users) {
Assert.notNull(users, "Users不可为空!");
List<SysUser> sysUsers = new ArrayList<>();
String regIp = IpUtil.getRealIp(RequestHolder.getRequest());
for (User user : users) {
user.setUpdateTime(new Date());
user.setCreateTime(new Date());
user.setRegIp(regIp);
user.setPrivacy(UserPrivacyEnum.PUBLIC.getCode());
user.setNotification(UserNotificationEnum.DETAIL);
sysUsers.add(user.getSysUser());
}
sysUserMapper.insertList(sysUsers);
}
use of com.zyd.blog.persistence.beans.SysUser in project OneBlog by zhangyd-c.
the class SysUserServiceImpl method getByPrimaryKey.
@Override
public User getByPrimaryKey(Long primaryKey) {
Assert.notNull(primaryKey, "PrimaryKey不可为空!");
SysUser sysUser = sysUserMapper.selectByPrimaryKey(primaryKey);
return null == sysUser ? null : new User(sysUser);
}
use of com.zyd.blog.persistence.beans.SysUser in project OneBlog by zhangyd-c.
the class SysUserServiceImpl method getByUuidAndSource.
@Override
public User getByUuidAndSource(String uuid, String source) {
if (StringUtils.isEmpty(uuid) || StringUtils.isEmpty(source)) {
return null;
}
SysUser user = new SysUser();
user.setUuid(uuid);
user.setSource(source);
user = sysUserMapper.selectOne(user);
return null == user ? null : new User(user);
}