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

考勤

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