From e92ce10abd2c9e66c8f84b2d2d534bf48c09688e Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 05 三月 2019 17:06:13 +0800 Subject: [PATCH] 邀请者bug修改 --- fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml | 136 ++++++++++++++++++++++++++++----------------- 1 files changed, 85 insertions(+), 51 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 6e1b048..80160f8 100644 --- a/fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml +++ b/fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml @@ -13,7 +13,9 @@ <result column="expire" property="expire" jdbcType="INTEGER" /> <association property="boss" column="boss_id" - resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" /> + javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> + <id column="boss_id" property="id" jdbcType="BIGINT" /> + </association> <association property="worker" column="worker_id" javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> @@ -119,9 +121,12 @@ = #{worker.id,jdbcType=BIGINT},state = #{state,jdbcType=BOOLEAN}, expire = #{expire,jdbcType=INTEGER}, - succeedTime = #{succeedTime,jdbcType=BIGINT}, - createTime = #{createTime,jdbcType=BIGINT}, - updateTime = #{updateTime,jdbcType=BIGINT} + succeedTime = + #{succeedTime,jdbcType=BIGINT}, + createTime = + #{createTime,jdbcType=BIGINT}, + updateTime = + #{updateTime,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT} </update> <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.ThreeSale"> @@ -146,16 +151,18 @@ where t.state=0 and t.worker_id=#{0} AND (t.expire = 0 OR t.expire IS NULL) </update> - + <delete id="deleteExpireRecord" parameterType="java.lang.Long"> - DELETE FROM yeshi_ec_threesale - WHERE expire = 1 AND boss_id = #{bossId} AND worker_id = #{workerId} + DELETE FROM + yeshi_ec_threesale + WHERE expire = 1 AND boss_id = #{bossId} AND worker_id = #{workerId} </delete> - + <!-- 鏌ヨ涓�搴﹂槦鍛橀泦鍚� --> <select id="queryMyFirstTeamList" resultMap="BaseResultMap"> SELECT * FROM `yeshi_ec_threesale` yet - WHERE yet.`state` = '1' AND yet.`boss_id` = #{bossId} AND (yet.expire = 0 + WHERE yet.`state` = '1' AND + yet.`boss_id` = #{bossId} AND (yet.expire = 0 OR yet.expire IS NULL) <if test="key != null and key !='' "> and yet.`worker_id` like '%${key}%' @@ -165,8 +172,10 @@ <select id="queryCountMyFirstTeamList" resultType="java.lang.Long"> SELECT count(yet.id) FROM `yeshi_ec_threesale` yet - WHERE yet.`state` = '1' AND yet.`boss_id` = #{bossId} AND (yet.expire = 0 - OR yet.expire IS NULL) + WHERE yet.`state` = + '1' AND yet.`boss_id` = #{bossId} AND (yet.expire = 0 + OR yet.expire IS + NULL) <if test="key != null and key !='' "> and yet.`worker_id` like '%${key}%' </if> @@ -178,22 +187,28 @@ 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 ts.`state` = '1' AND tf.`boss_id`=#{bossId} AND (ts.expire = 0 OR + LEFT JOIN yeshi_ec_threesale tf ON + ts.`boss_id`=tf.`worker_id` + WHERE ts.`state` = '1' AND + tf.`boss_id`=#{bossId} AND (ts.expire = 0 OR ts.expire IS NULL) <if test="key != null and key !='' "> and ts.`worker_id` like '%${key}%' </if> )A LEFT JOIN yeshi_ec_threesale yet ON yet.id = A.id - ORDER BY yet.`createtime` DESC LIMIT ${start},${count} + ORDER BY + yet.`createtime` DESC LIMIT ${start},${count} </select> <select id="queryCountMySecondTeamList" 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 ts.`state` = '1' AND tf.`boss_id`=#{bossId} AND (ts.expire = 0 OR + 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 ts.`state` = '1' AND + tf.`boss_id`=#{bossId} AND (ts.expire = 0 OR ts.expire IS NULL) <if test="key != null and key !='' "> and ts.`worker_id` like '%${key}%' @@ -204,7 +219,8 @@ <select id="queryLongTimeFailed" resultType="java.lang.Long"> <!-- 闀挎椂闂存湭閭�璇锋垚鍔� --> SELECT h.`id` FROM `yeshi_ec_threesale` h - WHERE h.`state` = 0 AND (h.expire = 0 OR h.expire IS NULL) + WHERE h.`state` = 0 AND + (h.expire = 0 OR h.expire IS NULL) <![CDATA[ AND DATE_SUB(CURDATE(), INTERVAL #{daysNum} DAY) > DATE(FROM_UNIXTIME(h.`createTime`/1000)) ]]> </select> @@ -212,7 +228,8 @@ <select id="queryLongTimeSuccess" resultMap="BaseResultMap"> <!-- 闀挎椂闂存湭閭�璇锋垚鍔� --> SELECT * FROM `yeshi_ec_threesale` h - WHERE h.`state` = 1 AND (h.expire = 0 OR h.expire IS NULL) + WHERE h.`state` = 1 AND (h.expire + = 0 OR h.expire IS NULL) <![CDATA[ AND DATE_SUB(CURDATE(), INTERVAL #{daysNum} DAY) > DATE(FROM_UNIXTIME(h.`createTime`/1000)) ]]> </select> @@ -279,13 +296,15 @@ 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` + LEFT JOIN yeshi_ec_threesale tf ON + ts.`boss_id`=tf.`worker_id` WHERE 1=1 <if test="uid != null"> AND tf.`boss_id` = #{uid} </if> <if test="state == 0"> - AND ts.`state` = 0 AND (ts.expire = 0 OR ts.expire IS NULL) + AND ts.`state` = 0 AND (ts.expire = 0 OR ts.expire IS + NULL) </if> <if test="state == 1"> AND ts.`state` = 1 @@ -301,20 +320,24 @@ </if> )A LEFT JOIN yeshi_ec_threesale yet ON yet.id = A.id - ORDER BY yet.`createtime` DESC + ORDER BY + yet.`createtime` DESC LIMIT ${start},${count} </select> <select id="countSecondTeamQuery" 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 1=1 <if test="uid != null"> AND tf.`boss_id` = #{uid} </if> <if test="state == 0"> - AND ts.`state` = 0 AND (ts.expire = 0 OR ts.expire IS NULL) + AND ts.`state` = 0 AND (ts.expire = 0 OR ts.expire IS + NULL) </if> <if test="state == 1"> AND ts.`state` = 1 @@ -335,7 +358,8 @@ SELECT * FROM `yeshi_ec_threesale` ts WHERE ts.`worker_id` = #{uid} <if test="state == 0"> - AND ts.`state` = 0 AND (ts.expire = 0 OR ts.expire IS NULL) + AND ts.`state` = 0 AND (ts.expire = 0 OR ts.expire IS + NULL) </if> <if test="state == 1"> AND ts.`state` = 1 @@ -349,9 +373,11 @@ <select id="countSuperiorQuery" resultType="java.lang.Long"> SELECT COUNT(ts.id) FROM `yeshi_ec_threesale` ts - WHERE ts.`worker_id` = #{uid} + WHERE ts.`worker_id` = + #{uid} <if test="state == 0"> - AND ts.`state` = 0 AND (ts.expire = 0 OR ts.expire IS NULL) + AND ts.`state` = 0 AND (ts.expire = 0 OR ts.expire IS + NULL) </if> <if test="state == 1"> AND ts.`state` = 1 @@ -363,17 +389,20 @@ <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` + 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 + 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> @@ -382,20 +411,25 @@ <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 + 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` - ORDER BY yet.state DESC, yet.expire, yet.createTime DESC + ON yet.`boss_id` = + ff.`tf_boss_id` AND yet.`worker_id` =ff.`tf_worker_id` + ORDER BY + yet.state DESC, yet.expire, yet.createTime DESC LIMIT ${start},${count} </select> <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="state != null"> AND ts.`state` = #{state} @@ -420,21 +454,21 @@ AND `expire` = 1 <!-- 澶辨晥 --> </if> </select> - + <select id="getSuccessRelationshipNum" resultType="java.lang.Integer"> - SELECT IFNULL (COUNT(*),0) FROM `yeshi_ec_threesale` t - WHERE t.`state` = 1 AND (t.`worker_id` =${uid} OR t.`boss_id` = ${uid}) + SELECT IFNULL (COUNT(*),0) FROM `yeshi_ec_threesale` t + WHERE t.`state` = 1 AND (t.`worker_id` =${uid} OR t.`boss_id` = ${uid}) </select> - + <select id="getRelationshipByBossIdAndWorkerId" resultMap="BaseResultMap"> - SELECT * FROM `yeshi_ec_threesale` t - WHERE t.`boss_id` = ${bossId} AND t.`worker_id` = ${workerId} - AND t.`state` = 0 AND (t.`expire` = 0 OR t.`expire`IS NULL) - LIMIT 1 + SELECT * FROM `yeshi_ec_threesale` t + WHERE t.`boss_id` = ${bossId} AND t.`worker_id` = ${workerId} + AND t.`state` = 0 AND (t.`expire` = 0 OR t.`expire`IS NULL) + LIMIT 1 </select> - + <select id="getExpireRecord" resultMap="BaseResultMap"> - SELECT * FROM `yeshi_ec_threesale` - WHERE expire = 1 AND boss_id = #{bossId} AND worker_id = #{workerId} + SELECT * FROM `yeshi_ec_threesale` + WHERE expire = 1 AND boss_id = #{bossId} AND worker_id = #{workerId} </select> </mapper> -- Gitblit v1.8.0