From 4cb15e222cd7d099d533ccbeb7f9a8cd99bf180c Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 25 十二月 2018 16:35:18 +0800
Subject: [PATCH] 替换原来老的资金详情

---
 fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml |  135 +++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 129 insertions(+), 6 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..a050831 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
@@ -57,7 +57,34 @@
 			javaType="com.yeshi.fanli.entity.common.AdminUser">
 			<id column="sg_update_aid" property="id" jdbcType="BIGINT" />
 	</association>
- 
+  </resultMap>
+  
+  <resultMap id="GoodsResultMap" type="com.yeshi.fanli.entity.bus.lable.QualityFactory">
+    <id column="sg_id" property="id" jdbcType="BIGINT"/>
+    <result column="sg_class_id" property="systemCid" jdbcType="BIGINT"/>
+    <result column="sg_entry_mode" property="entryMode" jdbcType="INTEGER"/>
+    <result column="sg_goods_source" property="goodsSource" jdbcType="INTEGER"/>
+    <result column="sg_source_calss" property="sourceCalss" jdbcType="VARCHAR"/>
+    <result column="sg_weight" property="weight" jdbcType="INTEGER"/>
+    <result column="sg_createtime" property="createtime" jdbcType="TIMESTAMP"/>
+    <result column="sg_updatetime" property="updatetime" jdbcType="TIMESTAMP"/>
+    
+ 	 <association property="boutiqueAutoRule" column="sg_rule_id" 
+    	javaType="com.yeshi.fanli.entity.bus.lable.BoutiqueAutoRule">
+			<id column="sg_rule_id" property="id" jdbcType="BIGINT" />
+    </association>
+ 	
+     <association property="taoBaoGoodsBrief" column="sg_goods_id"
+      resultMap="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.BaseResultMap"/>
+ 	
+ 	 <association property="createUser" column="sg_create_aid" 
+    	javaType="com.yeshi.fanli.entity.common.AdminUser">
+			<id column="sg_create_aid" property="id" jdbcType="BIGINT" />
+    </association>
+    <association property="updateUser" column="sg_update_aid"
+			javaType="com.yeshi.fanli.entity.common.AdminUser">
+			<id column="sg_update_aid" property="id" jdbcType="BIGINT" />
+	</association>
   </resultMap>
   
   <sql id="Base_Column_List">sg_id,sg_class_id,sg_goods_id,sg_entry_mode,sg_goods_source,sg_source_calss,sg_rule_id,sg_weight,sg_create_aid,sg_createtime,sg_update_aid,sg_updatetime</sql>
@@ -1037,18 +1064,114 @@
 	</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='startTkRate != null'>
+  	 		AND <![CDATA[  tb.`tkRate` >= #{startTkRate}]]>
+	 	</if>
+	  	<if test='endTkRate != null'>
+  	 		AND <![CDATA[  tb.`tkRate` <= #{endTkRate}]]>
+		</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='startTkRate != null'>
+  	 		AND <![CDATA[  tb.`tkRate` >= #{startTkRate}]]>
+	 	</if>
+	  	<if test='endTkRate != null'>
+  	 		AND <![CDATA[  tb.`tkRate` <= #{endTkRate}]]>
+		</if>
+		<!-- 鏈夊埜  -->
+		<if test='hasQuan != null'>
+  	 		AND <![CDATA[  tb.`couponLeftCount` > 1]]>
+		</if>
+		<!-- 澶╃尗鍟嗗搧  --> 
+		<if test='userType != null'>
+  	 		AND <![CDATA[  tb.`userType` = 1]]>
+		</if>
 	</select>
 	
+	<select id="listQueryBylabIDs" resultMap="GoodsResultMap"> 
+	  	SELECT * FROM (
+			SELECT DISTINCT( tt.`sg_id`) AS tbid  FROM yeshi_ec_quality_factory tt 
+			
+			LEFT JOIN yeshi_ec_taobao_goods tb ON tt.`sg_goods_id`= tb.`id` 
+			
+			LEFT JOIN yeshi_ec_label_goods lg ON tt.`sg_goods_id` = lg.`lg_goods_id` 
+				
+				WHERE tb.`id` != #{gid} 
+					<if test='systemCid != null'>
+  	 					AND  tt.`sg_class_id` = #{systemCid}  
+					</if>
+					 AND  lg.`lg_label_id` IN
+				<foreach collection="list" item="item" open="(" close=")"
+					separator=",">#{item}</foreach>
+		 	 LIMIT ${start},${count}
+		 ) a LEFT JOIN yeshi_ec_quality_factory ts ON ts.`sg_id`=a.tbid 
+		 	LEFT JOIN yeshi_ec_taobao_goods tbb ON ts.`sg_goods_id`= tbb.`id`
+   </select> 
+	
 </mapper>

--
Gitblit v1.8.0