博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
实现模糊查询
阅读量:6408 次
发布时间:2019-06-23

本文共 2834 字,大约阅读时间需要 9 分钟。

hot3.png

<form action="selectGoods" th:object="${goodsForm}" method="post">

<input type="text" class="inpt" placeholder="请输入关键字" name="commodityName"/>

<input type="submit" value="检索" class="btnS"/>

</form>

 @RequestMapping(value = "selectGoods", method = RequestMethod.POST)

    public String  selectGoods(Model model,HttpSession session,GoodsForm goodsForm,Device device){

    log.info("检索相关商品");

    model.addAttribute("commodityType", goodsService.getType());

    List<GoodsForm> list=goodsService.searchGoodsListrelative(goodsForm);

    model.addAttribute("list",list);

    model.addAttribute("orderTypeId", 1);

    UVO uvo = (UVO)session.getAttribute("UVO");

    if (uvo == null) {

    uvo = new UVO();

    session.setAttribute("UVO", uvo);

    }

    if(device.isNormal()) {

    return "shop/list";

    } else {

    return "mobile/list";

    }

    }

<select id="selectGoodsListrelative"

parameterClass="cn.agriculture.web.form.GoodsForm"

resultClass="cn.agriculture.web.form.GoodsForm">

SELECT commodity.commodity_id as commodityId,

commodity.type as commodityTypeId,

supplier.supplier_name as supplierName,

brand.brand_name as brandName,

commodity.commodity_name as commodityName,

commodity.weight as weight,

commodity.is_gift as isGift,

commodity.specifications as specifications,

commodity.unit as unit,

commodity.benchmark_price as benchmarkPrice,

commodity.guide_price as guidePrice,

commodity.retail_price as retailPrice,

commodity.competition_level as competitionLevel,

commodity.note as note,

commodity.update_time as updateTime,

commodity.update_user as updateUser,

commodity.picture_id as pictureId,

stock.stock as stock

FROM commodity, supplier, brand, stock

WHERE commodity.commodity_id = stock.commodity_id

AND commodity.supplier_id = supplier.supplier_id

AND commodity.brand_id = brand.brand_id

AND commodity.commodity_name LIKE '%$commodityName$%'

</select>

<div>

<div class="col-sm-6 flipBox">

<h4 class="h5">共 <span th:text="${list.size()}"> 999 条记录</span> 条记录</h4>

</div>

</div>

<form action="addCart" th:object="${goodsForm}" method="post">

<ul class="goodsList cf">

<li class="col-md-2 col-sm-4 col-xs-6" th:each="goodsInfo,status:${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 th:href="@{initGoodsDetail(commodityId=${goodsInfo.commodityId})}"><p 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 href="#" class="btnBuy" title="加入购物车"></a>

</p>

</div>

</li>

</ul>

</form>

</div>

转载于:https://my.oschina.net/u/2411987/blog/490824

你可能感兴趣的文章
RHCA教材翻译计划
查看>>
js-小括号在不同场合下的作用
查看>>
我的友情链接
查看>>
kvm中虚拟机的硬盘扩容
查看>>
Android (Launch Mode) 四种启动模式
查看>>
透视学理论(二)
查看>>
Dubbo/HSF在Service Mesh下的思考和方案
查看>>
Django form表单
查看>>
CTYL-9.14(tomcat端口与阿里云安全组,域名与tomcat配置,域名与反向代理)
查看>>
Java 多线程相关问题记录
查看>>
LNMP架构介绍、MySQL安装、PHP安装、 Nginx介绍
查看>>
es6 class 笔记
查看>>
简单的Spark+Mysql整合开发
查看>>
阿里java面试经验大汇总(附阿里职位需求)
查看>>
Python全套零基础视频教程+软件2018最新编程视频!
查看>>
内存管理之1:x86段式内存管理与保护模式
查看>>
20180925上课截图
查看>>
IO输入/输出流的简单总结
查看>>
JavaScript之DOM-9 HTML DOM(HTML DOM概述、常用HTML DOM对象、HTML表单)
查看>>
技术成长之路(一)
查看>>