Commit e9e3cb73 by yuwei

项目初始化

parent b0068098
......@@ -35,7 +35,7 @@ public class DataUserDetailService implements UserDetailsService {
//远程获取用户
R result = userServiceFeign.loginByUsername(s);
log.info(JSON.toJSONString(result));
if(result == null || ObjectUtil.isEmpty(result.getData())){
if(result == null || !result.isSuccess() || ObjectUtil.isEmpty(result.getData())){
throw new UsernameNotFoundException(StrUtil.format("{}用户不存在", s));
}
UserInfo userInfo = JSON.parseObject(JSON.toJSONString(result.getData()), UserInfo.class);
......
......@@ -57,7 +57,7 @@ public class RedisConfig extends CachingConfigurerSupport {
//不缓存null值
.disableCachingNullValues()
//默认缓存过期时间
.entryTtl(Duration.ofSeconds(60));
.entryTtl(Duration.ofMinutes(30));
//设置一个初始化的缓存名称set集合
Set<String> cacheNames = new HashSet<>();
......
......@@ -53,15 +53,15 @@ public class UserDto implements Serializable {
@ApiModelProperty(value = "部门")
@NotEmpty(message = "部门不能为空", groups = {ValidateGroupForSave.class, ValidateGroupForUpdate.class})
@Size(min = 1, max = 1, message="部门长度必须位于{min}-{max}之间")
private List<String> depts;
private List<String> deptList;
@ApiModelProperty(value = "角色")
@NotEmpty(message = "角色不能为空", groups = {ValidateGroupForSave.class, ValidateGroupForUpdate.class})
@Size(min = 1, max = 5, message="角色长度必须位于{min}-{max}之间")
private List<String> roles;
private List<String> roleList;
@ApiModelProperty(value = "岗位")
@NotEmpty(message = "岗位不能为空", groups = {ValidateGroupForSave.class, ValidateGroupForUpdate.class})
@Size(min = 1, max = 1, message="岗位长度必须位于{min}-{max}之间")
private List<String> posts;
private List<String> postList;
}
......@@ -63,9 +63,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
String passwordEncode = new BCryptPasswordEncoder().encode(user.getPassword());
user.setPassword(passwordEncode);
userDao.insert(user);
insertBatchRole(userDto.getRoles(), user.getId());
insertBatchDept(userDto.getDepts(), user.getId());
insertBatchPost(userDto.getPosts(), user.getId());
insertBatchRole(userDto.getRoleList(), user.getId());
insertBatchDept(userDto.getDeptList(), user.getId());
insertBatchPost(userDto.getPostList(), user.getId());
}
private void insertBatchPost(List<String> posts, String userId) {
......@@ -108,13 +108,13 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
userDao.updateById(user);
userRoleDao.delete(Wrappers.<UserRoleEntity>lambdaQuery()
.eq(UserRoleEntity::getUserId, user.getId()));
insertBatchRole(userDto.getRoles(), user.getId());
insertBatchRole(userDto.getRoleList(), user.getId());
userDeptDao.delete(Wrappers.<UserDeptEntity>lambdaQuery()
.eq(UserDeptEntity::getUserId, user.getId()));
insertBatchDept(userDto.getDepts(), user.getId());
insertBatchDept(userDto.getDeptList(), user.getId());
userPostDao.delete(Wrappers.<UserPostEntity>lambdaQuery()
.eq(UserPostEntity::getUserId, user.getId()));
insertBatchPost(userDto.getPosts(), user.getId());
insertBatchPost(userDto.getPostList(), user.getId());
}
@Override
......
......@@ -54,7 +54,7 @@
<property name="alias" value="r"/>
</include>
from sys_role r
left join sys_user_role ur on d.id = ur.role_id
left join sys_user_role ur on r.id = ur.role_id
where 1 = 1 and r.status = 1
<if test="null != userId and '' != userId">
and ur.user_id = #{userId}
......@@ -67,7 +67,7 @@
<property name="alias" value="p"/>
</include>
from sys_post p
left join sys_user_post up on d.id = up.post_id
left join sys_user_post up on p.id = up.post_id
where 1 = 1 and p.status = 1
<if test="null != userId and '' != userId">
and up.user_id = #{userId}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment