From 11dc10e5d72d0c8969294d55985882a0631354d0 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 12 五月 2020 18:20:59 +0800 Subject: [PATCH] 队员统计表数据同步处理 --- fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml | 72 ++++++++++++++++++++++++++++------- 1 files changed, 57 insertions(+), 15 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 e7b7735..b1c4942 100644 --- a/fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml +++ b/fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml @@ -57,8 +57,10 @@ resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" parameterType="java.lang.Long"> select u.* from yeshi_ec_threeSale s - left join yeshi_ec_user u on u.id=s.boss_id - where s.state = 1 AND s.worker_id = #{0} + left join + yeshi_ec_user u on u.id=s.boss_id + where s.state = 1 AND s.worker_id = + #{0} LIMIT 1 </select> @@ -154,7 +156,8 @@ <update id="inviteSeparate"> update yeshi_ec_threeSale t set t.state = 0,t.expire = 2, - t.updateTime = <![CDATA[UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) * 1000]]> + t.updateTime + = <![CDATA[UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) * 1000]]> where t.worker_id=#{workerId} AND t.boss_id = #{bossId} </update> @@ -217,7 +220,8 @@ <select id="listSecondTeamQuery" resultMap="BaseResultMap"> SELECT yet.*,d.`tvr_type` AS validState 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 1=1 + LEFT JOIN yeshi_ec_threesale tf ON + ts.`boss_id`=tf.`worker_id` WHERE 1=1 AND tf.`state` = 1 <if test="uid != null"> AND tf.`boss_id` = #{uid} @@ -340,10 +344,13 @@ <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` + 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 = + LEFT JOIN + yeshi_ec_threesale yet ON yet.id = A.id <if test="listId != null and listId.size > 0"> WHERE yet.worker_id in @@ -356,8 +363,10 @@ <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` + 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="listId != null and listId.size > 0"> AND tf.worker_id in @@ -383,8 +392,10 @@ <select id="countSecondTeamByDate" 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` + 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="dayType == 1"> <!-- 浠婃棩 --> AND TO_DAYS(FROM_UNIXTIME(ts.createTime/1000)) = TO_DAYS(NOW()) @@ -468,8 +479,10 @@ SELECT IFNULL(COUNT(d.`id`),0) FROM yeshi_ec_threesale d LEFT JOIN (SELECT t.`id`,t.`boss_id` FROM `yeshi_ec_threesale` t - WHERE t.`state` = 1 AND t.`worker_id` = #{workerId} LIMIT 1)t ON - t.`boss_id` = d.`boss_id` + WHERE t.`state` + = 1 AND t.`worker_id` = #{workerId} LIMIT 1)t ON + t.`boss_id` = + d.`boss_id` WHERE d.`id` <![CDATA[<=]]>t.id AND d.`state` = 1 </select> @@ -477,13 +490,42 @@ <select id="getValidWorkerIdsByTime" resultMap="BaseResultMap"> SELECT * FROM `yeshi_ec_threesale` tr - WHERE tr.`state` = 1 AND tr.`boss_id` = #{uid} AND tr.`succeedTime` <![CDATA[>=]]> + WHERE tr.`state` = 1 AND + tr.`boss_id` = #{uid} AND tr.`succeedTime` <![CDATA[>=]]> #{limitTime} </select> <select id="listAll" resultMap="BaseResultMap"> SELECT * FROM - `yeshi_ec_threesale` limit #{start},#{count} + `yeshi_ec_threesale` + + where 1=1 + + <if test="minTime!=null"> + and tr.`succeedTime` >=#{minTime} + </if> + + <if test="maxTime!=null"> + and #{maxTime}>tr.`succeedTime` + </if> + + limit #{start},#{count} + </select> + + + <select id="countAll" resultType="java.lang.Long"> + SELECT count(*) FROM + `yeshi_ec_threesale` + + where 1=1 + + <if test="minTime!=null"> + and tr.`succeedTime` >=#{minTime} + </if> + + <if test="maxTime!=null"> + and #{maxTime}>tr.`succeedTime` + </if> </select> </mapper> \ No newline at end of file -- Gitblit v1.8.0