| | |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="worker_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | |
| | | <resultMap id="AllResultMap" type="com.yeshi.fanli.entity.bus.user.ThreeSale"> |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="state" property="state" jdbcType="BOOLEAN" /> |
| | | <result column="createTime" property="createTime" jdbcType="BIGINT" /> |
| | | <result column="expire" property="expire" jdbcType="INTEGER" /> |
| | | |
| | | <association property="boss" column="boss_id" |
| | | select="com.yeshi.fanli.dao.mybatis.UserInfoMapper.selectByPKey" /> |
| | | |
| | | <association property="worker" column="worker_id" |
| | | select="com.yeshi.fanli.dao.mybatis.UserInfoMapper.selectByPKey" /> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">id,boss_id,worker_id,state,expire,createTime</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | |
| | | close=")">#{item}</foreach> |
| | | </update> |
| | | |
| | | <select id="listFirstTeamQuery" resultMap="AllResultMap"> |
| | | SELECT * FROM `yeshi_ec_threesale` |
| | | WHERE 1=1 |
| | | <if test="uid != null"> |
| | | AND `boss_id` = #{uid} |
| | | </if> |
| | | <if test="state == 0"> |
| | | AND `state` = 0 AND (expire = 0 OR expire IS NULL) |
| | | </if> |
| | | <if test="state == 1"> |
| | | AND `state` = 1 |
| | | </if> |
| | | <if test="state ==2"> |
| | | AND `expire` = 1 <!-- 失效 --> |
| | | </if> |
| | | <if test="startTime != null and startTime !='' "> |
| | | <![CDATA[AND FROM_UNIXTIME(createTime/1000) >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null and endTime !='' "> |
| | | <![CDATA[AND FROM_UNIXTIME(createTime/1000) <= #{endTime}]]> |
| | | </if> |
| | | ORDER BY createTime DESC |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="countFirstTeamQuery" resultType="java.lang.Long"> |
| | | SELECT count(id) FROM `yeshi_ec_threesale` |
| | | WHERE 1=1 |
| | | <if test="uid != null"> |
| | | AND `boss_id` = #{uid} |
| | | </if> |
| | | <if test="state == 0"> |
| | | AND `state` = 0 AND (expire = 0 OR expire IS NULL) |
| | | </if> |
| | | <if test="state == 1"> |
| | | AND `state` = 1 |
| | | </if> |
| | | <if test="state ==2"> |
| | | AND `expire` = 1 <!-- 失效 --> |
| | | </if> |
| | | <if test="startTime != null and startTime !='' "> |
| | | <![CDATA[AND FROM_UNIXTIME(createTime/1000) >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null and endTime !=''"> |
| | | <![CDATA[AND FROM_UNIXTIME(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 |
| | | <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> |
| | | <if test="startTime != null and startTime !='' "> |
| | | <![CDATA[AND FROM_UNIXTIME(ts.createTime/1000) >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null and 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 |
| | | 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` |
| | | 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) |
| | | </if> |
| | | <if test="state == 1"> |
| | | AND ts.`state` = 1 |
| | | </if> |
| | | <if test="state ==2"> |
| | | AND ts.`expire` = 1 <!-- 失效 --> |
| | | </if> |
| | | <if test="startTime != null and startTime !='' "> |
| | | <![CDATA[AND FROM_UNIXTIME(ts.createTime/1000) >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null and endTime !=''"> |
| | | <![CDATA[AND FROM_UNIXTIME(ts.createTime/1000) <= #{endTime}]]> |
| | | </if> |
| | | )A |
| | | </select> |
| | | |
| | | <select id="listSuperiorQuery" resultMap="AllResultMap"> |
| | | 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) |
| | | </if> |
| | | <if test="state == 1"> |
| | | AND ts.`state` = 1 |
| | | </if> |
| | | <if test="state ==2"> |
| | | AND ts.`expire` = 1 <!-- 失效 --> |
| | | </if> |
| | | ORDER BY ts.`createtime` DESC |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="countSuperiorQuery" resultType="java.lang.Long" > |
| | | SELECT COUNT(ts.id) 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) |
| | | </if> |
| | | <if test="state == 1"> |
| | | AND ts.`state` = 1 |
| | | </if> |
| | | <if test="state ==2"> |
| | | AND ts.`expire` = 1 <!-- 失效 --> |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |