From 51a4ff5d777028d52a19c314a99f796334cb7b51 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 23 十一月 2019 18:30:01 +0800
Subject: [PATCH] 配置文件修改

---
 fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml |  330 +++++++++++++++++++++++++++++++-----------------------
 1 files changed, 188 insertions(+), 142 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 3fc7009..c3add65 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
@@ -179,15 +179,31 @@
 		where sg_id = #{id,jdbcType=BIGINT}
 	</update>
 
+
+	<!-- 鏌ヨ瓒呰繃4涓皬鏃舵湭鏇存柊鍟嗗搧锛岃繘琛屾洿鏂� -->
+	<update id="updateWeight">
+		UPDATE yeshi_ec_quality_factory SET sg_weight = #{weight}
+		WHERE <![CDATA[TO_DAYS(`sg_updatetime`) < TO_DAYS(NOW()) OR (HOUR(NOW()) -HOUR(`sg_updatetime`)) >= #{time} ]]>
+	</update>
+
+
+
 	<delete id="deleteBatchByPrimaryKey" parameterType="java.util.List">
-		delete FROM yeshi_ec_quality_factory WHERE sg_id in
+		DELETE FROM yeshi_ec_quality_factory WHERE sg_id in
 		<foreach collection="list" item="item" open="(" close=")"
 			separator=",">#{item}</foreach>
 	</delete>
 
+	<delete id="deleteBatchByGoodsId" parameterType="java.util.List">
+		DELETE FROM yeshi_ec_quality_factory WHERE sg_goods_id in
+		<foreach collection="list" item="item" open="(" close=")"
+			separator=",">#{item}</foreach>
+	</delete>
+
+
 	<insert id="insertBatch" useGeneratedKeys="true" keyProperty="id"
 		parameterType="java.util.List">
-		insert into yeshi_ec_quality_factory
+		INSERT IGNORE yeshi_ec_quality_factory
 		(
 		<include refid="Base_Column_List" />
 		)
@@ -279,27 +295,11 @@
 
 	</select>
 
-	<!-- 鏌ヨ瓒呰繃hour涓皬鏃舵湭鏇存柊鍟嗗搧锛岃繘琛屾洿鏂� -->
-	<select id="queryNeedUpdate" resultType="java.lang.Long">
-		SELECT h.sg_goods_id FROM `yeshi_ec_quality_factory` h
-		LEFT JOIN
-		`yeshi_ec_taobao_goods` tb ON h.`sg_goods_id` = tb.id
-		WHERE <![CDATA[TO_DAYS(tb.`updatetime`) < TO_DAYS(NOW()) OR (HOUR(NOW()) -HOUR(tb.`updatetime`)) >=  #{hour}]]>
-		order by h.`sg_updatetime` LIMIT ${start},${count}
-	</select>
-
-	<!-- 鏌ヨ瓒呰繃5涓皬鏃舵湭鏇存柊鍟嗗搧锛岃繘琛屾洿鏂� -->
-	<select id="countQueryNeedUpdate" resultType="java.lang.Long">
-		SELECT count(sg_id) FROM `yeshi_ec_quality_factory` h
-		LEFT JOIN
-		`yeshi_ec_taobao_goods` tb ON h.`sg_goods_id` = tb.id
-		WHERE <![CDATA[TO_DAYS(tb.`updatetime`) < TO_DAYS(NOW()) OR (HOUR(NOW()) -HOUR(tb.`updatetime`)) >= 4]]>
-	</select>
-
 
 	<!-- 鏌ヨ绮鹃�夊晢鍝佷俊鎭� -->
-	<select id="query" parameterType="com.yeshi.fanli.vo.quality.QualityFactoryVO" resultMap="ResultMap">
- 
+	<select id="query" parameterType="com.yeshi.fanli.vo.quality.QualityFactoryVO"
+		resultMap="ResultMap">
+
 		SELECT ts.* FROM (
 		SELECT DISTINCT( tt.`sg_id`) AS id FROM
 		yeshi_ec_quality_factory tt
@@ -460,7 +460,8 @@
 
 	</select>
 
-	<select id="queryCount" parameterType="com.yeshi.fanli.vo.quality.QualityFactoryVO"  resultType="java.lang.Long">
+	<select id="queryCount" parameterType="com.yeshi.fanli.vo.quality.QualityFactoryVO"
+		resultType="java.lang.Long">
 		<!-- 鏍规嵁鏉′欢缁熻鎵�鏈夋爣绛炬暟閲� -->
 		SELECT count(ts.sg_id) FROM (
 		SELECT DISTINCT( tt.`sg_id`) AS id FROM
@@ -594,6 +595,17 @@
 		FROM yeshi_ec_quality_factory WHERE sg_goods_id = ${goodsId}
 	</select>
 
+
+	<!--鏌ヨ绮鹃�夊晢鍝佷俊鎭� -->
+	<select id="getByAuctionId" resultMap="BaseResultMap">
+		SELECT * FROM
+		yeshi_ec_quality_factory
+		WHERE sg_goods_id = ${auctionId}
+		limit 1
+	</select>
+
+
+
 	<select id="queryCountByGoodsId" resultType="java.lang.Long">
 		SELECT COUNT(sg_id)
 		FROM yeshi_ec_quality_factory WHERE sg_goods_id =
@@ -706,69 +718,7 @@
 	</select>
 
 
-	<select id="listQueryEverydayRob" resultMap="BaseResultMap">
-		<!-- 绉诲姩鏌ヨ姣忔棩蹇呮姠 -->
-		SELECT * FROM `yeshi_ec_quality_factory` h
-		LEFT JOIN
-		`yeshi_ec_label_goods` g ON h.`sg_goods_id` = g.`lg_goods_id`
-		LEFT JOIN
-		yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
-		WHERE
-		g.`lg_label_id`= #{labId} AND TO_DAYS(h.`sg_updatetime`) =
-		TO_DAYS(NOW())
-		<!-- 鍒嗙被id -->
-		<if test="systemCid != null">
-			AND h.`sg_class_id` = #{systemCid}
-		</if>
-		<if test="startCouponAmount != null">
-			<![CDATA[ AND tb.couponAmount > #{startCouponAmount} ]]>
-		</if>
-		<if test="endCouponAmount != null">
-			<![CDATA[ AND tb.couponAmount <= #{endCouponAmount}]]>
-		</if>
 
-		ORDER BY
-
-		<if test="sortField == 1">
-			h.sg_createtime,
-		</if>
-		<if test="sortField == 2">
-			h.sg_createtime desc,
-		</if>
-		<if test="sortField == 3">
-			h.sg_updatetime,
-		</if>
-		<if test="sortField == 4">
-			h.sg_updatetime desc,
-		</if>
-
-		h.sg_weight desc
-
-		LIMIT ${start},${count}
-
-	</select>
-
-	<select id="countQueryEverydayRob" resultType="java.lang.Long">
-		<!-- 绉诲姩鏌ヨ姣忔棩蹇呮姠 -->
-		SELECT IFNULL(COUNT( h.`sg_id`),0) FROM `yeshi_ec_quality_factory` h
-		LEFT JOIN `yeshi_ec_label_goods` g ON h.`sg_goods_id` =
-		g.`lg_goods_id`
-		LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`=
-		tb.`id`
-		WHERE g.`lg_label_id`= #{labId} AND TO_DAYS(h.`sg_updatetime`)
-		=
-		TO_DAYS(NOW())
-		<if test="systemCid != null">
-			AND h.`sg_class_id` = #{systemCid}
-		</if>
-		<if test="startCouponAmount != null">
-			<![CDATA[ AND tb.couponAmount > #{startCouponAmount} ]]>
-		</if>
-		<if test="endCouponAmount != null">
-			<![CDATA[ AND tb.couponAmount <= #{endCouponAmount}]]>
-		</if>
-
-	</select>
 
 
 	<delete id="removeStorageGoods" parameterType="java.lang.Long">
@@ -936,13 +886,11 @@
 	<select id="listQueryByFlashSale" resultMap="BaseResultMap">
 		SELECT
 		<include refid="Base_Column_List" />
-		FROM yeshi_ec_quality_factory h
-
-		RIGHT JOIN yeshi_ec_quality_flash_sale
-		s ON h.`sg_id` = s.`fs_qfgoods_id`
-
-		LEFT JOIN yeshi_ec_taobao_goods tb
-		ON h.`sg_goods_id`= tb.`id`
+		FROM yeshi_ec_quality_flash_sale s
+		LEFT JOIN yeshi_ec_quality_factory h ON h.`sg_goods_id` =
+		s.`fs_qfgoods_id`
+		LEFT JOIN yeshi_ec_taobao_goods tb ON
+		h.`sg_goods_id`= tb.`id`
 
 		WHERE <![CDATA[ tb.`couponTotalCount` > 0 AND tb.couponLeftCount<tb.couponTotalCount ]]>
 
@@ -953,8 +901,7 @@
 
 	<select id="countQueryByFlashSale" resultType="java.lang.Long">
 		SELECT IFNULL(COUNT( h.`sg_id`),0) FROM yeshi_ec_quality_factory h
-
-		RIGHT JOIN yeshi_ec_quality_flash_sale s ON h.`sg_id` =
+		RIGHT JOIN yeshi_ec_quality_flash_sale s ON h.`sg_goods_id` =
 		s.`fs_qfgoods_id`
 
 		LEFT JOIN yeshi_ec_taobao_goods tb ON
@@ -966,12 +913,15 @@
 
 	<select id="listFlashSaleRandGoods" resultMap="GoodsResultMap">
 		SELECT h.*, tb.* FROM yeshi_ec_quality_factory h
-		RIGHT JOIN yeshi_ec_quality_flash_sale s ON h.`sg_id` = s.`fs_qfgoods_id`
+		RIGHT JOIN
+		yeshi_ec_quality_flash_sale s ON h.`sg_goods_id` = s.`fs_qfgoods_id`
 		LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
-		
-		WHERE  s.`fs_id` IS NOT NULL AND tb.`biz30day` <![CDATA[>=]]> 10000 
-		     AND tb.`couponTotalCount` <![CDATA[>]]>10
-		     AND tb.couponLeftCount <![CDATA[<]]> tb.couponTotalCount
+
+		WHERE s.`fs_id` IS NOT NULL AND tb.`biz30day` <![CDATA[>=]]>
+		10000
+		AND tb.`couponTotalCount` <![CDATA[>]]>10
+		AND tb.couponLeftCount <![CDATA[<]]>
+		tb.couponTotalCount
 		ORDER BY RAND()
 		LIMIT 3
 	</select>
@@ -1152,23 +1102,13 @@
 
 
 	<select id="getAuctionIdbyClassId" resultType="java.lang.Long">
-		SELECT tb.`id` FROM `yeshi_ec_quality_factory` h
-		LEFT JOIN
-		`yeshi_ec_taobao_goods` tb ON h.`sg_goods_id` = tb.`id`
-		WHERE
-		h.`sg_class_id` = #{systemCid} AND h.`sg_goods_source` =
-		#{goodsSource}
-		AND <![CDATA[h.`sg_createtime` < '${beforeTime}']]>
-		AND NOT EXISTS(SELECT lg_goods_id FROM `yeshi_ec_label_goods` lb WHERE
-		lb.`lg_goods_id` = tb.`id`)
+		SELECT h.`sg_goods_id` FROM `yeshi_ec_quality_factory` h
+		WHERE h.`sg_goods_source` = #{goodsSource}
+		AND h.`sg_updatetime` <![CDATA[<]]>
+		#{beforeTime}
+		<if test="systemCid != null">AND h.`sg_class_id` = #{systemCid}</if>
 	</select>
 
-
-	<!-- 鏌ヨ瓒呰繃4涓皬鏃舵湭鏇存柊鍟嗗搧锛岃繘琛屾洿鏂� -->
-	<select id="updateWeight">
-		UPDATE yeshi_ec_quality_factory SET sg_weight = #{weight}
-		WHERE <![CDATA[TO_DAYS(`sg_updatetime`) < TO_DAYS(NOW()) OR (HOUR(NOW()) -HOUR(`sg_updatetime`)) >= #{time} ]]>
-	</select>
 
 	<select id="listRecommendToIndex" resultMap="BaseResultMap">
 		SELECT
@@ -1341,40 +1281,146 @@
 		#{start},#{count}
 	</select>
 
-   <select id="listFreeGoods" resultMap="GoodsResultMap">
-		SELECT * FROM `yeshi_ec_quality_factory` f 
-		LEFT JOIN `yeshi_ec_taobao_goods` tg ON tg.`id` = f.`sg_goods_id`
-		LEFT JOIN `yeshi_ec_label_goods` g ON g.`lg_goods_id` = f.`sg_goods_id`
-		LEFT JOIN `yeshi_ec_label` lab ON lab.`lab_id` = g.`lg_label_id`
-		WHERE lab.`lab_title` = #{lableName} 
-			 <![CDATA[AND tg.`tkRate` >= #{tkRate}]]>
-		ORDER BY f.`sg_createtime` DESC 
-		limit #{start},#{count}
-	</select>
 
-
-   <select id="countFreeGoods" resultType="java.lang.Long">
-		SELECT ifnull(count(sg_id),0) FROM `yeshi_ec_quality_factory` f 
-		LEFT JOIN `yeshi_ec_taobao_goods` tg ON tg.`id` = f.`sg_goods_id`
-		LEFT JOIN `yeshi_ec_label_goods` g ON g.`lg_goods_id` = f.`sg_goods_id`
-		LEFT JOIN `yeshi_ec_label` lab ON lab.`lab_id` = g.`lg_label_id`
-		WHERE lab.`lab_title` = #{lableName} 
-			 <![CDATA[AND tg.`tkRate` >= #{tkRate}]]>
-	</select>
-	
 	<select id="listByShopId" resultMap="GoodsResultMap">
-		SELECT * FROM  yeshi_ec_quality_factory q
-		LEFT JOIN `yeshi_ec_taobao_goods` t ON q.`sg_goods_id` = t.`id`
+		SELECT * FROM
+		yeshi_ec_quality_factory q
+		LEFT JOIN `yeshi_ec_taobao_goods` t ON
+		q.`sg_goods_id` = t.`id`
 		WHERE t.`sellerId` = #{shopId}
-		ORDER BY q.`sg_weight` DESC
+		ORDER BY
+		q.`sg_weight` DESC
 		LIMIT #{start},#{count}
 	</select>
 
-    <select id="countByShopId" resultType="java.lang.Long">
-		SELECT  ifnull(count(sg_id),0) FROM  yeshi_ec_quality_factory q
-		LEFT JOIN `yeshi_ec_taobao_goods` t ON q.`sg_goods_id` = t.`id`
-		WHERE t.`sellerId` = #{shopId}
-	 </select>
-	
+	<select id="countByShopId" resultType="java.lang.Long">
+		SELECT
+		ifnull(count(sg_id),0) FROM yeshi_ec_quality_factory q
+		LEFT JOIN
+		`yeshi_ec_taobao_goods` t ON q.`sg_goods_id` = t.`id`
+		WHERE
+		t.`sellerId` = #{shopId}
+	</select>
+
+	<select id="get9k9ClassGoods" resultMap="GoodsResultMap">
+		SELECT * FROM `yeshi_ec_quality_factory` h
+		LEFT JOIN
+		yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
+		WHERE
+		tb.`couponAmount` > 0 AND tb.`couponTotalCount` > 0
+		AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
+		AND tb.`zkPrice` <![CDATA[<=]]>
+		#{zkPrice}
+		AND tb.`biz30day` <![CDATA[>=]]>
+		#{biz30day}
+		<!-- 鍒稿悗浠疯寖鍥� -->
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]>
+		#{minQuanPrice}
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<= ]]>
+		#{maxQuanPrice}
+		<!-- 澶氫釜鍒嗙被id -->
+		<if test='cids != null and cids != ""'>
+			AND h.`sg_class_id` in (${cids})
+		</if>
+		ORDER BY h.sg_weight desc,tb.`biz30day`desc
+		LIMIT ${start},${count}
+	</select>
+
+	<select id="count9k9ClassGoods" resultType="java.lang.Long">
+		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
+		tb.`couponAmount` > 0 AND tb.`couponTotalCount` > 0
+		AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
+		AND tb.`zkPrice` <![CDATA[<=]]>
+		#{zkPrice}
+		AND tb.`biz30day` <![CDATA[>=]]>
+		#{biz30day}
+		<!-- 鍒稿悗浠疯寖鍥� -->
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]>
+		#{minQuanPrice}
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<= ]]>
+		#{maxQuanPrice}
+		<!-- 澶氫釜鍒嗙被id -->
+		<if test='cids != null and cids != ""'>
+			AND h.`sg_class_id` in (${cids})
+		</if>
+	</select>
+
+
+	<!-- 姣忔棩蹇呮姠 -->
+	<select id="listQueryEverydayRob" resultMap="GoodsResultMap">
+		SELECT * FROM `yeshi_ec_quality_factory` h
+		LEFT JOIN
+		yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
+		WHERE
+		tb.`couponTotalCount` > 0 AND tb.couponAmount <![CDATA[>]]>
+		1 AND tb.couponAmount <![CDATA[<=]]>
+		50
+		AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
+		AND tb.`zkPrice` <![CDATA[<=]]>
+		#{zkPrice}
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]>
+		#{minQuanPrice}
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<=]]>
+		#{maxQuanPrice}
+		ORDER BY h.sg_createtime desc
+		LIMIT ${start},${count}
+	</select>
+
+	<select id="countQueryEverydayRob" resultType="java.lang.Long">
+		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
+		tb.`couponTotalCount` > 0 AND tb.couponAmount <![CDATA[>]]>
+		1 AND tb.couponAmount <![CDATA[<=]]>
+		50
+		AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
+		AND tb.`zkPrice` <![CDATA[<=]]>
+		#{zkPrice}
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]>
+		#{minQuanPrice}
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<=]]>
+		#{maxQuanPrice}
+	</select>
+
+	<select id="listFreeGoods" resultMap="GoodsResultMap">
+ 		SELECT * FROM `yeshi_ec_quality_factory` h
+		LEFT JOIN yeshi_ec_taobao_goods tb ON h.`sg_goods_id`= tb.`id`
+		WHERE tb.`couponAmount` > 0 AND tb.`couponTotalCount` > 0 
+			 AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
+			 <!-- 鍦ㄥ敭浠�  209.9 -->
+			 AND tb.`zkPrice` <![CDATA[<=]]> 209.9
+			 <!--  鍒稿悗浠疯寖鍥�  0~9.9 -->
+			 AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]> 0
+			 AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<= ]]> 9.9
+			 <!-- 姣斾緥  20 -->
+			 AND  tb.`tkRate` <![CDATA[>=]]> 20
+		ORDER BY h.sg_weight desc
+		LIMIT ${start},${count}
+	</select>
+
+
+
+
+	<select id="countFreeGoods" resultType="java.lang.Long">
+		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
+		tb.`couponAmount` > 0 AND tb.`couponTotalCount` > 0
+		AND IF(tb.`zkPrice` - tb.`couponStartFee`>=0, TRUE, FALSE)
+		<!-- 鍦ㄥ敭浠� 209.9 -->
+		AND tb.`zkPrice` <![CDATA[<=]]>
+		209.9
+		<!-- 鍒稿悗浠疯寖鍥� 0~9.9 -->
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[>]]>
+		0
+		AND (tb.`zkPrice` - tb.`couponAmount`) <![CDATA[<= ]]>
+		9.9
+		<!-- 姣斾緥 20 -->
+		AND tb.`tkRate` <![CDATA[>=]]>
+		20
+	</select>
+
 
 </mapper>

--
Gitblit v1.8.0