好农易网站知识总结

news/2024/5/18 18:24:12/文章来源:https://blog.csdn.net/weixin_34289454/article/details/92274908

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

1.index.heml页面

<div th:class="${typeInfo.css}" ><i class="yh"><span th:text="${typeInfo.count}">1F</span></i><span class="h4 yh" th:text="${typeInfo.commodityTypeName}">粮食</span><!-- 利用i循环进行1F到8F的循环 --><a th:href="@{initGoods(commodityTypeId=${typeInfo.commodityTypeId})}">更多商品>></a><!-- 点击更多商品开始检索商品列表中的一类商品的全部 -->
</div>
<ul class="goodsList cf"><li class="col-md-2 col-sm-4 col-xs-6" th:each="goodsInfo,status:${typeInfo.list}" ><div class="cont"><a th:href="@{initGoodsDetail(commodityId=${goodsInfo.commodityId})}"><img th:src="@{showImage(pictureId=${goodsInfo.pictureId})}" alt="" style="height:168px;width:168px;" /></a><h4 class="h5"><a href="#"><p class="title" th:text="${goodsInfo.commodityName}">品美知糖道阿胶姜汤260g</p></a></h4><p class="num">库存:<span th:text="${goodsInfo.stock}">15</span>每<span th:text="${#strings.concat(goodsInfo.unit).concat(goodsInfo.specifications)}">袋15kg</span></p><p class="cf"><span class="price yh">¥<span th:text="${goodsInfo.retailPrice}">15</span>元</span><a th:href="@{addCart}" class="btnBuy" title="加入购物车"></a></p></div></li>
</ul>

按照商品类型对商品进行分类检索并显示

2.商品列表按人气和价格的升序降序排列的功能实现

list.html页面

<div class="btn-group btn-group-sm btn-sort col-sm-6" role="group" >		<a th:href="@{initGoods(commodityTypeId=${goodsForm.commodityTypeId})}" th:class="${orderTypeId}==1?'btn btn-default btn-danger':'btn btn-default'">&nbsp;默&nbsp;认&nbsp;</a><a th:href="@{initGoodsByPopularDesc(commodityTypeId=${goodsForm.commodityTypeId})}" th:class="${orderTypeId}==3?'btn btn-default btn-danger':'btn btn-default'" th:if="${orderTypeId}!=2">&nbsp;人&nbsp;气<i></i>&nbsp;</a><a th:href="@{initGoodsByPopular(commodityTypeId=${goodsForm.commodityTypeId})}" th:class="${orderTypeId}==2?'btn btn-default btn-danger':'btn btn-default'" th:if="${orderTypeId}==2">&nbsp;人&nbsp;气<i class="up"></i>&nbsp;</a><a th:href="@{initGoodsByPriceDesc(commodityTypeId=${goodsForm.commodityTypeId})}" th:class="${orderTypeId}==5?'btn btn-default btn-danger':'btn btn-default'" th:if="${orderTypeId}!=4">&nbsp;价&nbsp;格<i></i>&nbsp;</a><a th:href="@{initGoodsByPrice(commodityTypeId=${goodsForm.commodityTypeId})}" th:class="${orderTypeId}==4?'btn btn-default btn-danger':'btn btn-default'" th:if="${orderTypeId}==4">&nbsp;价&nbsp;格<i class="up"></i>&nbsp;</a>
</div>

GoodsController.java

//以人气的升序进行排列@RequestMapping(value = "initGoodsByPopular", method = RequestMethod.GET)public String initGoodsByPopular(Model model, HttpSession session, GoodsForm goodsForm, Device device) {log.info("以人气为条件商品列表初始化");List<GoodsForm> commodityType = goodsService.getType();model.addAttribute("commodityType", goodsService.getType());if(goodsForm.getCommodityTypeId()==null){goodsForm.setCommodityTypeId(commodityType.get(0).getCommodityTypeId());model.addAttribute("list", goodsService.getTypeList(goodsForm));model.addAttribute("goodsForm", goodsForm);}else{model.addAttribute("goodsForm", goodsForm);model.addAttribute("list", goodsService.getTypeList(goodsForm));}UVO uvo = (UVO)session.getAttribute("UVO");if (uvo == null) {uvo = new UVO();session.setAttribute("UVO", uvo);}model.addAttribute("list", goodsService.searchGoodsListByPopular(goodsForm));model.addAttribute("orderTypeId", 3);CartForm cartForm = new CartForm();cartForm.setGuestId(uvo.getGuestId());model.addAttribute("cartList", cartService.searchCartList(cartForm));if(device.isNormal()) {return "shop/list";} else {return "mobile/list";}}//以价格的降序进行排列@RequestMapping(value = "initGoodsByPriceDesc", method = RequestMethod.GET)public String initGoodsByPriceDesc(Model model, HttpSession session, GoodsForm goodsForm, Device device) {log.info("以价格为条件商品列表初始化");List<GoodsForm> commodityType = goodsService.getType();model.addAttribute("commodityType", goodsService.getType());if(goodsForm.getCommodityTypeId()==null){goodsForm.setCommodityTypeId(commodityType.get(0).getCommodityTypeId());model.addAttribute("list", goodsService.getTypeList(goodsForm));model.addAttribute("goodsForm", goodsForm);}else{model.addAttribute("goodsForm", goodsForm);model.addAttribute("list", goodsService.getTypeList(goodsForm));}UVO uvo = (UVO)session.getAttribute("UVO");if (uvo == null) {uvo = new UVO();session.setAttribute("UVO", uvo);}model.addAttribute("list", goodsService.searchGoodsListByPriceDesc(goodsForm));model.addAttribute("orderTypeId", 4);CartForm cartForm = new CartForm();cartForm.setGuestId(uvo.getGuestId());model.addAttribute("cartList", cartService.searchCartList(cartForm));if(device.isNormal()) {return "shop/list";} else {return "mobile/list";}}//以价格的升序进行排列@RequestMapping(value = "initGoodsByPrice", method = RequestMethod.GET)public String initGoodsByPrice(Model model, HttpSession session, GoodsForm goodsForm, Device device) {log.info("以价格为条件商品列表初始化");List<GoodsForm> commodityType = goodsService.getType();model.addAttribute("commodityType", goodsService.getType());if(goodsForm.getCommodityTypeId()==null){goodsForm.setCommodityTypeId(commodityType.get(0).getCommodityTypeId());model.addAttribute("list", goodsService.getTypeList(goodsForm));model.addAttribute("goodsForm", goodsForm);}else{model.addAttribute("goodsForm", goodsForm);model.addAttribute("list", goodsService.getTypeList(goodsForm));}UVO uvo = (UVO)session.getAttribute("UVO");if (uvo == null) {uvo = new UVO();session.setAttribute("UVO", uvo);}model.addAttribute("list", goodsService.searchGoodsListByPrice(goodsForm));model.addAttribute("orderTypeId", 5);CartForm cartForm = new CartForm();cartForm.setGuestId(uvo.getGuestId());model.addAttribute("cartList", cartService.searchCartList(cartForm));if(device.isNormal()) {return "shop/list";} else {return "mobile/list";}}


转载于:https://my.oschina.net/u/2411770/blog/490831

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_758283.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

网站页面左右_网站建设|网站首页这么设计,用户体验更好

这是【建站百科】专栏第18篇原创内容&#xff0c;由我在建站行业从业10年、给上万公司搭建过网站的经验总结而来。hello&#xff0c;艾瑞巴蒂&#xff0c;大梦又来了&#xff0c;今天要说的是作为网站“门面”的网站首页设计。一、 网站首页的重要性作为网站全貌及重要信息、产…

wget 递归下载大部分网站目录

引入你有听错吗&#xff1f;你以为我是一个标题党吗&#xff1f;没有听错&#xff0c;我也不是标题党&#xff0c;方法很简单&#xff0c;只需要一个叫做wget的小软件&#xff08;Linux、Windows可以用&#xff0c;MAC没用过&#xff09;就可以做到了。 准备工作先说Windows系统…

精通Web Analytics 2.0 (12) 第十章:针对潜在的网站分析陷阱的最佳解决方案

精通Web Analytics 2.0 &#xff08;12&#xff09; 第十章&#xff1a;针对潜在的网站分析陷阱的最佳解决方案 精通Web Analytics 2.0 : 用户中心科学与在线统计艺术 第十章&#xff1a;针对潜在的网站分析陷阱的最佳解决方案 是时候去处理网站分析中最棘手的一些问题了&…

CentOS下Apache配置多网站

为什么80%的码农都做不了架构师&#xff1f;>>> 目前在一台服务器上搭建多个网站的方法主要由以下几种&#xff1a; 1、 基于IP地址 这种方法适用于一台服务器有多个IP的情况&#xff0c;但目前阿里云的ECS只允许绑定一个公网IP和一个私网IP&#xff0c;故此方法不…

01快速认识阿里云网站建设

1.网站(站点)的组成&#xff1a; 域名: baidu.com 程序和内容 服务器&#xff1a;用来存储内容 2.网站是怎么建成的 域名注册 服务器&#xff08;虚拟主机&#xff09;购买 域名服务器ip绑定 内容指向--提供服务 3.网站建设的注意事项 域名注意事项 免费域名 收录不好--测试使用…

大型网站架构演化(五)——数据库读写分离

网站在使用缓存后&#xff0c;使绝大部分数据读操作访问都可以不通过数据库就能完成&#xff0c;但是仍有一部分读操作&#xff08;缓存访问不命中、缓存过期&#xff09;和全部的写操作需要访问数据库&#xff0c;在网站的用户达到一定规模后&#xff0c;数据库因为负载压力过…

微软ASP.NET网站部署指南(4):配置项目属性

1. 综述 有些部署设置能够在项目属性里设置的&#xff0c;而且保持到项目文件中&#xff08;.csproj或.vbproj&#xff09;。大多数情况下。你都能够在Visual Studio 选择项目属性Project Properties&#xff0c;在属性窗体里设置这些參数。该章节将告诉你怎样设置这些參数。 …

《大型网站技术架构》读书笔记系列

一、此书到底何方神圣&#xff1f; 《大型网站技术架构&#xff1a;核心原理与案例分析》通过梳理大型网站技术发展历程&#xff0c;剖析大型网站技术架构模式&#xff0c;深入讲述大型互联网架构设计的核心原理&#xff0c;并通过一组典型网站技术架构设计案例&#xff0c;为读…

Java开发不得不了解的各种插件、工具、网站!!!

文章目录1. 前言2. IDEA 插件2.1 Alibaba Java Coding Guidelines2.2 jclasslib bytecode viewer2.3 Codota2.4 Auto filling Java call arguments2.5 GenerateO2O、 GenerateAllSetter2.6 Material Theme UI2.7 Rainbow Brackets2.8 Maven Helper2.9 FindBugs2.10 SequenceDia…

大型分布式网站架构技术总结

本文是学习大型分布式网站架构的技术总结。对架构一个高性能&#xff0c;高可用&#xff0c;可伸缩&#xff0c;可扩展的分布式网站进行了概要性描述&#xff0c;并给出一个架构参考。一部分为读书笔记&#xff0c;一部分是个人经验总结。对大型分布式网站架构有很好的参考价值…

谈谈个人网站的建立(一)——建站历史和技术架构

首先&#xff0c;帮忙点击一下我的网站http://www.wenzhihuai.com/。谢谢啊&#xff0c;如果可以&#xff0c;GitHub上麻烦给个star&#xff0c;以后面试能讲讲这个项目&#xff0c;GitHub地址https://github.com/Zephery/newblog 大学的时候萌生的一个想法&#xff0c;就是建立…

网站图片优化的十五个原则

现在的网站大量的使用图片&#xff0c;那么这些图片如何优化才好呢?1)在网站设计之初&#xff0c;就先要做好规划&#xff0c;比如背景图片如何使用等等&#xff0c;做到心中有数。2)编辑图片的时候&#xff0c;要做好裁剪&#xff0c;之展示必要的&#xff0c;重要的&#xf…

网站优化之图片

图片应做成响应式、(大尺寸图片建议)使用渐进式JPEG、使用mozJPEG&#xff0c;tinyPNG等工具对图片进行压缩; 压缩工具&#xff1a; http://c7sky.com/kraken-io-image-optimizer.html 这里主要讲类似于bannner等大图优化加载问题&#xff1b; 压缩工具&#xff1a; -TinyPNG和…

网站加速技术

定义&#xff1a;网站加速技术是一个综合的提高网站访问速度的各种技术的总和。 静态数据&#xff1a;css、js、flash之类的数据&#xff0c;变动不大。 动态数据&#xff1a;从数据库查询出来的数据。 &#xff08;一&#xff09;页面静态化&#xff0c;可以从某种角度加快网站…

【网站管理5】_讲解网站后台SEO优化和如何修改关键字以及关键词布局

讲解网站后台SEO优化和如何修改关键字以及关键词布局 制作&#xff1a;赖忠标 QQ&#xff1a;392277956 1.打开后台点击左侧边上的栏目&#xff0c;点击最后的系统-系统基本参数-站点设置 如下图 2.上图所改处的关键词 是网站首页的关键词和描述&#xff0c;放在首页处…

wordpress制作独立手机端并绑定域名_【教程】手把手教你如何用Wordpress快速搭建个人网站...

上一篇文章中&#xff08;【教程前言】WordPress能够为您做什么样的网站&#xff09;&#xff0c;我就跟大家描述过可以用Wordpress大家私人博客&#xff0c;在这篇文章中&#xff0c;我将详细展示如何用Wordpress创建个人博客&#xff0c;整个过程比你想象的更容易&#xff0c…

如何在首页只显示所有子网站的特定通知

我们设置好了在首页显示所有子网站&#xff08;部门网站&#xff09;的通知。但是&#xff0c;正常情况下&#xff0c;部门网站中的通知会包括发布到整个公司的通知以及本部门内部的通知。而在首页中显示的应该是针对整个公司的通知&#xff0c;下面我们就来进行一些设置。 在顶…

php网站中找不到指定的数据库,php找不到数据库的解决方法

php找不到数据库的解决方法发布时间&#xff1a;2020-08-21 14:15:38来源&#xff1a;亿速云阅读&#xff1a;79作者&#xff1a;小新这篇文章将为大家详细讲解有关php找不到数据库的解决方法&#xff0c;小编觉得挺实用的&#xff0c;因此分享给大家做个参考&#xff0c;希望大…

网站互点排名掉了网站互点排名掉了网站互点_葫芦岛seo公司关键词排名突然下降分析...

网站优化过程中&#xff0c;葫芦岛 发现发现有些网站会不时出现关键词百度排名忽然下降的现象&#xff0c;很多SEO人员肯定遇到过。很多行业的网站出现大规模洗牌之际&#xff0c;有站长喜有站长忧。一诺建站公司根据关键词百度排名突降几种现象进行分析及解决办法。1、原本NO.…

网页内存位置访问无效_网站访问速度慢的四大原因是什么?

很多企业的网站都是做了百度推广的&#xff0c;投下了大量的广告引流费用&#xff0c;如果网站访问速度很慢&#xff0c;导致网站收益不好就比较冤枉了。今天小编将会介绍几种常见的引起网站访问速度比较慢的原因。原因一&#xff1a;服务器配置问题服务器内存空间小&#xff0…