visionegg | d6b2bc9 | 2025-06-09 01:52:14 +0800 | [diff] [blame^] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 3 | <mapper namespace="com.ruoyi.authentication.mapper.SysActivityMapper"> |
| 4 | <resultMap id="ActivityMap" type="com.ruoyi.authentication.domain.SysActivity"> |
| 5 | <id property="activityId" column="activity_id"/> |
| 6 | <result property="activityName" column="activity_name"/> |
| 7 | <result property="rewardBonus" column="reward_bonus"/> |
| 8 | <result property="conditionValue" column="condition_value"/> |
| 9 | <result property="startTime" column="start_time"/> |
| 10 | <result property="endTime" column="end_time"/> |
| 11 | <result property="status" column="status"/> |
| 12 | <result property="activityType" column="activity_type"/> |
| 13 | </resultMap> |
| 14 | |
| 15 | <resultMap id="LeaderboardMap" type="com.ruoyi.authentication.domain.SysActivity$LeaderboardEntry"> |
| 16 | <result property="userId" column="user_id"/> |
| 17 | <result property="userName" column="user_name"/> |
| 18 | <result property="score" column="score"/> |
| 19 | </resultMap> |
| 20 | |
| 21 | <select id="selectActivityList" resultMap="ActivityMap"> |
| 22 | select activity_id, activity_name, reward_bonus, condition_value, start_time, end_time, status, activity_type |
| 23 | from activity |
| 24 | where 1=1 |
| 25 | <if test="activityType != null and activityType != ''">and activity_type = #{activityType}</if> |
| 26 | <if test="status != null">and status = #{status}</if> |
| 27 | </select> |
| 28 | |
| 29 | <select id="selectActivityById" resultMap="ActivityMap"> |
| 30 | select activity_id, activity_name, reward_bonus, condition_value, start_time, end_time, status, activity_type |
| 31 | from activity |
| 32 | where activity_id = #{activityId} |
| 33 | </select> |
| 34 | |
| 35 | <select id="selectLeaderboard" resultMap="LeaderboardMap"> |
| 36 | select u.user_id, u.user_name, s.score |
| 37 | from sys_user u |
| 38 | join user_score s on u.user_id = s.user_id |
| 39 | order by s.score desc |
| 40 | limit 100 |
| 41 | </select> |
| 42 | </mapper> |