|
@@ -14,12 +14,14 @@
|
|
|
<result column="points" property="points" jdbcType="INTEGER"/>
|
|
<result column="points" property="points" jdbcType="INTEGER"/>
|
|
|
<result column="bonus" property="bonus" jdbcType="INTEGER"/>
|
|
<result column="bonus" property="bonus" jdbcType="INTEGER"/>
|
|
|
<result column="received" property="received" jdbcType="INTEGER"/>
|
|
<result column="received" property="received" jdbcType="INTEGER"/>
|
|
|
|
|
+ <result column="rank" property="rank" jdbcType="INTEGER"/>
|
|
|
<!--generatedEnd-->
|
|
<!--generatedEnd-->
|
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="Base_Column_List">
|
|
<sql id="Base_Column_List">
|
|
|
<!--generatedStart-->
|
|
<!--generatedStart-->
|
|
|
- id, del_flag, update_time, update_user, create_time, create_user, user_id, competition_id, points, bonus, received <!--generatedEnd-->
|
|
|
|
|
|
|
+ id, del_flag, update_time, update_user, create_time, create_user, user_id, competition_id, points, bonus,
|
|
|
|
|
+ received, rank <!--generatedEnd-->
|
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
|
|
@@ -35,7 +37,8 @@
|
|
|
WHERE id = #{id,jdbcType=INTEGER}
|
|
WHERE id = #{id,jdbcType=INTEGER}
|
|
|
</delete>
|
|
</delete>
|
|
|
|
|
|
|
|
- <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.ParticipatingInfo" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
|
|
+ <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.ParticipatingInfo" useGeneratedKeys="true"
|
|
|
|
|
+ keyProperty="id">
|
|
|
INSERT INTO participating_info
|
|
INSERT INTO participating_info
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
<!--generatedStart-->
|
|
<!--generatedStart-->
|
|
@@ -72,6 +75,9 @@
|
|
|
<if test="received!= null">
|
|
<if test="received!= null">
|
|
|
received,
|
|
received,
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="rank!= null">
|
|
|
|
|
+ rank,
|
|
|
|
|
+ </if>
|
|
|
<!--generatedEnd-->
|
|
<!--generatedEnd-->
|
|
|
</trim>
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
@@ -109,6 +115,9 @@
|
|
|
<if test="received != null">
|
|
<if test="received != null">
|
|
|
#{received,jdbcType=INTEGER},
|
|
#{received,jdbcType=INTEGER},
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="rank != null">
|
|
|
|
|
+ #{rank,jdbcType=INTEGER},
|
|
|
|
|
+ </if>
|
|
|
<!--generatedEnd-->
|
|
<!--generatedEnd-->
|
|
|
</trim>
|
|
</trim>
|
|
|
</insert>
|
|
</insert>
|
|
@@ -150,6 +159,9 @@
|
|
|
<if test="received != null">
|
|
<if test="received != null">
|
|
|
received= #{received,jdbcType=INTEGER},
|
|
received= #{received,jdbcType=INTEGER},
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="rank != null">
|
|
|
|
|
+ rank= #{rank,jdbcType=INTEGER},
|
|
|
|
|
+ </if>
|
|
|
<!--generatedEnd-->
|
|
<!--generatedEnd-->
|
|
|
</set>
|
|
</set>
|
|
|
WHERE
|
|
WHERE
|
|
@@ -161,8 +173,11 @@
|
|
|
</if>
|
|
</if>
|
|
|
</update>
|
|
</update>
|
|
|
|
|
|
|
|
- <select id="queryParticipatingInfoByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ParticipatingInfo">
|
|
|
|
|
- SELECT <include refid="Base_Column_List"/> FROM participating_info
|
|
|
|
|
|
|
+ <select id="queryParticipatingInfoByPage" parameterType="java.util.Map"
|
|
|
|
|
+ resultType="com.izouma.awesomeadmin.model.ParticipatingInfo">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
|
|
+ FROM participating_info
|
|
|
<where>
|
|
<where>
|
|
|
AND del_flag = 'N'
|
|
AND del_flag = 'N'
|
|
|
<if test="record.idStr != null and !"".equals(record.idStr)">
|
|
<if test="record.idStr != null and !"".equals(record.idStr)">
|
|
@@ -202,6 +217,9 @@
|
|
|
<if test="record.received != null and !"".equals(record.received)">
|
|
<if test="record.received != null and !"".equals(record.received)">
|
|
|
AND received = #{record.received}
|
|
AND received = #{record.received}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="record.rank != null and !"".equals(record.rank)">
|
|
|
|
|
+ AND rank = #{record.rank}
|
|
|
|
|
+ </if>
|
|
|
<!--generatedEnd-->
|
|
<!--generatedEnd-->
|
|
|
<if test="record.searchKey != null and !"".equals(record.searchKey)">
|
|
<if test="record.searchKey != null and !"".equals(record.searchKey)">
|
|
|
<trim prefix="and (" suffix=")" prefixOverrides="OR">
|
|
<trim prefix="and (" suffix=")" prefixOverrides="OR">
|
|
@@ -211,6 +229,7 @@
|
|
|
OR points LIKE concat('%',#{record.searchKey},'%')
|
|
OR points LIKE concat('%',#{record.searchKey},'%')
|
|
|
OR bonus LIKE concat('%',#{record.searchKey},'%')
|
|
OR bonus LIKE concat('%',#{record.searchKey},'%')
|
|
|
OR received LIKE concat('%',#{record.searchKey},'%')
|
|
OR received LIKE concat('%',#{record.searchKey},'%')
|
|
|
|
|
+ OR rank LIKE concat('%',#{record.searchKey},'%')
|
|
|
<!--generatedEnd-->
|
|
<!--generatedEnd-->
|
|
|
</trim>
|
|
</trim>
|
|
|
</if>
|
|
</if>
|
|
@@ -256,8 +275,11 @@
|
|
|
id DESC
|
|
id DESC
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- <select id="queryAllParticipatingInfo" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ParticipatingInfo">
|
|
|
|
|
- SELECT <include refid="Base_Column_List"/> FROM participating_info
|
|
|
|
|
|
|
+ <select id="queryAllParticipatingInfo" parameterType="java.util.Map"
|
|
|
|
|
+ resultType="com.izouma.awesomeadmin.model.ParticipatingInfo">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
|
|
+ FROM participating_info
|
|
|
<where>
|
|
<where>
|
|
|
AND del_flag = 'N'
|
|
AND del_flag = 'N'
|
|
|
<if test="idStr != null and !"".equals(idStr)">
|
|
<if test="idStr != null and !"".equals(idStr)">
|
|
@@ -297,6 +319,9 @@
|
|
|
<if test="received != null and !"".equals(received)">
|
|
<if test="received != null and !"".equals(received)">
|
|
|
AND received = #{received}
|
|
AND received = #{received}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="rank != null and !"".equals(rank)">
|
|
|
|
|
+ AND rank = #{rank}
|
|
|
|
|
+ </if>
|
|
|
<!--generatedEnd-->
|
|
<!--generatedEnd-->
|
|
|
<if test="searchKey != null and !"".equals(searchKey)">
|
|
<if test="searchKey != null and !"".equals(searchKey)">
|
|
|
<trim prefix="and (" suffix=")" prefixOverrides="OR">
|
|
<trim prefix="and (" suffix=")" prefixOverrides="OR">
|
|
@@ -306,6 +331,7 @@
|
|
|
OR points LIKE concat('%',#{searchKey},'%')
|
|
OR points LIKE concat('%',#{searchKey},'%')
|
|
|
OR bonus LIKE concat('%',#{searchKey},'%')
|
|
OR bonus LIKE concat('%',#{searchKey},'%')
|
|
|
OR received LIKE concat('%',#{searchKey},'%')
|
|
OR received LIKE concat('%',#{searchKey},'%')
|
|
|
|
|
+ OR rank LIKE concat('%',#{searchKey},'%')
|
|
|
<!--generatedEnd-->
|
|
<!--generatedEnd-->
|
|
|
</trim>
|
|
</trim>
|
|
|
</if>
|
|
</if>
|
|
@@ -350,8 +376,11 @@
|
|
|
id DESC
|
|
id DESC
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- <select id="queryParticipatingInfo" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ParticipatingInfo">
|
|
|
|
|
- SELECT <include refid="Base_Column_List"/> FROM participating_info
|
|
|
|
|
|
|
+ <select id="queryParticipatingInfo" parameterType="java.util.Map"
|
|
|
|
|
+ resultType="com.izouma.awesomeadmin.model.ParticipatingInfo">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
|
|
+ FROM participating_info
|
|
|
<where>
|
|
<where>
|
|
|
AND del_flag = 'N'
|
|
AND del_flag = 'N'
|
|
|
<!--generatedStart-->
|
|
<!--generatedStart-->
|
|
@@ -388,6 +417,9 @@
|
|
|
<if test="received != null and !"".equals(received)">
|
|
<if test="received != null and !"".equals(received)">
|
|
|
AND received = #{received}
|
|
AND received = #{received}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="rank != null and !"".equals(rank)">
|
|
|
|
|
+ AND rank = #{rank}
|
|
|
|
|
+ </if>
|
|
|
<!--generatedEnd-->
|
|
<!--generatedEnd-->
|
|
|
</where>
|
|
</where>
|
|
|
LIMIT 1
|
|
LIMIT 1
|
|
@@ -404,6 +436,7 @@
|
|
|
</if>
|
|
</if>
|
|
|
</update>
|
|
</update>
|
|
|
|
|
|
|
|
|
|
+
|
|
|
<select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ParticipatingInfo">
|
|
<select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ParticipatingInfo">
|
|
|
SELECT
|
|
SELECT
|
|
|
<include refid="Base_Column_List"/>
|
|
<include refid="Base_Column_List"/>
|
|
@@ -415,5 +448,25 @@
|
|
|
</where>
|
|
</where>
|
|
|
ORDER BY id DESC
|
|
ORDER BY id DESC
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+
|
|
|
|
|
+ <update id="updateRank">
|
|
|
|
|
+ UPDATE participating_info t1
|
|
|
|
|
+ INNER JOIN
|
|
|
|
|
+ (SELECT *, (@curRank := @curRank + 1) AS currentRank
|
|
|
|
|
+ FROM (SELECT *,
|
|
|
|
|
+ (SELECT sum(points)
|
|
|
|
|
+ FROM player_info
|
|
|
|
|
+ WHERE player_info.competition_id = #{competitionId}
|
|
|
|
|
+ AND player_info.user_id = participating_info.user_id
|
|
|
|
|
+ AND player_info.del_flag = 'N') AS p
|
|
|
|
|
+ FROM participating_info
|
|
|
|
|
+ WHERE participating_info.competition_id = #{competitionId}
|
|
|
|
|
+ AND participating_info.del_flag = 'N'
|
|
|
|
|
+ ORDER BY p DESC) a,
|
|
|
|
|
+ (SELECT @curRank := 0) b) t2 ON t1.id = t2.id
|
|
|
|
|
+ SET t1.points = t2.p,
|
|
|
|
|
+ t1.`rank` = t2.currentRank
|
|
|
|
|
+ WHERE t1.del_flag = 'N'
|
|
|
|
|
+ </update>
|
|
|
</mapper>
|
|
</mapper>
|
|
|
|
|
|