当前位置:网站首页>关于我写的循环遍历
关于我写的循环遍历
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说我博文质量低。
边栏推荐
猜你喜欢
90多款matlab工具箱打包放送
nacos 返回 403 unknown user 太他么坑了 源码解析
Mac安装PHP开发环境
VMD combined with ISSA to optimize LSSVM power prediction
Provide 和 Inject 的用法
YOLOv3详解:从零开始搭建YOLOv3网络
SQL去重的三种方法汇总
Error EPERM operation not permitted, mkdir ‘Dsoftwarenodejsnode_cache_cacach两种解决办法
Network skills: teach you to install batteries on the router, you can still surf the Internet when the power is cut off!
QT 出现多冲定义问题
随机推荐
网络技巧:教你给路由器装上电池,断电照样可以上网!
Faster - RCNN principle and repetition code
QT QOpenGLWidget 全屏导致其他控件显示问题
golang chan
RHCE之路----全
零分贝超静音无线鼠标!数量有限!!先到先得!!!【元旦专享】
数据库知识:SQLServer创建非sa用户笔记
Detailed explanation of DenseNet and Keras reproduction code
SQL存储过程详解
Computer software: recommend a disk space analysis tool - WizTree
MATLAB 的ICEEMDAN分解代码实现
用matlab打造的摩斯电码加解码器音频版,支持包括中文在内的任意字符
53个全球免费学术资源数据库整理,查资料写论文必备【开学必备】
matlab的2DCNN、1DCNN、BP、SVM故障诊断与结果可视化
【音视频开发系列】QT 采集麦克风PCM并播放
this关键字,构造函数
元素的增删克隆以及利用增删来显示数据到页面上
set集合
系统流量预估、架构设计方案
NelSon:一款新的适配matlab编程语法的编程工具