| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <?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="org.dromara.business.mapper.RewardClaimsMapper">
- <select id="selectVoPage2" resultType="org.dromara.business.domain.vo.RewardClaimsVo">
- SELECT
- id,
- tournament_id,
- player_id,
- `rank`,
- player_name,
- phone,
- reward_json,
- claimed,
- created_at,
- updated_at
- FROM
- reward_claims ${ew.customSqlSegment}
- </select>
- <!-- 插入数据:每个字段都做非空判断 -->
- <insert id="insert" useGeneratedKeys="true" keyProperty="id">
- INSERT INTO reward_claims
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="tournamentId != null">tournament_id,</if>
- <if test="playerId != null">player_id,</if>
- <if test="rank != null">`rank`,</if>
- <if test="playerName != null and playerName != ''">player_name,</if>
- <if test="phone != null and phone != ''">phone,</if>
- <if test="rewardJson != null">reward_json,</if>
- <if test="claimed != null">claimed,</if>
- </trim>
- VALUES
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="tournamentId != null">#{tournamentId},</if>
- <if test="playerId != null">#{playerId},</if>
- <if test="rank != null">#{rank},</if>
- <if test="playerName != null and playerName != ''">#{playerName},</if>
- <if test="phone != null and phone != ''">#{phone},</if>
- <if test="rewardJson != null">#{rewardJson},</if>
- <if test="claimed != null">#{claimed},</if>
- </trim>
- </insert>
- <!-- 更新数据:每个字段都做非空判断 -->
- <update id="updateById">
- UPDATE reward_claims
- <set>
- <if test="tournamentId != null">
- tournament_id = #{tournamentId},
- </if>
- <if test="playerId != null">
- player_id = #{playerId},
- </if>
- <if test="rank != null">
- rank = #{rank},
- </if>
- <if test="playerName != null and playerName != ''">
- player_name = #{playerName},
- </if>
- <if test="phone != null and phone != ''">
- phone = #{phone},
- </if>
- <if test="rewardJson != null">
- reward_json = #{rewardJson, typeHandler=org.apache.ibatis.type.JdbcType.VARCHAR},
- </if>
- <if test="claimed != null">
- claimed = #{claimed},
- </if>
- updated_at = NOW()
- </set>
- WHERE id = #{id}
- </update>
- <!-- 根据主键查询 -->
- <select id="selectInfoById" resultType="org.dromara.business.domain.vo.RewardClaimsVo">
- SELECT *
- FROM reward_claims
- WHERE id = #{id}
- </select>
- <!-- 条件查询 -->
- <select id="selectByCriteria" resultType="org.dromara.business.domain.vo.RewardClaimsVo">
- SELECT *
- FROM reward_claims
- <where>
- <if test="tournamentId != null">AND tournament_id = #{tournamentId}</if>
- </where>
- </select>
- <!-- 根据主键删除 -->
- <delete id="deleteById">
- DELETE FROM reward_claims
- WHERE id = #{id}
- </delete>
- <!-- 条件删除 -->
- <update id="deleteByCriteria">
- UPDATE reward_claims SET
- is_delete = true
- <where>
- <if test="id != null">AND id = #{id}</if>
- <if test="tournamentId != null">AND tournament_id = #{tournamentId}</if>
- </where>
- </update>
- <update id="updateUserRewardClaimed">
- UPDATE reward_claims
- SET
- claimed = 1,
- updated_at = NOW()
- WHERE id=#{id}
- </update>
- <update id="delUserRewardClaimed">
- UPDATE reward_claims
- SET
- is_delete = true
- updated_at = NOW()
- WHERE id=#{id}
- </update>
- <select id="selectUserRewardCount" resultType="int">
- SELECT COUNT(DISTINCT tournament_id) AS rewardCount
- FROM reward_claims
- WHERE player_id = #{playerId}
- </select>
- </mapper>
|