p.productID as p_id, p.`name` as p_name, p.searchKey as p_keyword, p.tags as p_tags, p.mainImage as p_image, p.priceFlag as p_price_flag, p.productCode as p_code, br.id as p_brand_id, br.name as p_brand_name, p.shopID as p_supplier_id, sh.name as p_supplier_name, p.bigTypeID as p_category1_id, b.name as p_category1_name, p.smallTypeID as p_category2_id, s.name as p_category2_name, p.tinyTypeID as p_category3_id, t.name as p_category3_name, p.preferredFlag as p_preferred, p.productCategory as p_type, copi.validFlag as p_valid, br.weights as p_sort, DATE_FORMAT(p.ADDTIME,'%Y%m%d') as p_time, IFNULL(p.visibility,3) as p_visibility, ifnull(p.newvalidflag,0) as p_newvalidflag, p.productType as p_product_type, p.relatedLabels as p_labels, (select unit from cm_sku where productID= #{productId} order by price asc LIMIT 1 ) as p_unit, ( select price from cm_sku where productID = #{productId} order by price asc LIMIT 1 ) as p_price left join tinytype as t on p.tinyTypeID = t.tinyTypeID left join smalltype as s on p.smallTypeID = s.smallTypeID left join bigtype as b on p.bigTypeID = b.bigTypeID left join cm_brand as br on p.brandID = br.id left join shop as sh on p.shopID = sh.shopID s.shopID as s_id, s.name as s_name, s.logo as s_logo, s.authorizationCertificateImage as s_license, s.businessScope as s_business, s.townID as s_town_id, CONCAT(p.name, c.name) as s_address, s.status as s_valid left join town as t on s.townId = t.townID left join city as c on t.cityID = c.cityID left join province as p on c.provinceID = p.provinceID e.id as e_id, e.title as e_name, e.precisehKey as e_keyword, e.headImage as e_image, e.docBoost as e_sort a.id as a_id, a.title as a_title, a.guidanceImage as a_image, a.publisher as a_publisher, a.pubdate as a_publish_date, a.recommendContent as a_intro, a.infoContent as a_content, (IFNULL(c.pv, 0) +IFNULL(c.num, 0) + IFNULL(a.basePv, 0) + IFNULL(a.basePraise, 0)) as a_pv, a.label as a_label, a.typeId as a_type_id, b.name as a_type_text, a.priorityIndex as a_sort, a.relatedLabels as a_labels left join info_type b on a.typeId = b.id left join info_praise c on a.id = c.infoId update user_search_history userId = #{userId}, searchWord = #{searchWord}, searchDate = #{searchDate}, delFlag = #{delFlag}, where id = #{id} INSERT INTO user_search_history userId, searchWord, searchDate, delFlag, #{userId}, #{searchWord}, #{searchDate}, #{delFlag}, DELETE FROM user_search_history WHERE userId = #{userId} AND id NOT IN (SELECT temp.id FROM (SELECT id FROM user_search_history WHERE userId = #{userId} ORDER BY searchDate DESC LIMIT 10) AS temp) DELETE FROM user_search_history WHERE userId = #{userId}