提交 581aef2d authored 作者: gongwenjie's avatar gongwenjie

代码修改

上级 3eda8808
......@@ -398,10 +398,9 @@ public class UserServiceImpl implements IUserService {
User root = pasUserDao.findByUsername("root");
List<UserRole> userRoles = userRoleDao.findAllByUserId(root.getId());
Role role = roleDao.findAllByName("管理员");
if(userRoles==null||userRoles.size()==0){
UserRole userRole = new UserRole(null,root.getId(),role.getId());
userRoleDao.save(userRole);
}
userRoleDao.deleteAllByUserId(root.getId());
UserRole userRole = new UserRole(null,root.getId(),role.getId());
userRoleDao.save(userRole);
List<String> auname = new ArrayList<>();
auname.add("用户管理");
......@@ -411,6 +410,15 @@ public class UserServiceImpl implements IUserService {
auname.add("部门管理");
List<RoleAuthority> roleAuthoritieList = new ArrayList<>();
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());
if(roleAuthorities==null||roleAuthorities.size()==0){
for (Authority authority : authorities) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论