提交 f47088e5 authored 作者: gongwenjie's avatar gongwenjie

合并分支 'gwj' 到 'master'

Gwj 查看合并请求 !58
流水线 #79 已失败 于阶段
...@@ -398,10 +398,9 @@ public class UserServiceImpl implements IUserService { ...@@ -398,10 +398,9 @@ public class UserServiceImpl implements IUserService {
User root = pasUserDao.findByUsername("root"); User root = pasUserDao.findByUsername("root");
List<UserRole> userRoles = userRoleDao.findAllByUserId(root.getId()); List<UserRole> userRoles = userRoleDao.findAllByUserId(root.getId());
Role role = roleDao.findAllByName("管理员"); Role role = roleDao.findAllByName("管理员");
if(userRoles==null||userRoles.size()==0){ userRoleDao.deleteAllByUserId(root.getId());
UserRole userRole = new UserRole(null,root.getId(),role.getId()); UserRole userRole = new UserRole(null,root.getId(),role.getId());
userRoleDao.save(userRole); userRoleDao.save(userRole);
}
List<String> auname = new ArrayList<>(); List<String> auname = new ArrayList<>();
auname.add("用户管理"); auname.add("用户管理");
...@@ -411,6 +410,15 @@ public class UserServiceImpl implements IUserService { ...@@ -411,6 +410,15 @@ public class UserServiceImpl implements IUserService {
auname.add("部门管理"); auname.add("部门管理");
List<RoleAuthority> roleAuthoritieList = new ArrayList<>(); List<RoleAuthority> roleAuthoritieList = new ArrayList<>();
List<Authority> authorities = authorityDao.findAllByNameIn(auname); List<Authority> authorities = authorityDao.findAllByNameIn(auname);
if(authorities==null||authorities.size()==0){
List<Authority> authorityList = new ArrayList<>();
authorityList.add(new Authority(null,"用户管理","用户管理"));
authorityList.add(new Authority(null,"权限管理","权限管理"));
authorityList.add(new Authority(null,"角色管理","角色管理"));
authorityList.add(new Authority(null,"考勤管理","考勤管理"));
authorityList.add(new Authority(null,"部门管理","部门管理"));
authorities = authorityDao.saveAll(authorityList);
}
List<RoleAuthority> roleAuthorities = roleAuthorityDao.findAllByRoleId(role.getId()); List<RoleAuthority> roleAuthorities = roleAuthorityDao.findAllByRoleId(role.getId());
if(roleAuthorities==null||roleAuthorities.size()==0){ if(roleAuthorities==null||roleAuthorities.size()==0){
for (Authority authority : authorities) { for (Authority authority : authorities) {
...@@ -418,7 +426,7 @@ public class UserServiceImpl implements IUserService { ...@@ -418,7 +426,7 @@ public class UserServiceImpl implements IUserService {
} }
roleAuthorityDao.saveAll(roleAuthoritieList); roleAuthorityDao.saveAll(roleAuthoritieList);
} }
return null; return authorities;
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论