<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.yeshi.fanli.dao.mybatis.UserRankingsMapper">
|
<resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserRankings">
|
<id column="r_id" property="id" jdbcType="BIGINT"/>
|
<result column="r_show_id" property="showId" jdbcType="VARCHAR"/>
|
<result column="r_nick_name" property="nickName" jdbcType="VARCHAR"/>
|
<result column="r_portrait" property="portrait" jdbcType="VARCHAR"/>
|
<result column="r_trade_reward" property="tradeReward" jdbcType="DECIMAL"/>
|
<result column="r_share_reward" property="shareReward" jdbcType="DECIMAL"/>
|
<result column="r_trade_state" property="tradeState" jdbcType="INTEGER"/>
|
<result column="r_share_state" property="shareState" jdbcType="INTEGER"/>
|
<result column="r_trade_time" property="tradeTime" jdbcType="TIMESTAMP"/>
|
<result column="r_share_time" property="shareTime" jdbcType="TIMESTAMP"/>
|
<result column="r_createtime" property="createtime" jdbcType="TIMESTAMP"/>
|
</resultMap>
|
<sql id="Base_Column_List">r_id,r_show_id,r_nick_name,r_portrait,r_trade_reward,r_share_reward,r_trade_state,r_share_state,r_trade_time,r_share_time,r_createtime</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
|
<include refid="Base_Column_List"/>from yeshi_ec_rankings_record where r_id = #{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_rankings_record where r_id = #{id,jdbcType=BIGINT}</delete>
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserRankings" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_rankings_record (r_id,r_show_id,r_nick_name,r_portrait,r_trade_reward,r_share_reward,r_trade_state,r_share_state,r_trade_time,r_share_time,r_createtime) values (#{id,jdbcType=BIGINT},#{showId,jdbcType=VARCHAR},#{nickName,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{tradeReward,jdbcType=DECIMAL},#{shareReward,jdbcType=DECIMAL},#{tradeState,jdbcType=INTEGER},#{shareState,jdbcType=INTEGER},#{tradeTime,jdbcType=TIMESTAMP},#{shareTime,jdbcType=TIMESTAMP},#{createtime,jdbcType=TIMESTAMP})</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserRankings" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_rankings_record
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">r_id,</if>
|
<if test="showId != null">r_show_id,</if>
|
<if test="nickName != null">r_nick_name,</if>
|
<if test="portrait != null">r_portrait,</if>
|
<if test="tradeReward != null">r_trade_reward,</if>
|
<if test="shareReward != null">r_share_reward,</if>
|
<if test="tradeState != null">r_trade_state,</if>
|
<if test="shareState != null">r_share_state,</if>
|
<if test="tradeTime != null">r_trade_time,</if>
|
<if test="shareTime != null">r_share_time,</if>
|
<if test="createtime != null">r_createtime,</if>
|
</trim>values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="showId != null">#{showId,jdbcType=VARCHAR},</if>
|
<if test="nickName != null">#{nickName,jdbcType=VARCHAR},</if>
|
<if test="portrait != null">#{portrait,jdbcType=VARCHAR},</if>
|
<if test="tradeReward != null">#{tradeReward,jdbcType=DECIMAL},</if>
|
<if test="shareReward != null">#{shareReward,jdbcType=DECIMAL},</if>
|
<if test="tradeState != null">#{tradeState,jdbcType=INTEGER},</if>
|
<if test="shareState != null">#{shareState,jdbcType=INTEGER},</if>
|
<if test="tradeTime != null">#{tradeTime,jdbcType=TIMESTAMP},</if>
|
<if test="shareTime != null">#{shareTime,jdbcType=TIMESTAMP},</if>
|
<if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserRankings">update yeshi_ec_rankings_record set r_show_id = #{showId,jdbcType=VARCHAR},r_nick_name = #{nickName,jdbcType=VARCHAR},r_portrait = #{portrait,jdbcType=VARCHAR},r_trade_reward = #{tradeReward,jdbcType=DECIMAL},r_share_reward = #{shareReward,jdbcType=DECIMAL},r_trade_state = #{tradeState,jdbcType=INTEGER},r_share_state = #{shareState,jdbcType=INTEGER},r_trade_time = #{tradeTime,jdbcType=TIMESTAMP},r_share_time = #{shareTime,jdbcType=TIMESTAMP},r_createtime = #{createtime,jdbcType=TIMESTAMP} where r_id = #{id,jdbcType=BIGINT}</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserRankings">update yeshi_ec_rankings_record
|
<set>
|
<if test="showId != null">r_show_id=#{showId,jdbcType=VARCHAR},</if>
|
<if test="nickName != null">r_nick_name=#{nickName,jdbcType=VARCHAR},</if>
|
<if test="portrait != null">r_portrait=#{portrait,jdbcType=VARCHAR},</if>
|
<if test="tradeReward != null">r_trade_reward=#{tradeReward,jdbcType=DECIMAL},</if>
|
<if test="shareReward != null">r_share_reward=#{shareReward,jdbcType=DECIMAL},</if>
|
<if test="tradeState != null">r_trade_state=#{tradeState,jdbcType=INTEGER},</if>
|
<if test="shareState != null">r_share_state=#{shareState,jdbcType=INTEGER},</if>
|
<if test="tradeTime != null">r_trade_time=#{tradeTime,jdbcType=TIMESTAMP},</if>
|
<if test="shareTime != null">r_share_time=#{shareTime,jdbcType=TIMESTAMP},</if>
|
<if test="createtime != null">r_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
|
</set> where r_id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<select id="selectByNickName" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List"/>
|
from yeshi_ec_rankings_record where r_nick_name = #{nickName,jdbcType=VARCHAR}
|
</select>
|
|
<select id="selectByShowId" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List"/>
|
from yeshi_ec_rankings_record where r_show_id = #{showId,jdbcType=VARCHAR}
|
</select>
|
|
<update id="updateClearTradeState" >
|
update yeshi_ec_rankings_record
|
<set>
|
r_trade_reward = 0,
|
r_trade_state = 0
|
</set>
|
WHERE r_trade_state = 1
|
</update>
|
|
<select id="query" resultMap="BaseResultMap">
|
<!-- 根据条件查询所有标签 -->
|
SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_rankings_record
|
WHERE <![CDATA[1>0]]>
|
<if test='key != null and key != ""'>
|
AND (r_show_id like '%#{key}%' OR r_nick_name like '%#{key}%')
|
</if>
|
|
<if test='tradeState != null and tradeState == 1'>
|
AND r_trade_state = #{tradeState}
|
</if>
|
|
<if test='shareState != null and shareState == 1'>
|
AND r_share_state = #{shareState}
|
</if>
|
|
<if test='tradeState != null and tradeState == 0'>
|
AND (r_trade_state = #{tradeState} or r_trade_state is null)
|
</if>
|
|
<if test='shareState != null and shareState == 0'>
|
AND (r_share_state = #{shareState} or r_share_state is null)
|
</if>
|
|
ORDER BY
|
|
<if test='sort==1'>
|
r_trade_reward,
|
</if>
|
<if test='sort==2'>
|
r_trade_reward desc,
|
</if>
|
<if test ='sort==3'>
|
r_share_reward,
|
</if>
|
<if test='sort==4'>
|
r_share_reward desc,
|
</if>
|
<if test='sort==5'>
|
r_trade_time,
|
</if>
|
<if test='sort==6'>
|
r_trade_time desc,
|
</if>
|
<if test='sort==7'>
|
r_share_time,
|
</if>
|
<if test='sort==8'>
|
r_share_time desc,
|
</if>
|
r_createtime LIMIT ${start},${count}
|
</select>
|
|
<select id="queryCount" resultType="java.lang.Long">
|
<!-- 根据条件查询所有标签 -->
|
SELECT count(r_id) FROM yeshi_ec_rankings_record
|
WHERE <![CDATA[1>0]]>
|
<if test='key != null and key != ""'>
|
AND (r_show_id like '%#{key}%' OR r_nick_name like '%#{key}%')
|
</if>
|
<if test='tradeState != null and tradeState == 1'>
|
AND r_trade_state = #{tradeState}
|
</if>
|
|
<if test='shareState != null and shareState == 1'>
|
AND r_share_state = #{shareState}
|
</if>
|
|
<if test='tradeState != null and tradeState == 0'>
|
AND (r_trade_state = #{tradeState} or r_trade_state is null)
|
</if>
|
|
<if test='shareState != null and shareState == 0'>
|
AND (r_share_state = #{shareState} or r_share_state is null)
|
</if>
|
</select>
|
|
<insert id="insertBatch" useGeneratedKeys="true" keyProperty="id" parameterType="java.util.List">
|
insert into yeshi_ec_rankings_record
|
(<include refid="Base_Column_List" />)
|
values
|
|
<foreach collection="list" item="item" separator=",">
|
(
|
#{item.id,jdbcType=BIGINT},
|
#{item.showId,jdbcType=VARCHAR},
|
#{item.nickName,jdbcType=VARCHAR},
|
#{item.portrait,jdbcType=VARCHAR},
|
#{item.tradeReward,jdbcType=DECIMAL},
|
#{item.shareReward,jdbcType=DECIMAL},
|
#{item.tradeState,jdbcType=INTEGER},
|
#{item.shareState,jdbcType=INTEGER},
|
#{item.tradeTime,jdbcType=TIMESTAMP},
|
#{item.shareTime,jdbcType=TIMESTAMP},
|
#{item.createtime,jdbcType=TIMESTAMP}
|
)
|
|
</foreach>
|
</insert>
|
|
<update id="updateBatchSelective" parameterType="java.util.List">
|
|
update yeshi_ec_rankings_record
|
<trim prefix="set" suffixOverrides=",">
|
<trim prefix="r_show_id =case" suffix="end,">
|
<foreach collection="list" item="item" index="index">
|
<if test="item.showId !=null">
|
when r_id=#{item.id} then #{item.showId}
|
</if>
|
</foreach>
|
</trim>
|
|
<trim prefix="r_nick_name =case" suffix="end,">
|
<foreach collection="list" item="item" index="index">
|
<if test="item.nickName !=null">
|
when r_id=#{item.id} then #{item.nickName}
|
</if>
|
</foreach>
|
</trim>
|
|
<trim prefix="r_portrait =case" suffix="end,">
|
<foreach collection="list" item="item" index="index">
|
<if test="item.portrait !=null">
|
when r_id=#{item.id} then #{item.portrait}
|
</if>
|
</foreach>
|
</trim>
|
|
<trim prefix="r_trade_reward =case" suffix="end,">
|
<foreach collection="list" item="item" index="index">
|
<if test="item.tradeReward !=null">
|
when r_id=#{item.id} then #{item.tradeReward}
|
</if>
|
</foreach>
|
</trim>
|
|
<trim prefix="r_share_reward =case" suffix="end,">
|
<foreach collection="list" item="item" index="index">
|
<if test="item.shareReward !=null">
|
when r_id=#{item.id} then #{item.shareReward}
|
</if>
|
</foreach>
|
</trim>
|
|
|
<trim prefix="r_trade_state =case" suffix="end,">
|
<foreach collection="list" item="item" index="index">
|
<if test="item.tradeState !=null">
|
when r_id=#{item.id} then #{item.tradeState}
|
</if>
|
</foreach>
|
</trim>
|
|
<trim prefix="r_share_state =case" suffix="end,">
|
<foreach collection="list" item="item" index="index">
|
<if test="item.shareState !=null">
|
when r_id=#{item.id} then #{item.shareState}
|
</if>
|
</foreach>
|
</trim>
|
<trim prefix="r_trade_time =case" suffix="end,">
|
<foreach collection="list" item="item" index="index">
|
<if test="item.tradeTime !=null">
|
when r_id=#{item.id} then #{item.tradeTime}
|
</if>
|
</foreach>
|
</trim>
|
<trim prefix="r_share_time =case" suffix="end,">
|
<foreach collection="list" item="item" index="index">
|
<if test="item.shareTime !=null">
|
when r_id=#{item.id} then #{item.shareTime}
|
</if>
|
</foreach>
|
</trim>
|
|
</trim>
|
where r_id in
|
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
|
#{item.id,jdbcType=BIGINT}
|
</foreach>
|
</update>
|
|
|
<select id="queryAll" resultMap="BaseResultMap">
|
<!-- 根据条件查询所有标签 -->
|
SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_rankings_record
|
</select>
|
|
<select id="listQueryByIds" resultMap="BaseResultMap" parameterType="java.util.List">
|
SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_rankings_record
|
where r_id in
|
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
|
#{item,jdbcType=BIGINT}
|
</foreach>
|
</select>
|
|
|
</mapper>
|