• 搜索功能的实现


    if (list.isEmpty()) {

            productSearch.setHistorysearch(productSearch.getMast());
            productSearch.setHotsearch_count(productSearch.getHotsearch_count() + 1);
            if(productSearch.getHotsearch_count()>=3){
                productSearch.setHotsearch(productSearch.getMast());
            }
            list.add(productSearch);
        } else {
            for (int i = 0; i < list.size(); i++) {
                if (list.get(i).getMast().equals(productSearch.getMast())) {
                   // productSearch.setHistorysearch(productSearch.getMast());
                   // productSearch.setHotsearch(productSearch.getMast());
                    list.get(i).setHotsearch_count(list.get(i).getHotsearch_count() + 1);
                    if( list.get(i).getHotsearch_count()>=3){
                        list.get(i).setHotsearch(list.get(i).getMast());
                    }
                     break;
                } else {
                    while (i == list.size() - 1) {
                        productSearch.setHistorysearch(productSearch.getMast());
                        productSearch.setHotsearch_count(productSearch.getHotsearch_count());
                        if(productSearch.getHotsearch_count()>=3){
                            productSearch.setHotsearch(productSearch.getMast());
                        }
                        list.add(productSearch);
                        break;
                    }
                }
            }
        }
        ProductResult productResult = null;
        try {
            productResult = this.productSearch.search(productSearch.getMast(), page, rows);
            System.out.println(productResult);
        } catch (Exception e) {
            e.printStackTrace();
        }
        //把结果传递给页面
        model.addAttribute("query", mast);
        model.addAttribute("totalPages", productResult.getTotalPages());
        model.addAttribute("itemList", productResult.getProductSearchList());
        model.addAttribute("page", page);
        model.addAttribute("query", productResult);
        model.addAttribute("search", list);
        return "result";
    }
  • 相关阅读:
    atitit.TokenService v3 qb1 token服务模块的设计 新特性.docx
    Atitit attilax在自然语言处理领域的成果
    Atitit 图像清晰度 模糊度 检测 识别 评价算法 原理
    Atitit (Sketch Filter)素描滤镜的实现  图像处理  attilax总结
    atitit。企业的价值观 员工第一 vs 客户第一.docx
    Atitit 实现java的linq 以及与stream api的比较
    Atitit dsl exer v3 qb3 新特性
    Atititi tesseract使用总结
    Atitit 修改密码的功能流程设计 attilax总结
    atitit.TokenService v3 qb1  token服务模块的设计 新特性.docx
  • 原文地址:https://www.cnblogs.com/llaq/p/9442535.html
Copyright © 2020-2023  润新知