Search for "commodities"

Source: Internet
Author: User

Header.html

<form action= "Selectgoods" th:object= "${goodsform}" method= "POST" ><input type= "text" class= "INPT" Placeholder= "Please enter the keyword" name= "commodityname"/><input type= "Submit" value= "Retrieve" class= "Btns"/></form>

Goodscontroller.java

  @RequestMapping (value =  "Selectgoods",  method = requestmethod.post)      public string  selectgoods (Model model,httpsession session,goodsform  goodsform,device device) {    log.info ("Search related items");     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", &NBSP;UVO);    }    cartform cartform = new  Cartform ();     caRtform.setguestid (Uvo.getguestid ());     model.addattribute ("Cartlist",  Cartservice.searchcartlist (Cartform));     model.addattribute ("GoodsForm",  goodsForm);     if (Device.isnormal ())  {    return  "Shop/list";     } else {    return  "Mobile/list";     }    }

Goodsservice.java

Public list<goodsform> searchgoodslistrelative (goodsform frm) {list<goodsform> result = Querydao.executeforobjectlist ("goods.selectgoodslistrelative", frm); return result;}

Goodssqlmap.xml

<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  stockfrom commodity, supplier, brand, stockwhere commodity.commodity_id = stock.commodity_idand commodity.supplier_id  = supplier.supplier_idAND commodity.brand_id = brand.brand_idAND  commodity.commodity_name like  '% $commodityName $% ' </select>


Search for "commodities"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.