From 554de444b87aab5f93cb1593a8095612cf9479a7 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期二, 09 六月 2020 17:34:30 +0800
Subject: [PATCH] 订单

---
 fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml |  212 ++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 160 insertions(+), 52 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 7841643..128a60f 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
@@ -25,6 +25,8 @@
 		<result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" />
 		<result column="co_state_desc" property="stateDesc" jdbcType="VARCHAR" />
 		<result column="co_urank" property="urank" jdbcType="INTEGER" />
+		<result column="co_child_source_type" property="childSourceType"
+			jdbcType="VARCHAR" />
 		<association property="userInfo" column="co_uid"
 			javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
 			<id column="co_uid" property="id" jdbcType="BIGINT" />
@@ -58,6 +60,8 @@
 		<result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" />
 		<result column="co_state_desc" property="stateDesc" jdbcType="VARCHAR" />
 		<result column="co_urank" property="urank" jdbcType="INTEGER" />
+		<result column="co_child_source_type" property="childSourceType"
+			jdbcType="VARCHAR" />
 		<association property="userInfo" column="co_uid"
 			javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
 			<id column="co_uid" property="id" jdbcType="BIGINT" />
@@ -104,6 +108,8 @@
 		<result column="co_state_desc" property="stateDesc" jdbcType="VARCHAR" />
 		<result column="co_uid" property="userId" jdbcType="VARCHAR" />
 		<result column="co_urank" property="urank" jdbcType="INTEGER" />
+		<result column="co_child_source_type" property="childSourceType"
+			jdbcType="VARCHAR" />
 		<association property="userInfo" column="co_uid"
 			resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" />
 		<association property="commonOrderGoods" column="co_order_goods_id"
@@ -147,6 +153,8 @@
 		<result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" />
 		<result column="co_state_desc" property="stateDesc" jdbcType="VARCHAR" />
 		<result column="co_urank" property="urank" jdbcType="INTEGER" />
+		<result column="co_child_source_type" property="childSourceType"
+			jdbcType="VARCHAR" />
 		<association property="userInfo" column="co_uid"
 			select="com.yeshi.fanli.dao.mybatis.UserInfoMapper.selectByPrimaryKey" />
 		<association property="commonOrderGoods" column="co_order_goods_id"
@@ -157,13 +165,13 @@
 		<result column="shared" property="shared" jdbcType="BIGINT" />
 		<result column="invite" property="invite" jdbcType="BIGINT" />
 	</resultMap>
-	<sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_state_whole_order,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_order_by,co_create_time,co_update_time,co_trade_id,co_state_desc,co_urank
+	<sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_state_whole_order,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_order_by,co_create_time,co_update_time,co_trade_id,co_state_desc,co_urank,co_child_source_type
 	</sql>
 	<sql id="Order_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,
 		co_order_goods_id,co_count,co_state,co_state_whole_order,
 		co_estimate,co_eIncome,co_payment,co_settlement, co_third_create_time,
 		MAX(co_settle_time) AS co_settle_time, co_order_by, co_create_time,
-		co_update_time,co_state_desc,co_urank
+		co_update_time,co_state_desc,co_urank,co_child_source_type
 	</sql>
 	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
 		parameterType="java.lang.Long">
@@ -221,9 +229,9 @@
 	</delete>
 	<insert id="insert" parameterType="com.yeshi.fanli.entity.order.CommonOrder"
 		useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order
-		(co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_create_time,co_update_time,co_state_whole_order,co_order_by,co_trade_id,co_state_desc,co_urank)
+		(co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_create_time,co_update_time,co_state_whole_order,co_order_by,co_trade_id,co_state_desc,co_urank,co_child_source_type)
 		values
-		(#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{sourcePosition,jdbcType=VARCHAR},#{commonOrderGoods.id,jdbcType=BIGINT},#{count,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{estimate,jdbcType=DECIMAL},#{eIncome,jdbcType=DECIMAL},#{payment,jdbcType=DECIMAL},#{settlement,jdbcType=DECIMAL},#{thirdCreateTime,jdbcType=TIMESTAMP},#{settleTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{stateWholeOrder,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{tradeId,jdbcType=VARCHAR},#{stateDesc,jdbcType=VARCHAR},#{urank,jdbcType=INTEGER})
+		(#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{sourcePosition,jdbcType=VARCHAR},#{commonOrderGoods.id,jdbcType=BIGINT},#{count,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{estimate,jdbcType=DECIMAL},#{eIncome,jdbcType=DECIMAL},#{payment,jdbcType=DECIMAL},#{settlement,jdbcType=DECIMAL},#{thirdCreateTime,jdbcType=TIMESTAMP},#{settleTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{stateWholeOrder,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{tradeId,jdbcType=VARCHAR},#{stateDesc,jdbcType=VARCHAR},#{urank,jdbcType=INTEGER},#{childSourceType,jdbcType=VARCHAR})
 	</insert>
 	<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder"
 		useGeneratedKeys="true" keyProperty="id">
@@ -250,6 +258,7 @@
 			<if test="tradeId != null">co_trade_id,</if>
 			<if test="stateDesc != null">co_state_desc,</if>
 			<if test="urank != null">co_urank,</if>
+			<if test="childSourceType != null">co_child_source_type,</if>
 		</trim>
 		values
 		<trim prefix="(" suffix=")" suffixOverrides=",">
@@ -273,7 +282,8 @@
 			<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
 			<if test="tradeId != null">#{tradeId,jdbcType=VARCHAR},</if>
 			<if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR},</if>
-			<if test="urank != null">#{urank,jdbcType=INTEGER}</if>
+			<if test="urank != null">#{urank,jdbcType=INTEGER},</if>
+			<if test="childSourceType != null">#{childSourceType,jdbcType=VARCHAR},</if>
 		</trim>
 	</insert>
 	<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.CommonOrder">update
@@ -297,7 +307,8 @@
 		#{updateTime,jdbcType=TIMESTAMP} ,co_trade_id
 		=#{tradeId,jdbcType=VARCHAR},co_state_desc
 		=#{stateDesc,jdbcType=VARCHAR} ,co_urank =#{urank,jdbcType=INTEGER}
-		where co_id = #{id,jdbcType=BIGINT}
+		,co_child_source_type =#{childSourceType,jdbcType=VARCHAR} where co_id
+		= #{id,jdbcType=BIGINT}
 	</update>
 	<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder">
 		update yeshi_ec_common_order
@@ -323,10 +334,11 @@
 			<if test="orderBy != null">co_order_by=#{orderBy,jdbcType=INTEGER},</if>
 			<if test="createTime != null">co_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
 			<if test="updateTime != null">co_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
-			<if test="id !=null">co_id =#{id,jdbcType=BIGINT},</if>
 			<if test="tradeId !=null">co_trade_id =#{tradeId,jdbcType=VARCHAR},</if>
 			<if test="stateDesc !=null">co_state_desc =#{stateDesc,jdbcType=VARCHAR},</if>
 			<if test="urank !=null">co_urank =#{urank,jdbcType=INTEGER},</if>
+			<if test="childSourceType !=null">co_child_source_type=#{childSourceType,jdbcType=VARCHAR},
+			</if>
 		</set>
 		where co_id = #{id,jdbcType=BIGINT}
 	</update>
@@ -452,11 +464,11 @@
 		<!-- 璁㈠崟鍙锋煡璇� -->
 		<if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if>
 		<!-- 璁㈠崟鏉ユ簮 -->
-		<if test="listSource != null and listSource.size() > 0">
-			<foreach collection="listSource" item="item" open="AND (" close=")" separator="or">
-				co.co_source_type = #{item}
-			</foreach>
+		<if test="listSource != null and listSource.size() &gt; 0">
+			<foreach collection="listSource" item="item" open="AND ("
+				close=")" separator="or">co.co_source_type = #{item}</foreach>
 		</if>
+		<![CDATA[AND co.co_source_type <> 4 AND co.co_source_type <> 5]]>
 		GROUP BY co.`co_order_no`, co.`co_source_type` ORDER BY
 		co.co_third_create_time DESC LIMIT ${start},${count}
 	</select>
@@ -489,11 +501,11 @@
 		<!-- 璁㈠崟鍙锋煡璇� -->
 		<if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if>
 		<!-- 璁㈠崟鏉ユ簮 -->
-		<if test="listSource != null and listSource.size() > 0">
-			<foreach collection="listSource" item="item" open="AND (" close=")" separator="or">
-				co.co_source_type = #{item}
-			</foreach>
+		<if test="listSource != null and listSource.size() &gt; 0">
+			<foreach collection="listSource" item="item" open="AND ("
+				close=")" separator="or">co.co_source_type = #{item}</foreach>
 		</if>
+		<![CDATA[AND co.co_source_type <> 4 AND co.co_source_type <> 5]]>
 		GROUP BY co.`co_order_no`, co.`co_source_type` )A
 	</select>
 	<select id="listOrderGoodsInfo" resultMap="ResultMap"
@@ -626,10 +638,9 @@
 			'%Y%m'),DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1
 		</if>
 		<!-- 璁㈠崟鏉ユ簮 -->
-		<if test="listSource != null and listSource.size() > 0">
-			<foreach collection="listSource" item="item" open="AND (" close=")" separator="or">
-				co.co_source_type = #{item}
-			</foreach>
+		<if test="listSource != null and listSource.size() &gt; 0">
+			<foreach collection="listSource" item="item" open="AND ("
+				close=")" separator="or">co.co_source_type = #{item}</foreach>
 		</if>
 	</sql>
 	<select id="getOrderCount" resultMap="OrderCountMap">
@@ -810,11 +821,10 @@
 		<include refid="SELECT_PARAM_ORDER_CREATE_TIME" />
 		<!-- 璁㈠崟鏃堕棿 -->
 		<if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if>
-		
-		<if test="payment != null">
-			AND co.co_payment <![CDATA[<]]> #{payment}
+		<if test="payment != null">AND
+			co.co_payment <![CDATA[<]]>
+			#{payment}
 		</if>
-		
 		ORDER BY co.co_third_create_time DESC LIMIT ${start},${count}
 	</select>
 	<select id="countQueryByUid" resultType="java.lang.Long">
@@ -913,8 +923,9 @@
 		</if>
 		<!-- 璁㈠崟鏉ユ簮 -->
 		<if test="source != null">AND co.co_source_type = #{source}</if>
-		<if test="payment != null">
-			AND co.co_payment <![CDATA[<]]> #{payment}
+		<if test="payment != null">AND
+			co.co_payment <![CDATA[<]]>
+			#{payment}
 		</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
@@ -952,8 +963,9 @@
 			<foreach collection="listShopId" item="shopId" open=" and ("
 				separator=" or " close=")">g.`cog_shop_id` =#{shopId}</foreach>
 		</if>
-		<if test="payment != null">
-			AND co.co_payment <![CDATA[<]]> #{payment}
+		<if test="payment != null">AND
+			co.co_payment <![CDATA[<]]>
+			#{payment}
 		</if>
 		<if test="minTime != null">
 			<!-- 楂橀闄╄鍗� -->
@@ -979,8 +991,9 @@
 			<if test="keyType == 1 ">AND co.co_order_no = '${key}'</if>
 			<if test="keyType == 2 ">AND hb.hb_uid = ${key}</if>
 		</if>
-		<if test="payment != null">
-			AND co.co_payment <![CDATA[<]]> #{payment}
+		<if test="payment != null">AND
+			co.co_payment <![CDATA[<]]>
+			#{payment}
 		</if>
 		<!-- 璁㈠崟鏉ユ簮 -->
 		<if test="source != null">AND co.co_source_type = #{source}</if>
@@ -1086,40 +1099,135 @@
 		DATE_SUB(NOW(), INTERVAL 1 DAY) GROUP BY
 		co.`co_order_no`,co.`co_source_type`)A
 	</select>
-	
 	<select id="searchOrderByUid" resultMap="ResultMap">
-		SELECT COALESCE(SUM(hb.`hb_money`),0)AS totalMoney, hb.hb_state AS hongBaoState, hb.`hb_type` AS hongBaoType, 
-			MAX(hb.`hb_get_time`) AS accountTime, MAX(hb.`hb_pre_get_time`) AS preAccountTime, <include refid="Order_Column_List" />
-		FROM yeshi_ec_hongbao_order ho 
-		LEFT JOIN (SELECT <include refid="Hongbao_Column_List" /> FROM yeshi_ec_hongbao_v2 v2 
-				   WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<>10]]>)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`
-		WHERE hb.hb_id IS NOT NULL
-		<foreach collection="list" item="esOrder" open=" and ("	close=")" separator=" or ">
-			(co.co_trade_id=#{esOrder.tradeId} AND co.co_source_type = #{esOrder.platform})
+		SELECT COALESCE(SUM(hb.`hb_money`),0)AS totalMoney, hb.hb_state AS
+		hongBaoState, hb.`hb_type` AS hongBaoType, MAX(hb.`hb_get_time`) AS
+		accountTime, MAX(hb.`hb_pre_get_time`) AS preAccountTime,
+		<include refid="Order_Column_List" />
+		FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT
+		<include refid="Hongbao_Column_List" />
+		FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<>10]]>)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` WHERE
+		hb.hb_id IS NOT NULL
+		<foreach collection="list" item="esOrder" open=" and (" close=")"
+			separator=" or ">(co.co_trade_id=#{esOrder.tradeId} AND co.co_source_type =
+			#{esOrder.platform})
 		</foreach>
-		GROUP BY co.`co_order_no`, co.`co_source_type` 
-		ORDER BY co.co_third_create_time DESC 
-		LIMIT ${start},${count}
+		GROUP BY co.`co_order_no`, co.`co_source_type` ORDER BY
+		co.co_third_create_time DESC LIMIT ${start},${count}
 	</select>
-	
 	<select id="countSearchOrderByUid" resultType="java.lang.Long">
 		SELECT IFNULL(COUNT(ho_id),0) FROM (SELECT ho.ho_id FROM
-		yeshi_ec_hongbao_order ho LEFT JOIN (SELECT <include refid="Hongbao_Column_List" />
-			FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]>
+		yeshi_ec_hongbao_order ho LEFT JOIN (SELECT
+		<include refid="Hongbao_Column_List" />
+		FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]>
 		)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`
 		WHERE hb.hb_id IS NOT NULL
-		<foreach collection="list" item="esOrder" open=" and ("	close=")" separator=" or ">
-			(co.co_trade_id=#{esOrder.tradeId} AND co.co_source_type = #{esOrder.platform})
+		<foreach collection="list" item="esOrder" open=" and (" close=")"
+			separator=" or ">(co.co_trade_id=#{esOrder.tradeId} AND co.co_source_type =
+			#{esOrder.platform})
 		</foreach>
 		GROUP BY co.`co_order_no`, co.`co_source_type` )A
 	</select>
+	<select id="getMinSettleTimeAndUid" resultMap="BaseResultMap">SELECT
+		d.`co_uid`,MAX(d.`co_settle_time`) AS co_settle_time FROM
+		`yeshi_ec_common_order` d WHERE d.`co_settle_time` IS NOT NULL AND
+		d.`co_payment` &gt; 1 GROUP BY d.`co_uid`</select>
+	<select id="getOrderList" resultMap="ResultMap">
+		SELECT hb.`hb_type` AS hongBaoType, MAX(hb.`hb_get_time`) AS
+		accountTime, MAX(hb.`hb_pre_get_time`) AS preAccountTime,
+		<include refid="Order_Column_List" />
+		FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT
+		<include refid="Hongbao_Column_List" />
+		FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]>
+		<include refid="SELECT_PARAM_HONGBAO_TYPE" />
+		<if test="type == 2 and day == 5">
+			<!-- 鏈湀鏈堝皢瑕佸埌璐﹀垎浜鍗� -->
+			AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') =
+			DATE_FORMAT(CURDATE(),'%Y%m')
+		</if>
+		<if test="type == 3 and day == 5">
+			<!-- 鏈湀灏嗚鍒拌处閭�璇疯鍗� -->
+			AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') =
+			DATE_FORMAT(CURDATE(),'%Y%m')
+		</if>
+		<!-- 绾㈠寘绫诲瀷 -->
+		)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`
+		WHERE hb.hb_id IS NOT NULL
+		<include refid="SELECT_PARAM_ORDER_STATE" />
+		<!-- 璁㈠崟鐘舵�� -->
+		<include refid="SELECT_PARAM_ORDER_CREATE_TIME" />
+		<!-- 璁㈠崟鏃堕棿 -->
+		<include refid="SELECT_PARAM_HONGBAO_STATE" />
+		<!-- 璁㈠崟鍙锋煡璇� -->
+		<if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if>
+		<!-- 璁㈠崟鏉ユ簮 -->
+		<if test="listSource != null and listSource.size() &gt; 0">
+			<foreach collection="listSource" item="item" open="AND ("
+				close=")" separator="or">co.co_source_type = #{item}</foreach>
+		</if>
+		<if test="notBackSuVip == true">
+			<![CDATA[AND co.co_source_type <> 4 AND co.co_source_type <> 5]]>
+		</if>
+		GROUP BY co.`co_order_no`, co.`co_source_type` ORDER BY
+		co.co_third_create_time DESC LIMIT ${start},${count}
+	</select>
+	<select id="countOrderList" resultType="java.lang.Long">
+		SELECT IFNULL(COUNT(ho_id),0) FROM (SELECT ho.ho_id FROM
+		yeshi_ec_hongbao_order ho LEFT JOIN (SELECT
+		<include refid="Hongbao_Column_List" />
+		FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]>
+		<include refid="SELECT_PARAM_HONGBAO_TYPE" />
+		<!-- 绾㈠寘绫诲瀷 -->
+		<if test="type == 2 and day == 5">
+			<!-- 鏈湀鏈堝皢瑕佸埌璐﹀垎浜鍗� -->
+			AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') =
+			DATE_FORMAT(CURDATE(),'%Y%m')
+		</if>
+		<if test="type == 3 and day == 5">
+			<!-- 鏈湀灏嗚鍒拌处閭�璇疯鍗� -->
+			AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') =
+			DATE_FORMAT(CURDATE(),'%Y%m')
+		</if>
+		)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`
+		WHERE hb.hb_id IS NOT NULL
+		<include refid="SELECT_PARAM_ORDER_STATE" />
+		<!-- 璁㈠崟鐘舵�� -->
+		<include refid="SELECT_PARAM_ORDER_CREATE_TIME" />
+		<!-- 璁㈠崟鏃堕棿 -->
+		<include refid="SELECT_PARAM_HONGBAO_STATE" />
+		<!-- 璁㈠崟鍙锋煡璇� -->
+		<if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if>
+		<!-- 璁㈠崟鏉ユ簮 -->
+		<if test="listSource != null and listSource.size() &gt; 0">
+			<foreach collection="listSource" item="item" open="AND ("
+				close=")" separator="or">co.co_source_type = #{item}</foreach>
+		</if>
+		<if test="notBackSuVip == true">
+			<![CDATA[AND co.co_source_type <> 4 AND co.co_source_type <> 5]]>
+		</if>
+		GROUP BY co.`co_order_no`, co.`co_source_type` )A
+	</select>
+	<select id="countOrderByUidAndSettled" resultType="Long">SELECT
+		COUNT(d.`co_id`) FROM `yeshi_ec_common_order` d WHERE d.`co_uid` =
+		#{uid} AND d.`co_settle_time` IS NOT NULL AND d.`co_payment` &gt;=
+		#{payment}
+	</select>
 	
-	<select id="getMinSettleTimeAndUid" resultMap="BaseResultMap">
-		SELECT d.`co_uid`,MAX(d.`co_settle_time`) AS  co_settle_time FROM `yeshi_ec_common_order` d
-		WHERE d.`co_settle_time` IS NOT NULL AND d.`co_payment` > 1
-		GROUP BY d.`co_uid`
+	<select id="getNewestOrderNoByTaoBao" resultType="String">
+		SELECT d.`co_order_no` FROM `yeshi_ec_common_order` d
+		WHERE d.`co_source_type` = 1
+		ORDER BY d.`co_id` DESC
+		LIMIT 1
+	</select>
+	
+	<select id="listByOrderNo" resultMap="BaseResultMap">
+		SELECT * FROM `yeshi_ec_common_order` d
+		WHERE d.`co_order_no` = #{orderNo}
+		GROUP BY d.`co_order_no`,d.`co_source_type`
 	</select>
 </mapper>

--
Gitblit v1.8.0