From 00026c4255ed1b47961d17a5b4500fe788bfa9d8 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期二, 17 九月 2019 09:45:50 +0800
Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div

---
 fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml |  744 ++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 418 insertions(+), 326 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml
index 28db7a0..644470a 100644
--- a/fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml
+++ b/fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml
@@ -30,7 +30,7 @@
 		<!-- <association property="system" column="sid" resultMap="com.yeshi.fanli.dao.mybatis.SystemMapper.BaseResultMap" 
 			/> -->
 	</resultMap>
-	
+
 	<resultMap id="BaseResultMapVO" type="com.yeshi.fanli.vo.user.UserInfoVO">
 		<id column="id" property="id" jdbcType="BIGINT" />
 		<result column="identifycode" property="openid" jdbcType="VARCHAR" />
@@ -38,7 +38,8 @@
 		<result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR" />
 		<result column="wx_union_id" property="wxUnionId" jdbcType="VARCHAR" />
 		<result column="nick_name" property="nickName" jdbcType="VARCHAR" />
-		<result column="uiet_taobao_nick_name" property="tbName" jdbcType="VARCHAR" />
+		<result column="uiet_taobao_nick_name" property="tbName"
+			jdbcType="VARCHAR" />
 		<result column="tbPic" property="tbPic" jdbcType="VARCHAR" />
 		<result column="wxName" property="wxName" jdbcType="VARCHAR" />
 		<result column="wxPic" property="wxPic" jdbcType="VARCHAR" />
@@ -56,42 +57,49 @@
 		<result column="phone" property="phone" jdbcType="VARCHAR" />
 		<result column="state" property="state" jdbcType="INTEGER" />
 		<result column="state_desc" property="stateDesc" jdbcType="VARCHAR" />
-		
+
 		<result column="ur_id" property="rankId" jdbcType="BIGINT" />
-		<result column="ur_name" property="rankName"	jdbcType="VARCHAR" />
-		<result column="ur_picture" property="rankPicture"	jdbcType="VARCHAR" />
-		
-		<result column="totalOrder" property="totalOrder"	jdbcType="BIGINT" />
-		<result column="monthOrder" property="monthOrder"	jdbcType="BIGINT" />
-		
-		<result column="uiet_special_id" property="tbSpecialId"	jdbcType="VARCHAR" />
-		<result column="uiet_relation_id" property="tbRelationId"	jdbcType="VARCHAR" />
-		<result column="uiet_taobao_uid" property="taoBaoUid"	jdbcType="VARCHAR" />
-		
-		<result column="wxUnionIdInvalid" property="wxUnionIdInvalid"	jdbcType="VARCHAR" />
-		<result column="taobaoUidInvalid" property="taobaoUidInvalid"	jdbcType="VARCHAR" />
-		<result column="phoneInvalid" property="phoneInvalid"	jdbcType="VARCHAR" />
-		<result column="alipayAccountInvalid" property="alipayAccountInvalid"	jdbcType="VARCHAR" />
-		
-		<result column="uie_gold_coin" property="goldCoin"	jdbcType="INTEGER" />
+		<result column="ur_name" property="rankName" jdbcType="VARCHAR" />
+		<result column="ur_picture" property="rankPicture" jdbcType="VARCHAR" />
+
+		<result column="totalOrder" property="totalOrder" jdbcType="BIGINT" />
+		<result column="monthOrder" property="monthOrder" jdbcType="BIGINT" />
+
+		<result column="uiet_special_id" property="tbSpecialId"
+			jdbcType="VARCHAR" />
+		<result column="uiet_relation_id" property="tbRelationId"
+			jdbcType="VARCHAR" />
+		<result column="uiet_taobao_uid" property="taoBaoUid" jdbcType="VARCHAR" />
+
+		<result column="wxUnionIdInvalid" property="wxUnionIdInvalid"
+			jdbcType="VARCHAR" />
+		<result column="taobaoUidInvalid" property="taobaoUidInvalid"
+			jdbcType="VARCHAR" />
+		<result column="phoneInvalid" property="phoneInvalid" jdbcType="VARCHAR" />
+		<result column="alipayAccountInvalid" property="alipayAccountInvalid"
+			jdbcType="VARCHAR" />
+
+		<result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER" />
 	</resultMap>
-	
+
 	<sql id="Base_Column_List">id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,tuiguang_code,appid,my_hongBao,pay_password,sid,rank,phone,state,state_desc
 	</sql>
+	<!-- 涓嶈兘鏌ヨ缂撳瓨 -->
 	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
-		parameterType="java.lang.Long">
+		parameterType="java.lang.Long" flushCache="true" useCache="false">
+		select
+		<include refid="Base_Column_List" />
+		from yeshi_ec_user where id = #{id,jdbcType=BIGINT}
+	</select>
+	
+		<!-- 涓嶈兘鏌ヨ缂撳瓨 -->
+	<select id="selectAvailableByPrimaryKey" resultMap="BaseResultMap"
+		parameterType="java.lang.Long" flushCache="true" useCache="false">
 		select
 		<include refid="Base_Column_List" />
 		from yeshi_ec_user where id = #{id,jdbcType=BIGINT} and `state`=0
 	</select>
-	
-	<select id="selectByPKey" resultMap="BaseResultMap"
-		parameterType="java.lang.Long">
-		select
-		<include refid="Base_Column_List" />
-		from yeshi_ec_user where id = #{id,jdbcType=BIGINT} 
-	</select>
-	
+
 	<select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap"
 		parameterType="java.lang.Long">
 		select
@@ -245,361 +253,445 @@
 	<select id="listByAppIdAndPhone" resultMap="BaseResultMap">
 		select
 		<include refid="Base_Column_List" />
-		from yeshi_ec_user where appid=#{appId} and phone=#{phone} 
+		from yeshi_ec_user where appid=#{appId} and phone=#{phone}
 	</select>
-	
+
 	<!-- 鏍规嵁AppId涓庣數璇濆彿鐮佽幏鍙栫敤鎴� -->
 	<select id="getEffectiveUserInfoByPhone" resultMap="BaseResultMap">
-		select <include refid="Base_Column_List" /> from yeshi_ec_user 
-		where phone=#{phone} AND state = 0 
-		LIMIT 1 
+		select
+		<include refid="Base_Column_List" />
+		from yeshi_ec_user
+		where phone=#{phone} AND state = 0
+		LIMIT 1
 	</select>
-	
+
 	<!-- 鏍规嵁AppId涓庣數璇濆彿鐮佽幏鍙栫敤鎴� -->
 	<select id="getEffectiveUserInfoByWXUnionId" resultMap="BaseResultMap">
-		select <include refid="Base_Column_List" /> from yeshi_ec_user 
-		where wx_union_id=#{unionId} AND state = 0 
-		LIMIT 1 
+		select
+		<include refid="Base_Column_List" />
+		from yeshi_ec_user
+		where wx_union_id=#{unionId} AND state = 0
+		LIMIT 1
 	</select>
-	
+
 	<select id="getMaxUid" resultType="java.lang.Long">select max(id) from
 		yeshi_ec_user
 	</select>
 	<!-- 涓や釜璐﹀彿鐨勪笟鍔¤瀺鍚� -->
-	<select id="connectUser" >
-     call procedure_connect_user(#{mainUid},#{lessUid})
+	<select id="connectUser">
+		call procedure_connect_user(#{mainUid},#{lessUid})
 	</select>
-	
-	<select id="query"  resultMap="BaseResultMapVO">
-	   	SELECT *
-	   	,(SELECT COUNT(hb.hb_id) FROM `yeshi_ec_hongbao_v2` hb 
-	   			WHERE hb.hb_uid = u.id AND hb.hb_type = 1 )AS totalOrder <!-- 绱璁㈠崟 -->
-   		,(SELECT COUNT(hb.hb_id) FROM `yeshi_ec_hongbao_v2` hb 
-	   			WHERE hb.hb_uid = u.id AND hb.hb_type = 1
-	   			AND DATE_FORMAT(hb.`hb_create_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m'))AS monthOrder <!-- 绱鏈湀璁㈠崟 -->
-    	,(SELECT COUNT(tr.`id`) FROM `yeshi_ec_threesale` tr  <!-- 闃熷憳 -->
-    		 WHERE  tr.`boss_id`=u.id AND tr.state = 1) AS totalPlayers 
-	   	FROM yeshi_ec_user u 
-	   		LEFT JOIN yeshi_ec_binding_account  b ON u.`id` = b.`uid`  
-	   		LEFT JOIN yeshi_ec_user_info_extra  ext ON u.`id` = ext.uie_uid
-	   		LEFT JOIN yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id
-	   		LEFT JOIN yeshi_ec_user_info_extra_taobao tb ON  tb.`uiet_uid` = u.id
-	    
-	    <if test="userState == 2">
-	   		LEFT JOIN 
-				(SELECT A.uid AS buid,MAX(A.f_wxUnionId) AS wxUnionIdInvalid ,MAX(A.f_taobaoUid) AS taobaoUidInvalid,MAX(A.f_phone) AS phoneInvalid,MAX(A.f_alipayAccount) AS alipayAccountInvalid FROM 
-					(SELECT u.`id`AS uid,b.account AS alipayAccount,b.name AS alipayAccountName,fu.* FROM yeshi_ec_user u 
-				LEFT JOIN yeshi_ec_binding_account b ON b.`uid` = u.`id`
-				LEFT JOIN yeshi_ec_user_info_extra_taobao tb ON  tb.`uiet_uid` = u.id
-				LEFT JOIN (SELECT fc.fuc_effective,IF(fc.`fuc_type` = 'wxUnionId',fc.`fuc_identify_code`,NULL)AS f_wxUnionId,
-					IF(fc.`fuc_type` = 'taobaoUid',fc.`fuc_identify_code`,NULL)AS f_taobaoUid,
-					IF(fc.`fuc_type` = 'phone',fc.`fuc_identify_code`,NULL)AS f_phone,
-					IF(fc.`fuc_type` = 'alipayAccount',fc.`fuc_identify_code`,NULL)AS f_alipayAccount
-				FROM yeshi_ec_forbidden_user_identify_code fc WHERE fc.fuc_effective = 1 )fu ON (fu.f_wxUnionId = u.`wx_union_id` OR fu.f_taobaoUid = tb.`uiet_taobao_uid` OR fu.f_phone = u.`phone` OR fu.f_alipayAccount = b.`account`)
-				WHERE u.`state` =2  
-			)A GROUP BY A.uid) B ON u.id= B.buid 
-	   	</if>
-	   	
-	   	where 1=1
-	   		<if test="userState == 1">
-	   			AND u.`state` <![CDATA[<>]]> 2 <!--  姝e父鐢ㄦ埛 -->
-	   		</if>
-	  	 	<if test="userState == 2">
-	   			 AND u.`state` =2   <!-- 灏佺鐢ㄦ埛 -->
-	   		</if>
-	   		<if test="startTime != null and startTime !='' ">
-	   			AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]> DATE_FORMAT(#{startTime},'%Y%m%d')
-	   		</if>
-	   		<if test="endTime != null and endTime !=''">
-	   			AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]> DATE_FORMAT(#{endTime},'%Y%m%d') 
-	   		</if>
-	   	   	<if test="userRank != null">
-	   			AND rak.ur_name = #{userRank}
-	   		</if>
-		   	<if test="days != null">
-				    <!--  娉ㄥ唽鏃堕棿   -->
-		   	 	AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(u.createtime/1000)]]> 
+
+	<select id="query" resultMap="BaseResultMapVO">
+		SELECT *
+		,(SELECT COUNT(hb.hb_id) FROM `yeshi_ec_hongbao_v2` hb
+		WHERE
+		hb.hb_uid = u.id AND hb.hb_type = 1 )AS totalOrder <!-- 绱璁㈠崟 -->
+		,(SELECT COUNT(hb.hb_id) FROM `yeshi_ec_hongbao_v2` hb
+		WHERE hb.hb_uid
+		= u.id AND hb.hb_type = 1
+		AND DATE_FORMAT(hb.`hb_create_time`,'%Y%m') =
+		DATE_FORMAT(CURDATE(),'%Y%m'))AS monthOrder <!-- 绱鏈湀璁㈠崟 -->
+		,(SELECT COUNT(tr.`id`) FROM `yeshi_ec_threesale` tr  <!-- 闃熷憳 -->
+		WHERE tr.`boss_id`=u.id AND tr.state = 1) AS totalPlayers
+		FROM
+		yeshi_ec_user u
+		LEFT JOIN yeshi_ec_binding_account b ON u.`id` =
+		b.`uid`
+		LEFT JOIN yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid
+		LEFT JOIN yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id
+		LEFT
+		JOIN yeshi_ec_user_info_extra_taobao tb ON tb.`uiet_uid` = u.id
+
+		<if test="userState == 2">
+			LEFT JOIN
+			(SELECT A.uid AS buid,MAX(A.f_wxUnionId) AS
+			wxUnionIdInvalid
+			,MAX(A.f_taobaoUid) AS
+			taobaoUidInvalid,MAX(A.f_phone) AS
+			phoneInvalid,MAX(A.f_alipayAccount) AS alipayAccountInvalid FROM
+			(SELECT u.`id`AS uid,b.account AS alipayAccount,b.name AS
+			alipayAccountName,fu.* FROM yeshi_ec_user u
+			LEFT JOIN
+			yeshi_ec_binding_account b ON b.`uid` = u.`id`
+			LEFT JOIN
+			yeshi_ec_user_info_extra_taobao tb ON tb.`uiet_uid` = u.id
+			LEFT JOIN
+			(SELECT fc.fuc_effective,IF(fc.`fuc_type` =
+			'wxUnionId',fc.`fuc_identify_code`,NULL)AS f_wxUnionId,
+			IF(fc.`fuc_type` = 'taobaoUid',fc.`fuc_identify_code`,NULL)AS
+			f_taobaoUid,
+			IF(fc.`fuc_type` = 'phone',fc.`fuc_identify_code`,NULL)AS
+			f_phone,
+			IF(fc.`fuc_type` =
+			'alipayAccount',fc.`fuc_identify_code`,NULL)AS f_alipayAccount
+			FROM
+			yeshi_ec_forbidden_user_identify_code fc WHERE fc.fuc_effective
+			= 1
+			)fu ON (fu.f_wxUnionId = u.`wx_union_id` OR fu.f_taobaoUid =
+			tb.`uiet_taobao_uid` OR fu.f_phone = u.`phone` OR fu.f_alipayAccount
+			= b.`account`)
+			WHERE u.`state` =2
+			)A GROUP BY A.uid) B ON u.id= B.buid
+		</if>
+
+		where 1=1
+		<if test="userState == 1">
+			AND u.`state` <![CDATA[<>]]>
+			2 <!-- 姝e父鐢ㄦ埛 -->
+		</if>
+		<if test="userState == 2">
+			AND u.`state` =2   <!-- 灏佺鐢ㄦ埛 -->
+		</if>
+		<if test="startTime != null and startTime !='' ">
+			AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]>
+			DATE_FORMAT(#{startTime},'%Y%m%d')
+		</if>
+		<if test="endTime != null and endTime !=''">
+			AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]>
+			DATE_FORMAT(#{endTime},'%Y%m%d')
+		</if>
+		<if test="userRank != null">
+			AND rak.ur_name = #{userRank}
+		</if>
+		<if test="days != null">
+			<!-- 娉ㄥ唽鏃堕棿 -->
+			AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(u.createtime/1000)]]>
+		</if>
+		<if test="key != null and key !='' ">
+			<if test="keyType == 1">
+				AND u.id = #{key}
 			</if>
-	   		<if test="key != null and key !='' ">
-	   			<if test="keyType == 1">
-	   				AND	u.id  = #{key}
-	   			</if>
-	   			<if test="keyType == 2">
-	   				AND	u.`nick_name` LIKE '%${key}%'
-	   			</if>
-	   			<if test="keyType == 3">
-	   				AND	u.`phone` = #{key}
-	   			</if>
-	   			<if test="keyType == 4">
-	   				AND	b.`account` = #{key}
-	   			</if>
-	   	    </if>
-	   	   
-	   	   ORDER BY 
-	   	   <if test="orderField == 1">
-	   	  	 totalOrder,
-	   	   </if>
-	   	   <if test="orderField == 2">
-	   	  	 totalOrder DESC,
-	   	   </if>
-	   	   <if test="orderField == 3">
-	   	  	 monthOrder,
-	   	   </if>
-	   	   <if test="orderField == 4">
-	   	  	 monthOrder DESC,
-	   	   </if>
-	   	   <if test="orderField == 5">
-	   	  	 totalPlayers,
-	   	   </if>
-	   	   <if test="orderField == 6">
-	   	  	 totalPlayers DESC,
-	   	   </if>
-	   	   u.createtime DESC  
-	   	   
-	   	   LIMIT ${start},${count}
+			<if test="keyType == 2">
+				AND u.`nick_name` LIKE '%${key}%'
+			</if>
+			<if test="keyType == 3">
+				AND u.`phone` = #{key}
+			</if>
+			<if test="keyType == 4">
+				AND b.`account` = #{key}
+			</if>
+		</if>
+
+		ORDER BY
+		<if test="orderField == 1">
+			totalOrder,
+		</if>
+		<if test="orderField == 2">
+			totalOrder DESC,
+		</if>
+		<if test="orderField == 3">
+			monthOrder,
+		</if>
+		<if test="orderField == 4">
+			monthOrder DESC,
+		</if>
+		<if test="orderField == 5">
+			totalPlayers,
+		</if>
+		<if test="orderField == 6">
+			totalPlayers DESC,
+		</if>
+		u.createtime DESC
+
+		LIMIT ${start},${count}
 	</select>
-	
+
 	<select id="queryCount" resultType="java.lang.Long">
-	   	SELECT IFNULL(count(u.id),0) FROM yeshi_ec_user u 
-	   		LEFT JOIN yeshi_ec_binding_account  b ON u.`id` = b.`uid`  
-	   		LEFT JOIN yeshi_ec_user_info_extra  ext ON u.`id` = ext.uie_uid
-	   		LEFT JOIN yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id
-	   	where 1=1
-	   	
-	   	 	<if test="userState == 1">
-	   			AND u.`state` <![CDATA[<>]]> 2 <!--  姝e父鐢ㄦ埛 -->
-	   		</if>
-	  	 	<if test="userState == 2">
-	   			 AND u.`state` =2   <!-- 灏佺鐢ㄦ埛 -->
-	   		</if>
-	   	     <if test="startTime != null and startTime !='' ">
-	   			AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]> DATE_FORMAT(#{startTime},'%Y%m%d')
-	   		 </if>
-	   		 <if test="endTime != null and endTime !=''">
-	   			AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]> DATE_FORMAT(#{endTime},'%Y%m%d') 
-	   		 </if>
-	   	   	 <if test="userRank != null">
-	   			AND rak.ur_name = #{userRank}
-	   		 </if>
-		   	 <if test="days != null">  <!--  娉ㄥ唽鏃堕棿   -->
-		   	 	AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(u.createtime/1000)]]> 
-			 </if>
-			 
-			 <if test="key != null and key !='' ">
-	   			<if test="keyType == 1">
-	   				AND	u.id  = #{key}
-	   			</if>
-	   			<if test="keyType == 2">
-	   				AND	u.`nick_name` LIKE '%${key}%'
-	   			</if>
-	   			<if test="keyType == 3">
-	   				AND	u.`phone` = #{key}
-	   			</if>
-	   			<if test="keyType == 4">
-	   				AND	b.`account` = #{key}
-	   			</if>
-	   	    </if>
+		SELECT IFNULL(count(u.id),0) FROM yeshi_ec_user u
+		LEFT JOIN
+		yeshi_ec_binding_account b ON u.`id` = b.`uid`
+		LEFT JOIN
+		yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid
+		LEFT JOIN
+		yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id
+		where 1=1
+
+		<if test="userState == 1">
+			AND u.`state` <![CDATA[<>]]>
+			2 <!-- 姝e父鐢ㄦ埛 -->
+		</if>
+		<if test="userState == 2">
+			AND u.`state` =2   <!-- 灏佺鐢ㄦ埛 -->
+		</if>
+		<if test="startTime != null and startTime !='' ">
+			AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[>=]]>
+			DATE_FORMAT(#{startTime},'%Y%m%d')
+		</if>
+		<if test="endTime != null and endTime !=''">
+			AND DATE_FORMAT(FROM_UNIXTIME(u.createtime/1000),'%Y%m%d')<![CDATA[<=]]>
+			DATE_FORMAT(#{endTime},'%Y%m%d')
+		</if>
+		<if test="userRank != null">
+			AND rak.ur_name = #{userRank}
+		</if>
+		<if test="days != null">  <!-- 娉ㄥ唽鏃堕棿 -->
+			AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(u.createtime/1000)]]>
+		</if>
+
+		<if test="key != null and key !='' ">
+			<if test="keyType == 1">
+				AND u.id = #{key}
+			</if>
+			<if test="keyType == 2">
+				AND u.`nick_name` LIKE '%${key}%'
+			</if>
+			<if test="keyType == 3">
+				AND u.`phone` = #{key}
+			</if>
+			<if test="keyType == 4">
+				AND b.`account` = #{key}
+			</if>
+		</if>
 	</select>
-	
+
 	<select id="querySumMoney" resultType="java.lang.Double">
-	   	SELECT COALESCE(sum(u.my_hongBao),0) FROM yeshi_ec_user u 
-	   		LEFT JOIN yeshi_ec_binding_account  b ON u.`id` = b.`uid`  
-	   	where <![CDATA[ 1>0 ]]>  
-	   		 <if test="key != null and key !='' ">
-	   			AND	(u.id LIKE '%${key}%' OR u.`phone` LIKE '%${key}%'  OR u.`wxName` LIKE '%${key}%'
-	   			OR u.`nick_name` LIKE '%${key}%'  OR u.`tbName` LIKE '%${key}%' OR b.`account` LIKE '%${key}%')
-	   	     </if>
-	   	     <if test="startTime != null and startTime !='' ">
-	   			<![CDATA[ AND FROM_UNIXTIME(createtime/1000) >= '${startTime}' ]]>  
-	   		 </if>
-	   		 <if test="endTime != null and endTime !=''">
-	   			<![CDATA[ AND FROM_UNIXTIME(createtime/1000) < '${endTime}'  ]]>  
-	   		 </if>
-	   	   	 <if test="userType != null">
-	   			AND u.rank = #{userType}
-	   		 </if>
-	   	   	<if test="days != null">
-			    <!--  鏃堕棿   -->
-	   	 		AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(createtime/1000)]]> 
-			</if>
+		SELECT COALESCE(sum(u.my_hongBao),0) FROM yeshi_ec_user u
+		LEFT JOIN
+		yeshi_ec_binding_account b ON u.`id` = b.`uid`
+		where <![CDATA[ 1>0 ]]>
+		<if test="key != null and key !='' ">
+			AND (u.id LIKE '%${key}%' OR u.`phone` LIKE '%${key}%' OR
+			u.`wxName`
+			LIKE '%${key}%'
+			OR u.`nick_name` LIKE '%${key}%' OR
+			u.`tbName` LIKE '%${key}%' OR
+			b.`account` LIKE '%${key}%')
+		</if>
+		<if test="startTime != null and startTime !='' ">
+	   			<![CDATA[ AND FROM_UNIXTIME(createtime/1000) >= '${startTime}' ]]>
+		</if>
+		<if test="endTime != null and endTime !=''">
+	   			<![CDATA[ AND FROM_UNIXTIME(createtime/1000) < '${endTime}'  ]]>
+		</if>
+		<if test="userType != null">
+			AND u.rank = #{userType}
+		</if>
+		<if test="days != null">
+			<!-- 鏃堕棿 -->
+			AND <![CDATA[DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(createtime/1000)]]>
+		</if>
 	</select>
-	
-	
+
+
 	<select id="countNewUser" resultType="java.lang.Long">
-	   	SELECT COALESCE(count(id),0) FROM `yeshi_ec_user` 
-	   	WHERE 1=1
-   			 <if test="isToday != null and isToday == 1">
-		    	AND TO_DAYS(FROM_UNIXTIME(createtime/1000)) = TO_DAYS(NOW())
-	        </if>
-	        <if test="isMonth != null and isMonth == 1">
-			    AND DATE_FORMAT( FROM_UNIXTIME(createtime/1000), '%Y%m' ) = DATE_FORMAT(CURDATE() , '%Y%m' )
-		    </if>
+		SELECT COALESCE(count(id),0) FROM `yeshi_ec_user`
+		WHERE 1=1
+		<if test="isToday != null and isToday == 1">
+			AND TO_DAYS(FROM_UNIXTIME(createtime/1000)) =
+			TO_DAYS(NOW())
+		</if>
+		<if test="isMonth != null and isMonth == 1">
+			AND DATE_FORMAT( FROM_UNIXTIME(createtime/1000), '%Y%m' )
+			=
+			DATE_FORMAT(CURDATE() , '%Y%m' )
+		</if>
 	</select>
-	
+
 	<select id="countRank" resultType="java.lang.Long">
-	   <!--  绛夌骇缁熻 -->
-	   	SELECT COALESCE(count(id),0) FROM `yeshi_ec_user` WHERE rank = #{rank}
+		<!-- 绛夌骇缁熻 -->
+		SELECT COALESCE(count(id),0) FROM `yeshi_ec_user` WHERE rank = #{rank}
 	</select>
-	
+
 	<select id="countAllMoney" resultType="java.math.BigDecimal">
-	   <!--  閲戦缁熻 -->
-	   	SELECT CAST(SUM(my_hongBao)AS DECIMAL(19,2)) FROM `yeshi_ec_user` 
-	   	WHERE 1=1 
-	   		<if test="minMoney != null">
-			  AND <![CDATA[ my_hongBao >= #{minMoney}]]> 
-			</if>
+		<!-- 閲戦缁熻 -->
+		SELECT CAST(SUM(my_hongBao)AS DECIMAL(19,2)) FROM `yeshi_ec_user`
+		WHERE 1=1
+		<if test="minMoney != null">
+			AND <![CDATA[ my_hongBao >= #{minMoney}]]>
+		</if>
 	</select>
-	
+
 	<select id="countShareAndInviteMoney" resultMap="BaseResultMap">
-		SELECT IFNULL(SUM(h.`money`),0),h.`uid` FROM `yeshi_ec_hongbao` h 
-		WHERE  DATE_FORMAT(FROM_UNIXTIME(h.`createtime`/1000), '%Y-%m-%d' )= '2018-08-02'
-		<![CDATA[AND h.state <>4]]> 
-		 AND ( h.`type` =5 OR  h.`type` =6 OR h.`type` =7 OR  h.`type` =20 OR h.`type` =21 OR h.`type` =22 )
-		GROUP BY h.`uid` 
-		ORDER BY SUM(h.`money`) DESC
- 	    LIMIT ${start},${count}
+		SELECT IFNULL(SUM(h.`money`),0),h.`uid` FROM `yeshi_ec_hongbao` h
+		WHERE DATE_FORMAT(FROM_UNIXTIME(h.`createtime`/1000), '%Y-%m-%d' )=
+		'2018-08-02'
+		<![CDATA[AND h.state <>4]]>
+		AND ( h.`type` =5 OR h.`type` =6 OR h.`type` =7 OR h.`type` =20 OR
+		h.`type` =21 OR h.`type` =22 )
+		GROUP BY h.`uid`
+		ORDER BY SUM(h.`money`)
+		DESC
+		LIMIT ${start},${count}
 	</select>
-	
-	<select id="longTimeNoLogin"  resultType="java.lang.Long">
-	
-		SELECT u.`id` FROM `yeshi_ec_user` u 
-		WHERE  u.`id` IN <foreach item="item" collection="list" open="(" separator=","
+
+	<select id="longTimeNoLogin" resultType="java.lang.Long">
+
+		SELECT u.`id` FROM `yeshi_ec_user` u
+		WHERE u.`id` IN
+		<foreach item="item" collection="list" open="(" separator=","
 			close=")">#{item}</foreach>
 		AND <![CDATA[ (DATE_SUB(CURDATE(), INTERVAL ${daysNum} DAY) > DATE(FROM_UNIXTIME(u.`last_logintime`/1000))  
 			OR (u.`last_logintime` IS NULL 
 				AND DATE_SUB(CURDATE(), INTERVAL ${daysNum} DAY) > DATE(FROM_UNIXTIME(u.`createTime`/1000)))) ]]>
 	</select>
-	
-	
+
+
 	<select id="countLoseUser" resultType="java.lang.Long">
-		SELECT  COUNT(DISTINCT t.`id` ) FROM `yeshi_ec_user` t 
-		LEFT JOIN `yeshi_ec_user_money_detail` d ON d.`umd_uid` = t.`id` 
-		WHERE DATE_SUB(CURDATE(), INTERVAL ${num} DAY)<![CDATA[> ]]> DATE(FROM_UNIXTIME( t.`last_logintime`/1000)) 
-    	 	  AND DATE_SUB(CURDATE(), INTERVAL ${num} DAY) <![CDATA[> ]]> DATE(d.`umd_createtime`)
+		SELECT COUNT(DISTINCT t.`id` ) FROM `yeshi_ec_user` t
+		LEFT JOIN
+		`yeshi_ec_user_money_detail` d ON d.`umd_uid` = t.`id`
+		WHERE
+		DATE_SUB(CURDATE(), INTERVAL ${num} DAY)<![CDATA[> ]]>
+		DATE(FROM_UNIXTIME( t.`last_logintime`/1000))
+		AND DATE_SUB(CURDATE(),
+		INTERVAL ${num} DAY) <![CDATA[> ]]>
+		DATE(d.`umd_createtime`)
 	</select>
-	
+
 	<select id="countHasOrderUser" resultType="java.lang.Long">
-		SELECT COUNT(DISTINCT h.`hb_uid`) FROM yeshi_ec_hongbao_v2 h 
-		WHERE (h.`hb_type`=1 or  h.`hb_type`=2 or h.`hb_type`= 20)
+		SELECT COUNT(DISTINCT
+		h.`hb_uid`) FROM yeshi_ec_hongbao_v2 h
+		WHERE (h.`hb_type`=1 or
+		h.`hb_type`=2 or h.`hb_type`= 20)
 	</select>
-	
-	
+
+
 	<select id="countNewUserByDate" resultType="java.util.HashMap">
 		SELECT COUNT(DISTINCT h.`id`) AS showValue,
-			<if test="type == 1">
-			 	FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') AS 'showDate'
-			</if>
-			<if test="type == 2">
-			 	FROM_UNIXTIME(h.`createtime`/1000,'%m') AS 'showDate'
-			</if>
-			<if test="type == 3">
-			 	FROM_UNIXTIME(h.`createtime`/1000,'%Y') AS 'showDate'
-			</if>
-		FROM yeshi_ec_user h 
-			<if test="channel != null and  channel != 'all' ">
-				left join (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active`  a 
-		    	WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`)a ON h.`id`=a.uid 
-		    </if>
-		WHERE 1=1
-			<if test="channel != null and  channel != 'all' ">
-				AND a.uid is not null
-			</if>
-			<if test="startTime != null and startTime != '' ">
-		 		AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
-			</if>
-			<if test="endTime != null and endTime != '' ">
-			 	AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
-			</if>
-			<if test="years != null and years != '' ">
-			 	AND FROM_UNIXTIME(h.`createtime`/1000,'%Y') = '${years}'
-			</if>
 		<if test="type == 1">
-			GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') 
+			FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') AS
+			'showDate'
 		</if>
 		<if test="type == 2">
-		 	GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m') 
+			FROM_UNIXTIME(h.`createtime`/1000,'%m') AS 'showDate'
 		</if>
 		<if test="type == 3">
-		 	GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y') 
-		</if>		
+			FROM_UNIXTIME(h.`createtime`/1000,'%Y') AS 'showDate'
+		</if>
+		FROM yeshi_ec_user h
+		<if test="channel != null and  channel != 'all' ">
+			left join (SELECT a.`lua_uid` AS uid FROM
+			`yeshi_ec_log_user_active` a
+			WHERE a.`lua_channel`='${channel}' GROUP
+			BY a.`lua_uid`)a ON
+			h.`id`=a.uid
+		</if>
+		WHERE 1=1
+		<if test="channel != null and  channel != 'all' ">
+			AND a.uid is not null
+		</if>
+		<if test="startTime != null and startTime != '' ">
+			AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
+		</if>
+		<if test="endTime != null and endTime != '' ">
+			AND FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]>
+			'${endTime}'
+		</if>
+		<if test="years != null and years != '' ">
+			AND FROM_UNIXTIME(h.`createtime`/1000,'%Y') = '${years}'
+		</if>
+		<if test="type == 1">
+			GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m-%d')
+		</if>
+		<if test="type == 2">
+			GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y-%m')
+		</if>
+		<if test="type == 3">
+			GROUP BY FROM_UNIXTIME(h.`createtime`/1000,'%Y')
+		</if>
 		ORDER BY h.`createtime`
 	</select>
-	
+
 	<select id="getTodayHasOrder" resultType="java.util.HashMap">
-		SELECT COALESCE(COUNT(DISTINCT u.`id`),0) AS 'showValue', 
-			<if test="type == 1">
-			 	FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate'
-			</if>
-			<if test="type == 2">
-			 	FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'showDate'
-			</if>
-			<if test="type == 3">
-			 	FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'showDate'
-			</if>
-		
-		FROM  yeshi_ec_user u 	
-		<if test="channel != null and channel != 'all' ">
-			LEFT JOIN  (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active`  a 
-			    WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON u.`id`=a.uid
-		</if>
-		LEFT JOIN `yeshi_ec_hongbao_v2` h ON h.`hb_uid`= u.`id`
-		WHERE (h.`hb_type`=1 OR h.`hb_type`=20) 
-			<if test="channel != null and  channel != 'all' ">
-				AND a.uid is not null
-			</if>
-			<!-- 褰撴棩涓嬪崟 -->
-			AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = DATE_FORMAT(h.hb_create_time,'%Y-%m-%d')
-			
-			<if test="startTime != null and startTime != '' ">
-		 		AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
-			</if>
-			<if test="endTime != null and endTime != '' ">
-			 	AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
-			</if>
-			<if test="years != null and years != '' ">
-			 	AND FROM_UNIXTIME(u.`createtime`/1000,'%Y') = '${years}'
-			</if>
+		SELECT COALESCE(COUNT(DISTINCT u.`id`),0) AS 'showValue',
 		<if test="type == 1">
-			GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') 
+			FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS
+			'showDate'
 		</if>
 		<if test="type == 2">
-		 	GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m') 
+			FROM_UNIXTIME(u.`createtime`/1000,'%m') AS 'showDate'
 		</if>
 		<if test="type == 3">
-		 	GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y') 
-		</if>		
+			FROM_UNIXTIME(u.`createtime`/1000,'%Y') AS 'showDate'
+		</if>
+
+		FROM yeshi_ec_user u
+		<if test="channel != null and channel != 'all' ">
+			LEFT JOIN (SELECT a.`lua_uid` AS uid FROM
+			`yeshi_ec_log_user_active` a
+			WHERE a.`lua_channel`='${channel}' GROUP
+			BY a.`lua_uid`) a ON u.`id`=a.uid
+		</if>
+		LEFT JOIN `yeshi_ec_hongbao_v2` h ON h.`hb_uid`= u.`id`
+		WHERE
+		(h.`hb_type`=1 OR h.`hb_type`=20)
+		<if test="channel != null and  channel != 'all' ">
+			AND a.uid is not null
+		</if>
+		<!-- 褰撴棩涓嬪崟 -->
+		AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') =
+		DATE_FORMAT(h.hb_create_time,'%Y-%m-%d')
+
+		<if test="startTime != null and startTime != '' ">
+			AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
+		</if>
+		<if test="endTime != null and endTime != '' ">
+			AND FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]>
+			'${endTime}'
+		</if>
+		<if test="years != null and years != '' ">
+			AND FROM_UNIXTIME(u.`createtime`/1000,'%Y') = '${years}'
+		</if>
+		<if test="type == 1">
+			GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')
+		</if>
+		<if test="type == 2">
+			GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m')
+		</if>
+		<if test="type == 3">
+			GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y')
+		</if>
 		ORDER BY u.`createtime`
 	</select>
-	
-	
-	
+
+
+
 	<select id="getWeekHasOrder" resultType="java.util.HashMap">
-		SELECT COUNT(DISTINCT hb.uid) AS showValue,FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate'
-		FROM (SELECT COUNT(v2.`hb_id`) AS num,v2.hb_uid  AS uid
-              FROM yeshi_ec_hongbao_v2 v2
-              WHERE   (v2.`hb_type`=1 OR v2.`hb_type`=20) 
-             	 AND DATE_FORMAT(v2.`hb_create_time`,'%Y-%m-%d') <![CDATA[ >= ]]>'${startTime}'
-                 AND DATE_FORMAT(v2.`hb_create_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}'
-              GROUP BY v2.hb_uid HAVING num >= ${orderNum})hb
-		LEFT JOIN yeshi_ec_user u  ON u.id = hb.uid		
+		SELECT COUNT(DISTINCT hb.uid) AS
+		showValue,FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') AS 'showDate'
+		FROM (SELECT COUNT(v2.`hb_id`) AS num,v2.hb_uid AS uid
+		FROM
+		yeshi_ec_hongbao_v2 v2
+		WHERE (v2.`hb_type`=1 OR v2.`hb_type`=20)
+		AND
+		DATE_FORMAT(v2.`hb_create_time`,'%Y-%m-%d') <![CDATA[ >= ]]>'${startTime}'
+		AND DATE_FORMAT(v2.`hb_create_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}'
+		GROUP BY v2.hb_uid HAVING num >= ${orderNum})hb
+		LEFT JOIN yeshi_ec_user
+		u ON u.id = hb.uid
 		<if test="channel != null and channel != 'all' ">
-			LEFT JOIN  (SELECT a.`lua_uid` AS uid FROM `yeshi_ec_log_user_active`  a 
-			    WHERE a.`lua_channel`='${channel}' GROUP BY a.`lua_uid`) a ON u.`id`=a.uid
+			LEFT JOIN (SELECT a.`lua_uid` AS uid FROM
+			`yeshi_ec_log_user_active` a
+			WHERE a.`lua_channel`='${channel}' GROUP
+			BY a.`lua_uid`) a ON u.`id`=a.uid
 		</if>
 		WHERE FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') = '${startTime}'
-			<if test="channel != null and  channel != 'all' ">
-			   AND a.uid is not null
-			</if>
-			GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d') 
-		ORDER BY u.`createtime`
+		<if test="channel != null and  channel != 'all' ">
+			AND a.uid is not null
+		</if>
+		GROUP BY FROM_UNIXTIME(u.`createtime`/1000,'%Y-%m-%d')
+		ORDER BY
+		u.`createtime`
+	</select>
+
+	<select id="getInfoByPhoneOrInviteCode" resultMap="BaseResultMap">
+		SELECT * FROM
+		yeshi_ec_user u
+		LEFT JOIN yeshi_ec_user_info_extra uf ON uf.`uie_uid` =
+		u.`id`
+		WHERE
+		uf.`uie_invite_code` IS NOT NULL
+		AND (u.`phone` =#{phone} OR
+		uf.`uie_invite_code` = #{inviteCode})
+		LIMIT 1
 	</select>
 	
-	<select id="getInfoByPhoneOrInviteCode" resultMap="BaseResultMap">
-		SELECT * FROM yeshi_ec_user u 
-		LEFT JOIN yeshi_ec_user_info_extra uf ON uf.`uie_uid` = u.`id`
-		WHERE uf.`uie_invite_code` IS NOT NULL  
-			  AND (u.`phone` =#{phone} OR uf.`uie_invite_code` = #{inviteCode})
-		LIMIT 1
+	
+	<select id="countAvaiableUser" resultType="java.lang.Long">
+		SELECT count(*) FROM
+		yeshi_ec_user u
+		where u.state=0
 	</select>
 
 </mapper>

--
Gitblit v1.8.0