当前位置:网站首页>关于我写的循环遍历
关于我写的循环遍历
2022-08-04 05:39:00 【雾喔】
先上代码
@Override
public Response queryDownStarName(String staName) {
Map<String,List>map=new HashMap<>();
Standard staOne=standardRepository.queryDownStarName(staName);
if(staOne != null) {
List<Standard> list = new LinkedList<>();
list.add(staOne);
map.put("1", list);
int num = 1;
Integer id = staOne.getStaId();
List<Standard> standardList = standardRepository.queryByFatherID(id);
if (!standardList.isEmpty()) {
num++;
map.put("" + num, standardList);
}
while (!standardList.isEmpty()) {
List<Integer> integerList = new LinkedList<>();
for (int i = 0; i < standardList.size(); i++) {
Standard standard = standardList.get(i);
int sId = standard.getStaId();
integerList.add(sId);
}
if (!integerList.isEmpty()) {
List<Standard> standardList1 = new LinkedList<>();
for (int i = 0; i < integerList.size(); i++) {
int sId = integerList.get(i);
List<Standard> standardList3 = standardRepository.queryByFatherID(sId);
if (!standardList3.isEmpty()) {
for (int a = 0; a < standardList3.size(); a++) {
Standard standard = standardList3.get(a);
standardList1.add(standard);
}
}
}
num++;
map.put("" + num, standardList1);
standardList = standardList1;
} else {
standardList = null;
}
}
return Response.ok(map);
}else{
return Response.error("不存在此学分类型!");
}
}
这个是
主要遍历这样的数据。
这个是service层,调用的dao层的方法可以望名生义。
个人总结:
最近很忙,整天出去跑,在这个过程中收获了一个新皮肤,》〉精致黑皮〈《。
最近几天天气贼拉热,ljcsdn说我博文质量低。
边栏推荐
猜你喜欢
mysql基础(4)
Based on the EEMD + + MLR GRU helped time series prediction
RuntimeError: You called this URL via POST, but the URL doesn‘t end in a slash and you have APPEND_S
CMDB 腾讯云部分实现
花了近70美元入手的学生版MATLAB体验到底如何?
Provide 和 Inject 的用法
【C# - 爬虫】使用Selenium实现爬虫,获取近七天天气信息(包含完整代码)
Error ER_NOT_SUPPORTED_AUTH_MODE Client does not support authentication protocol requested by serv
VMD combined with ISSA to optimize LSSVM power prediction
matlab让我的旧手机起死回生
随机推荐
JVM工具之 JPS
golang rtsp拉流测试
网络技巧:教你给路由器装上电池,断电照样可以上网!
QT 显示窗口到最前面(非置顶)
Database knowledge: SQLServer creates non-sa user notes
Software: Recommend a domestic and very easy-to-use efficiency software uTools to everyone
缓动动画,有关窗口的一些常见操作,BOM操作
元素的增删克隆以及利用增删来显示数据到页面上
核心价值观编码器【matlab版】
2DCNN, 1DCNN, BP, SVM fault diagnosis and result visualization of matlab
Error EPERM operation not permitted, mkdir ‘Dsoftwarenodejsnode_cache_cacach两种解决办法
ffmpeg打开rtsp流应该设置的几个参数
NelSon:一款新的适配matlab编程语法的编程工具
舍不得花钱买1stOpt,不妨试试这款免费的拟合优化神器【openLU】
MySQL面试题大全(陆续更新)
秒杀系统设计
基于时序模式注意力机制(TPA)的长短时记忆(LSTM)网络TPA-LSTM的多变量输入风电功率预测
狗都能看懂的CenterNet讲解及代码复现
格拉姆角场GAF将时序数据转换为图像并应用于故障诊断
数据库:整理四个实用的SQLServer脚本函数