当前位置:网站首页>关于我写的循环遍历
关于我写的循环遍历
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说我博文质量低。
边栏推荐
猜你喜欢

电脑知识:台式电脑应该选择品牌和组装,值得收藏

电脑软件:推荐一款磁盘空间分析工具——WizTree

科研绘图图表类型种类繁多,本文告诉你如何选择!

零分贝超静音无线鼠标!数量有限!!先到先得!!!【元旦专享】

舍不得花钱买1stOpt,不妨试试这款免费的拟合优化神器【openLU】

RuntimeError: You called this URL via POST, but the URL doesn‘t end in a slash and you have APPEND_S

Sql优化总结!详细!(2021最新面试必问)

Database document generation tool V1.0

matlab让我的旧手机起死回生

Database Skills: Organize SQL Server's Very Practical Scripts
随机推荐
软件:给大家推荐一款国产非常好用的效率软件uTools
缓存穿透、击穿、雪崩
用matlab打造的摩斯电码加解码器音频版,支持包括中文在内的任意字符
MAML原理讲解和代码实现
golang rtsp拉流测试
U-Net详解:为什么它适合做医学图像分割?(基于tf-Kersa复现代码)
Different lower_case_table_names settings for server (‘1‘) and data dictionary (‘0‘) 解决方案
事件链原理,事件代理,页面的渲染流程,防抖和节流,懒加载和预加载
MySQL错误-this is incompatible with sql_mode=only_full_group_by完美解决方案
golang chan
硬件知识:RTMP和RTSP传统流媒体协议介绍
狗都能看懂的Pytorch MAML代码详解
MATLAB 的ICEEMDAN分解代码实现
IDEA中创建编写JSP
Error occurred while trying to proxy request项目突然起不来了
ThreadLocal内存泄漏问题讲解
如何用matlab做高精度计算?【第二辑】
无监督特征对齐的迁移学习理论框架
格拉姆角场GAF将时序数据转换为图像并应用于故障诊断
Based on the EEMD + + MLR GRU helped time series prediction