• 首页 多级展示


    代码:

    public String home(Model model,BulletinDTO bulletin,AdvertisingDTO Advertising){
    //查询公告
    List<BulletinDTO> result = bulletinExportService.queryListBulletinOrder();
    //查询轮播图
    List<Advertising> adt = advertisingService.queryAllAdvertising();
    //查询菜单
    JSONArray jsary=new JSONArray();
    List<ContractTypeDTO> contractTypeList = contractTypeExportService.queryListContractTypes(new ContractTypeDTO()).getResult().getRows();
    for (int i = 0; i <contractTypeList.size(); i++) {
    ContractTypeDTO contracttype=contractTypeList.get(i);
    JSONObject jsobj=new JSONObject();
    jsobj.put("id", contracttype.getContractTypeId());
    jsobj.put("typename", contracttype.getContractTypeName());
    JSONArray jsarytemplate=new JSONArray();
    ContractTemplateDTO contractTemplateDTO = new ContractTemplateDTO();
    contractTemplateDTO.setConNo(contracttype.getContractTypeId());
    //模板二级
    List<ContractTemplateDTO> contractTemplateList = contractTemplateExportService.queryListContractTemplates(contractTemplateDTO).getResult().getRows();
    for (int j = 0; j < contractTemplateList.size(); j++) {
    ContractTemplateDTO template=contractTemplateList.get(j);
    JSONObject jsobj2=new JSONObject();
    jsobj2.put("temId", template.getTemplateId());
    jsobj2.put("temName", template.getTemplateName());
    Long templateId = contractTemplateList.get(j).getTemplateId();
    ApplicationDTO application = new ApplicationDTO();
    if(templateId!=null&&templateId!=0) application.setTemplateId(templateId);
    List<ApplicationDTO> applicationgList = applicationExportService.queryListApplicationg(application).getResult().getRows();
    List<ApplicationDTO> aList = new ArrayList<ApplicationDTO>();
    //查询3级大类
    for (int x = 0; x < applicationgList.size(); x++) {
    if(applicationgList.get(x).getLavelId()==0){
    ApplicationDTO at = new ApplicationDTO();
    at.setApplicationId(applicationgList.get(x).getApplicationId());
    at.setTypeName(applicationgList.get(x).getTypeName());
    aList.add(at);
    }
    }
    //第三极节点
    JSONArray jsary3=new JSONArray();
    for (int f= 0; f < aList.size(); f++) {
    JSONObject jsobj3=new JSONObject();
    jsobj3.put("applicationId", aList.get(f).getApplicationId());
    jsobj3.put("applicationTypeName", aList.get(f).getTypeName());
    //第四级节点
    JSONArray jsary4=new JSONArray();
    for (int k = 0; k < applicationgList.size(); k++) {
    if(aList.get(f).getApplicationId()==applicationgList.get(k).getParentId()){
    JSONObject jsobj4=new JSONObject();
    jsobj4.put("appId", applicationgList.get(k).getApplicationId());
    jsobj4.put("appName", applicationgList.get(k).getTypeName());
    jsary4.add(jsobj4);
    }
    }
    jsobj3.put("cList", jsary4);
    jsary3.add(jsobj3);
    }
    jsobj2.put("aplist", jsary3);
    jsarytemplate.add(jsobj2);
    }
    jsobj.put("templateList",jsarytemplate);
    jsary.add(jsobj);
    }
    model.addAttribute("jsary",jsary);
    model.addAttribute("bulletin",result);
    model.addAttribute("advertising", adt);
    return "/index";
    }

    html部分

    <!--nav_list start-->
    <div class="nav_list">
    <b class="bg_nav"></b>
    <ul class="nav_list_ul">
    <li>
    <a href="javascript;:">
    <i class="i08"></i>
    全部合同分类
    </a>
    </li>
    #foreach($contractType in $jsary)
    <li>
    <a href="javascript;:">
    <i class="i0$velocityCount"></i> $!contractType.typename
    </a>
    <!--nav_second start-->
    <div class="nav_second">
    <ol class="nav_second_ol">
    <li>
    <a href="javascript:;" class="nav_second_ol_title po_re"><i
    class="unfold_icon"></i>滴滴标准模版起草
    </a>
    #foreach($template in $contractType.templateList)
    <div class="nav_second_ol_div hide">
    <div class="nav_second_title">
    <a href="$path/contract/enterContract?contractType=$!contractType.id&templateId=$!template.temId">$!template.temName<i class="arrow_i"></i></a>
    <div class="three_level_list">
    <img src="$basePath/images/left_arrow_icon.png" class="left_arrow_img">
    <span>此模板适用于以下品类</span>
    #foreach($apption in $!template.aplist)
    <span>$!apption.applicationTypeName</span>
    <div class="clearfix">
    #foreach($cl in $!apption.cList)
    <a href="javascript:;">$!cl.appName<i class="line_i"></i></a>
    #end
    </div>
    #end
    </div><!--three_level_list end-->
    </div><!--nav_second_title end-->
    </div><!--nav_second_ol_div end-->
    #end
    </li>
    <li>
    <a href="javascript:;" class="nav_second_ol_title po_re"><i
    class="unfold_icon"></i>使用对方模版起草
    </a>
    <div class="nav_second_ol_div hide">
    <div style="margin-left: 50px;">
    <a href="">使用对方模版</a>
    </div>
    </div>
    </li>
    </ol>
    </div><!--nav_second end-->
    #if( $!contractType.typename!="采购类") <div class="nav_second"> <a style="padding-left:60px;" href="$modelUrl">敬请期待</a></div>#end
    </li>
    #end
    <!-- <li class="more_li"><a href="javascript:;">更多<b class="arrow_down"></b></a></li> -->
    </ul><!--nav_list_ul end-->
    </div><!--nav_list end-->

  • 相关阅读:
    个人冲刺计划一周天详细
    软件小创意
    电梯调度小程序。
    敏捷开发一些百科。
    求二维数组的子数组中的最大值!
    求整数数组中子数组最大的和值!
    单元测试我们应该注意什么!
    分析一个文档(英语文章)中各个词出现的频率,并打印频率最高的前10个。
    有感而发
    冲刺一TD美景美图
  • 原文地址:https://www.cnblogs.com/whb11/p/6126320.html
Copyright © 2020-2023  润新知