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

考勤

上级 bc4d6936
...@@ -17,10 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -17,10 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/** /**
* @Author gwj * @Author gwj
...@@ -68,15 +65,20 @@ public class TestController { ...@@ -68,15 +65,20 @@ public class TestController {
authorityName.add("角色管理"); authorityName.add("角色管理");
List<Authority> authorities = authorityDao.findAllByNameIn(authorityName); List<Authority> authorities = authorityDao.findAllByNameIn(authorityName);
Role role = roleDao.findByName("管理员"); Optional<Role> optional = roleDao.findById("5e82c9d8e02f2a779aa76993");
List<RoleAuthority> roleAuthorities = new ArrayList<>(); if(optional.isPresent()){
if(authorities!=null){ Role role = optional.get();
authorities.forEach(authority->{ List<RoleAuthority> roleAuthorities = new ArrayList<>();
RoleAuthority roleAuthority = new RoleAuthority(null,role.getId(),authority.getId()); if(authorities!=null){
roleAuthorities.add(roleAuthority); authorities.forEach(authority->{
}); RoleAuthority roleAuthority = new RoleAuthority(null,role.getId(),authority.getId());
roleAuthorities.add(roleAuthority);
});
}
roleAuthorityDao.saveAll(roleAuthorities);
} }
roleAuthorityDao.saveAll(roleAuthorities);
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论