$where = " ";
//模糊查询
$likevalue='';
if($request->input("search_goodsname") && $request->input("search_goodsname")!='' && !empty($request->input("search_goodsname")) && $request->input("search_goodsname")!=null){
//解析id
$where .= " and qly_goods.goodsname like ? ";
$likevalue = "%".$request->input("search_goodsname")."%";
}
$allGoods = DB::select("select goods.norms,goods.status as gstatus,
from goods
INNER JOIN goods_sku on goods.id=goods_sku.goodsid
where goods_sku.price = (select min(goods_sku.price) from goods_sku where goods_sku.goodsid=goods.id) and goods_sku.status=1 ".$where."
group by id
order by updatetime desc",array($likevalue));
laravel 模糊查询的坑
最新推荐文章于 2022-03-09 13:53:31 发布