麻将胡了
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
<?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.ruoyi.game.mahjong.mapper.MahjongRoundMapper">
|
||||
|
||||
<select id="pickByBucket" resultType="com.ruoyi.game.mahjong.domain.MahjongRound">
|
||||
SELECT * FROM game_mahjong_round
|
||||
WHERE box_id = #{boxId} AND bucket_id = #{bucketId}
|
||||
<if test="needFreeSpins != null and needFreeSpins == true">AND free_spin_count > 0</if>
|
||||
<if test="needFreeSpins != null and needFreeSpins == false">AND free_spin_count = 0</if>
|
||||
ORDER BY RAND() LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="pickAnyByBox" resultType="com.ruoyi.game.mahjong.domain.MahjongRound">
|
||||
SELECT * FROM game_mahjong_round
|
||||
WHERE box_id = #{boxId}
|
||||
<if test="needFreeSpins != null and needFreeSpins == true">AND free_spin_count > 0</if>
|
||||
<if test="needFreeSpins != null and needFreeSpins == false">AND free_spin_count = 0</if>
|
||||
ORDER BY RAND() LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- 收敛阶段:桶内取 actual_mul 最接近 desiredMul 的回合,优先 actual_mul ≤ capMul,从 top-10 随机取1 -->
|
||||
<select id="pickClosestMul" resultType="com.ruoyi.game.mahjong.domain.MahjongRound">
|
||||
SELECT * FROM (
|
||||
SELECT * FROM game_mahjong_round
|
||||
WHERE box_id = #{boxId} AND bucket_id = #{bucketId}
|
||||
<if test="needFreeSpins != null and needFreeSpins == true">AND free_spin_count > 0</if>
|
||||
<if test="needFreeSpins != null and needFreeSpins == false">AND free_spin_count = 0</if>
|
||||
ORDER BY (CASE WHEN actual_mul <= #{capMul} THEN 0 ELSE 1 END),
|
||||
ABS(actual_mul - #{desiredMul})
|
||||
LIMIT 10
|
||||
) AS closest_pool
|
||||
ORDER BY RAND() LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- 统计某个箱子池子里每个桶"实际赔出去多少"的均值:配比计算与后台「目标RTP」按它算 -->
|
||||
<select id="avgMulByBucket" resultType="java.util.Map">
|
||||
SELECT bucket_id AS bucketId, COUNT(*) AS sampleCount, AVG(actual_mul) AS avgMul
|
||||
FROM game_mahjong_round
|
||||
WHERE box_id = #{boxId}
|
||||
GROUP BY bucket_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user