From fe37c59dc648e01e0244bff86d87b2793dc4f712 Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@Admin>
Date: 星期二, 30 十月 2018 17:57:14 +0800
Subject: [PATCH] 新版搜索 队员列表查询

---
 fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml |   72 +++++++++++++++++++++++++++++++++--
 1 files changed, 67 insertions(+), 5 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml
index 3f6f29a..b58da33 100644
--- a/fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml
+++ b/fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml
@@ -1037,18 +1037,80 @@
 	</select>
 	
 	
-	<select id="listRecommendBykey" resultMap="BaseResultMap">
+	<select id="listRecommendBykey"  resultMap="BaseResultMap">
 		SELECT   <include refid="Base_Column_List" />  FROM `yeshi_ec_quality_factory` h
 		LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
-		WHERE 1=1  <if test='key != null and key != ""'> AND tb.`title` LIKE '%${key}%' </if>
-		ORDER BY h.sg_weight DESC
+		WHERE 1=1 
+		<!-- 鍏抽敭璇嶆悳绱�  -->
+		<if test='key != null and key != ""'> AND tb.`title` LIKE '%${key}%' </if>
+		<!-- 鍦ㄥ敭浠疯寖鍥�  -->
+	 	<if test='startprice != null'>
+  	 		AND <![CDATA[  tb.`zkPrice` >= #{startprice}]]>
+	 	</if>
+	  	<if test='endprice != null'>
+  	 		AND <![CDATA[  tb.`zkPrice` <= #{endprice}]]>
+		</if>
+		<!-- 鏈夊埜  -->
+		<if test='hasQuan != null'>
+  	 		AND <![CDATA[  tb.`couponLeftCount` > 1]]>
+		</if>
+		<!-- 澶╃尗鍟嗗搧  --> 
+		<if test='userType != null'>
+  	 		AND <![CDATA[  tb.`userType` = 1]]>
+		</if>
+		
+		ORDER BY 
+			<!-- 閿�閲忛珮鍒颁綆   -->
+		 	<if test='sort == 1'>
+   	 			tb.`biz30day` desc,
+		 	</if>
+		 	<!-- 浠锋牸 浣庡埌楂�   -->
+		 	<if test='sort == 3'>
+   	 			tb.`zkPrice`,
+		 	</if>
+		 	<!-- 浠锋牸 楂樺埌浣�   -->
+		 	<if test='sort == 2'>
+   	 			tb.`zkPrice` desc,
+		 	</if>
+		 	<!-- 鎺ㄥ箍閲� 楂樺埌浣�   -->
+		 	<if test='sort == 4'>
+   	 			tb.`totalSales` desc,
+		 	</if>
+			<!-- 浣i噾姣斾緥  -->
+		 	<if test='sort == 5'>
+   	 			tb.`tkRate` desc,
+		 	</if>
+		 	<!-- 浣i噾姣斾緥 -->
+		 	<if test='sort == 6'>
+   	 			tb.`tkRate`,
+		 	</if>
+		 	<!-- 榛樿锛氭潈閲嶉珮鍒颁綆-->
+			h.sg_weight DESC
+		
 		LIMIT #{start},#{count}
 	</select>
 	
 	<select id="countRecommendBykey" resultType="java.lang.Long">
-		SELECT IFNULL(COUNT( h.`sg_id`),0)  FROM `yeshi_ec_quality_factory` h
+		SELECT IFNULL(COUNT(h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
 		LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
-		WHERE 1=1  <if test='key != null and key != ""'> AND tb.`title` LIKE '%${key}%' </if>
+		WHERE 1=1 
+		<!-- 鍏抽敭璇嶆悳绱�  -->
+		<if test='key != null and key != ""'> AND tb.`title` LIKE '%${key}%' </if>
+		<!-- 鍦ㄥ敭浠疯寖鍥�  -->
+	 	<if test='startprice != null'>
+  	 		AND <![CDATA[  tb.`zkPrice` >= #{startprice}]]>
+	 	</if>
+	  	<if test='endprice != null'>
+  	 		AND <![CDATA[  tb.`zkPrice` <= #{endprice}]]>
+		</if>
+		<!-- 鏈夊埜  -->
+		<if test='hasQuan != null'>
+  	 		AND <![CDATA[  tb.`couponLeftCount` > 1]]>
+		</if>
+		<!-- 澶╃尗鍟嗗搧  --> 
+		<if test='userType != null'>
+  	 		AND <![CDATA[  tb.`userType` = 1]]>
+		</if>
 	</select>
 	
 </mapper>

--
Gitblit v1.8.0