You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.8 KiB

6 years ago
<?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.ccsens.game.persist.dao.GameUserJoinDao">
6 years ago
<resultMap id="resultMap_memberInfo" type="com.ccsens.game.bean.vo.ClientVo$MemberInfo">
<id column="uId" property="id"/>
<result column="uHeadImgUrl" property="headImgUrl"/>
<result column="uNickname" property="nickname"/>
<result column="uTimes" property="times"/>
<result column="uScore" property="score"/>
</resultMap>
6 years ago
6 years ago
<update id="updateTimeBatch">
update `t_game_user_join` t
set t.local_start_time = #{startTime,jdbcType=BIGINT} + t.time_difference, t.local_end_time = #{endTime,jdbcType=BIGINT} + t.time_difference
where t.record_id = #{recordId,jdbcType=BIGINT}
</update>
6 years ago
<select id="selectTopTen" resultType="com.ccsens.game.bean.vo.ScreenVo$TopUsers">
6 years ago
select user_id, avatar_url as headImgUrl, nickname, score, score/100 as times
6 years ago
from t_game_user_join
where record_id = #{recordId,jdbcType=BIGINT}
ORDER BY score DESC
limit 10
</select>
6 years ago
<select id="selectByRecordId" parameterType="java.util.Map" resultMap="resultMap_memberInfo">
SELECT
6 years ago
user_id as uId,
6 years ago
avatar_url as uHeadImgUrl,
nickname as uNickname,
times as uTimes,
score as uScore
FROM
t_game_user_join
WHERE
record_id = #{recordId}
</select>
<select id="getRanking" resultType="int">
6 years ago
SELECT rowNo FROM
(
SELECT user_id,(@rowNum:=@rowNum+1) AS rowNo
FROM
(select user_id,score from t_game_user_join where rec_status = 0 and record_id = #{recordId,jdbcType=BIGINT}) a,
(SELECT(@rowNum:=0)) b
ORDER BY a.score DESC
) c
WHERE c.user_id= #{userId,jdbcType=BIGINT} limit 1
</select>
6 years ago
<select id="gameCount" resultType="com.ccsens.game.bean.dto.message.ChangeStatusMessageDto$CompletedData">
select count(*) as totalMembers, sum(score) as totalScore, AVG(score) as averageTimes from t_game_user_join where record_id = #{recordId,jdbcType=BIGINT}
</select>
<select id="overNum" resultType="Integer">
select count(*) from t_game_user_join where record_id = #{recordId,jdbcType=BIGINT} and score &lt; #{score,jdbcType=INTEGER}
</select>
6 years ago
<select id="getAllRanking" resultType="com.ccsens.game.bean.vo.ClientVo$MemberInfo">
SELECT a.*,(@rowNum:=@rowNum+1) AS sort
6 years ago
FROM
6 years ago
(select id,score, avatar_url as headImgUrl,nickname, times from t_game_user_join where rec_status = 0 and record_id = #{recordId,jdbcType=BIGINT}) a,
6 years ago
(SELECT(@rowNum:=0)) b
6 years ago
ORDER BY a.score DESC limit #{start}, #{pageSize}
6 years ago
</select>
6 years ago
</mapper>