From d1b7fd85615a78a476650e5acfc8b165a5deb3aa Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期五, 12 四月 2019 11:41:05 +0800
Subject: [PATCH] Merge branch 'div'

---
 fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml |   53 ++++++++++++++++++++++++++---------------------------
 1 files changed, 26 insertions(+), 27 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml
index 4c7c419..6f2c795 100644
--- a/fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml
+++ b/fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml
@@ -81,6 +81,12 @@
 	</select>
 
 
+<!-- 鏍规嵁閭�璇疯�匢D鏌ヨ鍏崇郴 -->
+	<select id="getByWorkerId" resultMap="BaseResultMap" parameterType="java.lang.Long">
+		select 	<include refid="Base_Column_List" /> from yeshi_ec_threeSale
+		where worker_id = #{0} AND t.state=0 AND (t.expire = 0 OR t.expire IS NULL)
+	</select>
+	
 
 	<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
 		yeshi_ec_threeSale where id = #{id,jdbcType=BIGINT}
@@ -390,21 +396,21 @@
 
 
 	<select id="listFirstTeam" resultMap="AllResultMap">
-		SELECT * FROM
-		`yeshi_ec_threesale` ts
+		SELECT * FROM `yeshi_ec_threesale` ts
 		LEFT JOIN `yeshi_ec_threesale_extra_info` ff
 		ON
 		ts.`boss_id` = ff.`tf_boss_id` AND ts.`worker_id`=ff.`tf_worker_id`
 		WHERE ts.`boss_id` = #{uid}
-		ORDER BY ts.state DESC, ts.expire,
-		ts.createTime DESC
+			<if test="state != null">
+				AND ts.`state` = #{state}
+			</if>
+		ORDER BY ts.state DESC, ts.expire, ts.createTime DESC
 		LIMIT ${start},${count}
 	</select>
 
 	<select id="countFirstTeam" resultType="java.lang.Long">
 		SELECT IFNULL(count(id),0) FROM `yeshi_ec_threesale`
-		WHERE `boss_id` =
-		#{uid}
+		WHERE `boss_id` = #{uid}
 		<if test="state != null">
 			AND `state` = #{state}
 		</if>
@@ -413,19 +419,14 @@
 
 	<select id="listSecondTeam" resultMap="AllResultMap">
 		SELECT yet.* FROM (
-		SELECT
-		DISTINCT(ts.`id`) AS id FROM `yeshi_ec_threesale` ts
-		LEFT JOIN
-		yeshi_ec_threesale tf ON ts.`boss_id`=tf.`worker_id`
-		WHERE tf.`boss_id`
-		= #{uid})A
-		LEFT JOIN yeshi_ec_threesale yet ON yet.id =
-		A.id
-		LEFT JOIN
-		`yeshi_ec_threesale_extra_info` ff
-		ON yet.`boss_id` =
-		ff.`tf_boss_id`
-		AND yet.`worker_id` =ff.`tf_worker_id`
+			SELECT DISTINCT(ts.`id`) AS id FROM `yeshi_ec_threesale` ts
+			LEFT JOIN yeshi_ec_threesale tf ON ts.`boss_id`=tf.`worker_id`
+			WHERE tf.`boss_id` = #{uid})A
+		LEFT JOIN yeshi_ec_threesale yet ON yet.id = A.id
+		WHERE 1=1
+			<if test="state != null">
+				AND yet.`state` = #{state}
+			</if>
 		ORDER BY
 		yet.state DESC,
 		yet.expire, yet.createTime DESC
@@ -434,14 +435,12 @@
 
 	<select id="countSecondTeam" resultType="java.lang.Long">
 		SELECT COUNT(A.id) FROM (
-		SELECT DISTINCT(ts.`id`) AS id FROM
-		`yeshi_ec_threesale` ts
-		LEFT JOIN yeshi_ec_threesale tf ON
-		ts.`boss_id`=tf.`worker_id`
-		WHERE tf.`boss_id` = #{uid}
-		<if test="state != null">
-			AND ts.`state` = #{state}
-		</if>
+			SELECT DISTINCT(ts.`id`) AS id FROM `yeshi_ec_threesale` ts
+			LEFT JOIN yeshi_ec_threesale tf ON ts.`boss_id`=tf.`worker_id`
+			WHERE tf.`boss_id` = #{uid}
+			<if test="state != null">
+				AND ts.`state` = #{state}
+			</if>
 		)A
 	</select>
 

--
Gitblit v1.8.0