码迷,mamicode.com
首页 > 其他好文 > 详细

搜索框

时间:2015-07-22 16:43:26      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:

搜索框

userBar

<form action="serch" th:object="${goodsFrom}" method="post">
         <li>
		<span><input name="commodityName" type="text" /></span>
		<span><button type="submit" name="sousuo">搜索</button></span> 
	</li>		
          </form>


GoodsController

@RequestMapping(value = "/serch", method = RequestMethod.POST)
	public String delete(GoodsForm goodsForm, Model model) {
		List<GoodsForm> rescult = goodsService.serchGoodsList(goodsForm);
		model.addAttribute("list", rescult);
		CartForm cartForm = new CartForm();
		model.addAttribute("cartList", cartService.searchCartList(cartForm));
		return "shop/index";
	}

GoodsService

public  List<GoodsForm> serchGoodsList(GoodsForm frm) {

	List<GoodsForm> result = queryDao.executeForObjectList("Goods.selectList", frm);
			return result;
		}


GoodsSqlMap

<select id="selectList"
		parameterClass="cn.agriculture.web.form.GoodsForm"
		resultClass="cn.agriculture.web.form.GoodsForm">
			SELECT commodity.commodity_id as commodityId,
			commodity.type as type,
			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>


搜索框

标签:

原文地址:http://my.oschina.net/u/2411768/blog/482346

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!