| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?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.TournamentEntryConditionsMapper">
- <!-- 插入数据,字段为空则插入默认值或不插入 -->
- <insert id="insert" useGeneratedKeys="true" keyProperty="id">
- INSERT INTO tournament_entry_conditions
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="tournamentId != null and tournamentId.toString() != ''">tournament_id,</if>
- <if test="itemId != null and itemId.toString() != ''">item_id,</if>
- <if test="requiredQuantity != null and requiredQuantity.toString() != ''">required_quantity,</if>
- </trim>
- VALUES
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="tournamentId != null and tournamentId.toString() != ''">#{tournamentId},</if>
- <if test="itemId != null and itemId.toString() != ''">#{itemId},</if>
- <if test="requiredQuantity != null and requiredQuantity.toString() != ''">#{requiredQuantity},</if>
- </trim>
- </insert>
- <!-- 动态更新记录 -->
- <update id="updateByTournamentId">
- UPDATE tournament_entry_conditions
- <set>
- <if test="itemId != null and itemId.toString() != ''">
- item_id = #{itemId},
- </if>
- <if test="requiredQuantity != null and requiredQuantity.toString() != ''">
- required_quantity = #{requiredQuantity},
- </if>
- updated_at = CURRENT_TIMESTAMP
- </set>
- WHERE tournament_id = #{tournamentId}
- </update>
- <!-- 删除记录,只在id有效时删除 -->
- <delete id="deleteById">
- DELETE FROM tournament_entry_conditions
- WHERE id = #{id}
- AND #{id} IS NOT NULL
- </delete>
- <!-- 查询单条记录 -->
- <select id="selectById" resultType="org.dromara.business.domain.vo.TournamentEntryConditionsVo">
- SELECT *
- FROM tournament_entry_conditions
- WHERE id = #{id}
- </select>
- <!-- 根据比赛ID查询报名条件 -->
- <select id="selectByTournamentId" resultType="org.dromara.business.domain.vo.TournamentEntryConditionsVo">
- SELECT *
- FROM tournament_entry_conditions
- WHERE tournament_id = #{tournamentId}
- </select>
- <select id="selectByTournamentInfo" resultType="org.dromara.business.domain.vo.TournamentEntryConditionsVo">
- SELECT a.tournament_id,a.item_id,a.required_quantity,b.name itemsName
- FROM tournament_entry_conditions a left join items b on a.item_id=b.id
- WHERE a.tournament_id = #{tournamentId}
- </select>
- </mapper>
|