From cd4d7c2ff85d68aebec276073020224b5de56415 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 05 十一月 2019 10:29:20 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div

---
 fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml |   64 ++++++++++++++++++++++++++++++-
 1 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml
index dd05457..60a9296 100644
--- a/fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml
+++ b/fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml
@@ -815,6 +815,11 @@
 		<!-- 绾㈠寘鐘舵�� -->
 		)hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id`
 		LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
+		
+		<if test="listShopId != null">
+			LEFT JOIN yeshi_ec_common_order_goods g  ON co.`co_order_goods_id`=g.`cog_id`  
+		</if>
+		
 		WHERE hb.hb_id IS NOT NULL
 		<include refid="SELECT_PARAM_ORDER_STATE" />
 		<!-- 璁㈠崟鐘舵�� -->
@@ -828,6 +833,20 @@
 		</if>
 		<!-- 璁㈠崟鏉ユ簮 -->
 		<if test="source != null">AND co.co_source_type = #{source}</if>
+		<if test="listGoodsId != null">
+			<foreach collection="listGoodsId" item="goodsId" open=" and (" separator=" or " close=")">
+				co.`co_order_goods_id` =#{goodsId}
+			</foreach>
+		</if>
+		
+		<if test="listShopId != null">
+			<foreach collection="listShopId" item="shopId" open=" and (" separator=" or " close=")">
+				g.`cog_shop_id` =#{shopId}
+			</foreach>
+		</if>
+		<if test="minTime != null"> <!-- 楂橀闄╄鍗� -->
+			AND co.`co_third_create_time`>#{minTime} AND <![CDATA[ (co.`co_estimate`>=  ${money} OR co.`co_eIncome`> ${money})]]>
+		</if>
 		ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} ) A LEFT
 		JOIN yeshi_ec_user u ON u.id = A.hb_uid
 	</select>
@@ -846,8 +865,7 @@
 		<include refid="SELECT_HONGBAO_STATE" />
 		<!-- 绾㈠寘鐘舵�� -->
 		)hb ON hb.hb_id=ho.`ho_hongbao_id`
-		LEFT JOIN yeshi_ec_common_order co
-		ON co.`co_id`=ho.`ho_order_id`
+		LEFT JOIN yeshi_ec_common_order co	ON co.`co_id`=ho.`ho_order_id`
 		WHERE hb.hb_id IS NOT NULL
 		<include refid="SELECT_PARAM_ORDER_STATE" />
 		<!-- 璁㈠崟鐘舵�� -->
@@ -875,6 +893,9 @@
 		<!-- 绾㈠寘鐘舵�� -->
 		)hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id`
 		LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
+		<if test="listShopId != null">
+			LEFT JOIN yeshi_ec_common_order_goods g  ON co.`co_order_goods_id`=g.`cog_id`  
+		</if>
 		WHERE hb.hb_id IS NOT NULL
 		<include refid="SELECT_PARAM_ORDER_STATE" />
 		<!-- 璁㈠崟鐘舵�� -->
@@ -888,6 +909,20 @@
 		</if>
 		<!-- 璁㈠崟鏉ユ簮 -->
 		<if test="source != null">AND co.co_source_type = #{source}</if>
+		<if test="listGoodsId != null">
+			<foreach collection="listGoodsId" item="goodsId" open=" and (" separator=" or " close=")">
+				co.`co_order_goods_id` =#{goodsId}
+			</foreach>
+		</if>
+		
+		<if test="listShopId != null">
+			<foreach collection="listShopId" item="shopId" open=" and (" separator=" or " close=")">
+				g.`cog_shop_id` =#{shopId}
+			</foreach>
+		</if>
+		<if test="minTime != null"> <!-- 楂橀闄╄鍗� -->
+			AND co.`co_third_create_time`>#{minTime} AND <![CDATA[ (co.`co_estimate`>=  ${money} OR co.`co_eIncome`> ${money})]]>
+		</if>
 	</select>
 
 
@@ -972,6 +1007,29 @@
 		limit #{start},#{count}
 	</select>
 
-
+	<select id="firstValidOrderByUid"  resultMap="ResultMap">
+		SELECT co.*,v2.`hb_get_time` AS accountTime FROM yeshi_ec_hongbao_order ho 
+		LEFT JOIN yeshi_ec_hongbao_v2 v2 ON IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid)=ho.`ho_hongbao_id`
+		LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` 
+		WHERE v2.hb_id IS NOT NULL AND v2.`hb_uid` = #{uid} AND v2.`hb_state` = 3
+			<if test="typeHB == 1"> <!-- 鑷喘璁㈠崟 -->
+				AND (v2.hb_type =1 or v2.hb_type =2)  
+			</if>
+			<if test="typeHB == 2"> <!-- 鍒嗕韩璁㈠崟 -->
+				AND v2.`hb_type` = 20  
+			</if>
+			<if test="typeHB == 3">  <!-- 閭�璇疯鍗� -->
+				AND (v2.`hb_type` = 5 OR v2.`hb_type` = 6 OR v2.`hb_type` = 7 OR
+				v2.`hb_type` = 21 OR v2.`hb_type` = 22)
+			</if>
+			<if test="typeDate == 3"> <!-- 鏈湀 -->
+				AND DATE_FORMAT(co.`co_create_time`,'%Y%m') =	DATE_FORMAT(CURDATE(),'%Y%m')
+			</if>
+			<if test="typeDate == 4"> <!-- 涓婃湀 -->
+				AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),DATE_FORMAT(co.`co_create_time`, '%Y%m')) = 1
+			</if>
+		ORDER BY co.`co_id`
+		LIMIT 1
+	</select>
 
 </mapper>

--
Gitblit v1.8.0