| | |
| | | <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"> |
| | |
| | | = #{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"> |
| | |
| | | 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}%' |
| | |
| | | |
| | | <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> |
| | |
| | | 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}%' |
| | |
| | | <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> |
| | | |
| | |
| | | <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> |
| | | |
| | |
| | | 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 |
| | |
| | | </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 |
| | |
| | | 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 |
| | |
| | | |
| | | <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 |
| | |
| | | |
| | | |
| | | <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> |
| | |
| | | |
| | | <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} |
| | |
| | | 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> |