| | |
| | | <result column="createTime" property="createTime" jdbcType="BIGINT" />
|
| | | <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" />
|
| | |
| | |
|
| | |
|
| | |
|
| | | <select id="selectBoss" 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}
|
| | | <select id="selectBoss"
|
| | | 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}
|
| | | LIMIT 1
|
| | | </select>
|
| | |
|
| | |
| | |
|
| | |
|
| | | <!-- 根据邀请者ID查询关系 -->
|
| | | <select id="getByWorkerId" resultMap="BaseResultMap" parameterType="java.lang.Long">
|
| | | select <include refid="Base_Column_List" /> from yeshi_ec_threeSale |
| | | <select id="getByWorkerId" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_threeSale
|
| | | where worker_id = #{0}
|
| | | </select>
|
| | | |
| | |
|
| | | <select id="selectLatestByWorkerIdAndState" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_threeSale s where worker_id = #{workerId} and state=#{state}
|
| | | from yeshi_ec_threeSale s where worker_id = #{workerId} and
|
| | | state=#{state}
|
| | | </select>
|
| | | |
| | |
|
| | |
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
| | | yeshi_ec_threeSale where id = #{id,jdbcType=BIGINT}
|
| | |
| | | where id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | |
|
| | | |
| | |
|
| | | <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>
|
| | |
|
| | |
|
| | | <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`)
|
| | | 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 t.`boss_id` = #{uid}
|
| | | AND t.`boss_id` = #{uid}
|
| | | </if>
|
| | | <if test="state != null">
|
| | | AND t.`state` = #{state}
|
| | | AND t.`state` = #{state}
|
| | | </if>
|
| | | <if test="validState == 1">
|
| | | AND d.`tvr_type` = 1
|
| | |
| | | <if test="endTime != null and endTime !='' ">
|
| | | <![CDATA[AND FROM_UNIXTIME(t.createTime/1000) <= #{endTime}]]>
|
| | | </if>
|
| | | ORDER BY t.createTime DESC
|
| | | ORDER BY t.createTime DESC
|
| | | LIMIT ${start},${count}
|
| | | </select>
|
| | |
|
| | | <select id="countFirstTeamQuery" resultType="java.lang.Long">
|
| | | 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`)
|
| | | 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 t.`boss_id` = #{uid}
|
| | | AND t.`boss_id` = #{uid}
|
| | | </if>
|
| | | <if test="state != null">
|
| | | AND t.`state` = #{state}
|
| | | AND t.`state` = #{state}
|
| | | </if>
|
| | | <if test="validState == 1">
|
| | | AND d.`tvr_type` = 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
|
| | | 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 != null">
|
| | | AND ts.`state` = #{state}
|
| | | 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) <= #{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 |
| | | 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>
|
| | |
| | | </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
|
| | |
| | | AND tf.`boss_id` = #{uid}
|
| | | </if>
|
| | | <if test="state != null">
|
| | | AND ts.`state` = #{state}
|
| | | AND ts.`state` = #{state}
|
| | | </if>
|
| | | <if test="startTime != null and startTime !='' ">
|
| | | <![CDATA[AND FROM_UNIXTIME(ts.createTime/1000) >= #{startTime}]]>
|
| | |
| | | </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 |
| | | 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>
|
| | |
| | |
|
| | |
|
| | | <select id="listFirstTeam" resultMap="AllResultMap">
|
| | | 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`)
|
| | | 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`)
|
| | | WHERE ts.`boss_id` = #{uid}
|
| | | ORDER BY ts.createTime DESC
|
| | | LIMIT ${start},${count}
|
| | | LIMIT
|
| | | ${start},${count}
|
| | | </select>
|
| | |
|
| | | <select id="countFirstTeam" resultType="java.lang.Long">
|
| | | SELECT IFNULL(count(id),0) FROM `yeshi_ec_threesale`
|
| | | SELECT
|
| | | IFNULL(count(id),0) FROM `yeshi_ec_threesale`
|
| | | WHERE `boss_id` = #{uid}
|
| | | </select>
|
| | |
|
| | | <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
|
| | | ORDER BY 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`
|
| | | WHERE tf.`boss_id` = #{uid}
|
| | | 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 tf.`boss_id` = #{uid}
|
| | | )A
|
| | | </select>
|
| | | |
| | |
|
| | | <select id="getMyBoss" resultMap="AllResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | |
| | | </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">
|
| | |
| | | t.`expire`IS NULL)
|
| | | LIMIT 1
|
| | | </select>
|
| | | |
| | | |
| | |
|
| | |
|
| | | <select id="getNearRelationByBossIdAndWorkerId" resultMap="BaseResultMap">
|
| | | SELECT * FROM `yeshi_ec_threesale` t
|
| | | WHERE t.`boss_id` = #{bossId} AND t.`worker_id` = #{workerId}
|
| | | ORDER BY t.`state` DESC, t.`createTime` DESC
|
| | | WHERE t.`boss_id` = #{bossId} AND
|
| | | t.`worker_id` = #{workerId}
|
| | | ORDER BY t.`state` DESC, t.`createTime`
|
| | | DESC
|
| | | LIMIT 1
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="selectSuccessByWorkerId" resultMap="BaseResultMap" parameterType="java.lang.Long">
|
| | | <select id="selectSuccessByWorkerId" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | SELECT * FROM `yeshi_ec_threesale`
|
| | | WHERE `state` = 1 AND worker_id = #{0} order by id desc
|
| | | WHERE `state` = 1 AND
|
| | | worker_id = #{0} order by id desc
|
| | | </select>
|
| | |
|
| | | <select id="getSuccessByDate" resultMap="AllResultMap" >
|
| | | <select id="getSuccessByDate" resultMap="AllResultMap">
|
| | | SELECT * FROM yeshi_ec_threesale t
|
| | | WHERE t.`boss_id` = #{bossId} AND t.`state` = 1
|
| | | AND <![CDATA[t.createTime >= #{minTime} AND t.createTime <= #{maxTime}]]>
|
| | | WHERE t.`boss_id` = #{bossId} AND
|
| | | t.`state` = 1
|
| | | AND <![CDATA[t.createTime >= #{minTime} AND t.createTime <= #{maxTime}]]>
|
| | | </select>
|
| | | |
| | |
|
| | | <select id="getByWorkerIdAndTime" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_threesale t
|
| | | WHERE t.`worker_id` = #{workerId} AND t.`state` = 1
|
| | | WHERE t.`worker_id` = #{workerId}
|
| | | AND t.`state` = 1
|
| | | <![CDATA[AND t.succeedTime >= #{time}]]>
|
| | | </select>
|
| | | |
| | |
|
| | | <select id="getTeamOrderNumByWorkerId" resultType="Long">
|
| | | 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 d.`id` <![CDATA[<=]]>t.id AND d.`state` = 1 |
| | | 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 d.`id` <![CDATA[<=]]>t.id
|
| | | AND d.`state` = 1
|
| | | </select>
|
| | | |
| | | |
| | |
|
| | |
|
| | | <select id="getValidWorkerIdsByTime" resultMap="BaseResultMap">
|
| | | SELECT * FROM `yeshi_ec_threesale` tr |
| | | WHERE tr.`state` = 1 AND tr.`boss_id` = #{uid} AND tr.`succeedTime` <![CDATA[>=]]> #{limitTime}
|
| | | SELECT * FROM `yeshi_ec_threesale` tr
|
| | | 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}
|
| | | </select>
|
| | |
|
| | | </mapper>
|