From 5af10f175689549ca44b74e9fc1c7ee0ec92c2d7 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期二, 21 四月 2020 14:26:38 +0800 Subject: [PATCH] 后台改造 --- fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml | 172 +++++++++++++++++++-------------------------------------- 1 files changed, 58 insertions(+), 114 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 a4f7480..d1d760e 100644 --- a/fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml +++ b/fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml @@ -10,6 +10,8 @@ <result column="updateTime" property="updateTime" jdbcType="BIGINT" /> <result column="expire" property="expire" jdbcType="INTEGER" /> + <result column="validState" property="validState" jdbcType="INTEGER" /> + <association property="boss" column="boss_id" javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> <id column="boss_id" property="id" jdbcType="BIGINT" /> @@ -175,174 +177,116 @@ 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 - OR yet.expire IS NULL) - <if test="key != null and key !='' "> - and yet.`worker_id` like '%${key}%' - </if> - ORDER BY yet.createtime DESC LIMIT ${start},${count} - </select> - <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) - <if test="key != null and key !='' "> - and yet.`worker_id` like '%${key}%' - </if> - </select> - - - <!-- 鏌ヨ浜屽害闃熷憳闆嗗悎 --> - <select id="queryMySecondTeamList" resultMap="BaseResultMap"> - 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 tf.`state` = 1 - <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} - </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 tf.`state` = 1 - <if test="key != null and key !='' "> - and ts.`worker_id` like '%${key}%' - </if> - )A - </select> - - - - <select id="listFirstTeamQuery" resultMap="AllResultMap"> - SELECT * FROM `yeshi_ec_threesale` + <select id="listFirstTeamQuery" resultMap="BaseResultMap"> + SELECT t.*,d.`tvr_type` AS validState FROM `yeshi_ec_threesale` t + LEFT JOIN `yeshi_ec_user_invite_valid_record` d ON (d.`tvr_uid` = t.`boss_id` AND d.`tvr_worker_id` = t.`worker_id`) WHERE 1=1 <if test="uid != null"> - AND `boss_id` = #{uid} + AND t.`boss_id` = #{uid} </if> - <if test="state == 0"> - AND `state` = 0 AND (expire = 0 OR expire IS NULL) + <if test="state != null"> + AND t.`state` = #{state} </if> - <if test="state == 1"> - AND `state` = 1 + <if test="validState == 1"> + AND d.`tvr_type` = 1 </if> - <if test="state ==2"> - AND `expire` = 1 <!-- 澶辨晥 --> + <if test="validState == 0"> + AND d.`tvr_type` is null </if> <if test="startTime != null and startTime !='' "> - <![CDATA[AND FROM_UNIXTIME(createTime/1000) >= #{startTime}]]> + <![CDATA[AND FROM_UNIXTIME(t.createTime/1000) >= #{startTime}]]> </if> <if test="endTime != null and endTime !='' "> - <![CDATA[AND FROM_UNIXTIME(createTime/1000) <= #{endTime}]]> + <![CDATA[AND FROM_UNIXTIME(t.createTime/1000) <= #{endTime}]]> </if> - ORDER BY createTime DESC + ORDER BY t.createTime DESC LIMIT ${start},${count} </select> <select id="countFirstTeamQuery" resultType="java.lang.Long"> - SELECT count(id) FROM `yeshi_ec_threesale` + SELECT count(t.id) FROM `yeshi_ec_threesale` t + LEFT JOIN `yeshi_ec_user_invite_valid_record` d ON (d.`tvr_uid` = t.`boss_id` AND d.`tvr_worker_id` = t.`worker_id`) WHERE 1=1 <if test="uid != null"> - AND `boss_id` = #{uid} + AND t.`boss_id` = #{uid} </if> - <if test="state == 0"> - AND `state` = 0 AND (expire = 0 OR expire IS NULL) + <if test="state != null"> + AND t.`state` = #{state} </if> - <if test="state == 1"> - AND `state` = 1 + <if test="validState == 1"> + AND d.`tvr_type` = 1 </if> - <if test="state ==2"> - AND `expire` = 1 <!-- 澶辨晥 --> + <if test="validState == 0"> + AND d.`tvr_type` is null </if> <if test="startTime != null and startTime !='' "> - <![CDATA[AND FROM_UNIXTIME(createTime/1000) >= #{startTime}]]> + <![CDATA[AND FROM_UNIXTIME(t.createTime/1000) >= #{startTime}]]> </if> - <if test="endTime != null and endTime !=''"> - <![CDATA[AND FROM_UNIXTIME(createTime/1000) <= #{endTime}]]> + <if test="endTime != null and endTime !='' "> + <![CDATA[AND FROM_UNIXTIME(t.createTime/1000) <= #{endTime}]]> </if> </select> - <select id="listSecondTeamQuery" 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 1=1 AND tf.`state` = 1 + <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 AND tf.`state` = 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) - </if> - <if test="state == 1"> - AND ts.`state` = 1 - </if> - <if test="state ==2"> - AND ts.`expire` = 1 <!-- 澶辨晥 --> + <if test="state != null"> + AND ts.`state` = #{state} </if> <if test="startTime != null and startTime !='' "> - <![CDATA[AND FROM_UNIXTIME(ts.createTime/1000) >= #{startTime}]]> + <![CDATA[AND FROM_UNIXTIME(ts.createTime/1000) >= #{startTime}]]> </if> <if test="endTime != null and endTime !=''"> - <![CDATA[AND FROM_UNIXTIME(ts.createTime/1000) <= #{endTime}]]> + <![CDATA[AND FROM_UNIXTIME(ts.createTime/1000) <= #{endTime}]]> </if> - )A LEFT JOIN yeshi_ec_threesale yet ON yet.id = A.id - ORDER BY - yet.`createtime` DESC + LEFT JOIN `yeshi_ec_user_invite_valid_record` d ON (d.`tvr_uid` = yet.`boss_id` AND d.`tvr_worker_id` = yet.`worker_id`) + where 1=1 + <if test="validState == 1"> + AND d.`tvr_type` = 1 + </if> + <if test="validState == 0"> + AND d.`tvr_type` is null + </if> + 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 + 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 1=1 AND tf.`state` = 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) - </if> - <if test="state == 1"> - AND ts.`state` = 1 - </if> - <if test="state ==2"> - AND ts.`expire` = 1 <!-- 澶辨晥 --> + <if test="state != null"> + AND ts.`state` = #{state} </if> <if test="startTime != null and startTime !='' "> - <![CDATA[AND FROM_UNIXTIME(ts.createTime/1000) >= #{startTime}]]> + <![CDATA[AND FROM_UNIXTIME(ts.createTime/1000) >= #{startTime}]]> </if> <if test="endTime != null and endTime !=''"> - <![CDATA[AND FROM_UNIXTIME(ts.createTime/1000) <= #{endTime}]]> + <![CDATA[AND FROM_UNIXTIME(ts.createTime/1000) <= #{endTime}]]> </if> )A + LEFT JOIN yeshi_ec_threesale yet ON yet.id = A.id + LEFT JOIN `yeshi_ec_user_invite_valid_record` d ON (d.`tvr_uid` = yet.`boss_id` AND d.`tvr_worker_id` = yet.`worker_id`) + where 1=1 + <if test="validState == 0"> + AND d.`tvr_type` is null + </if> + <if test="validState == 1"> + AND d.`tvr_type` = 1 + </if> </select> - <select id="listSuperiorQuery" resultMap="AllResultMap"> + <select id="listSuperiorQuery" resultMap="BaseResultMap"> SELECT * FROM `yeshi_ec_threesale` ts WHERE ts.`worker_id` = #{uid} <if test="state == 0"> -- Gitblit v1.8.0