| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?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.physical.mapper.PhysicalMemberLevelConfigMapper">
- <!-- 字段列表(用于 SELECT) -->
- <sql id="columns">
- id,
- level_name,
- level_code,
- status,
- image_url,
- main_tournament_gift_count,
- side_tournament_gift_count,
- service_voucher_gift_count,
- allow_gift,
- promotion_conditions,
- retention_conditions,
- created_at,
- updated_at,
- deleted_at
- </sql>
- <!-- 基础 WHERE 条件(排除已逻辑删除的记录) -->
- <sql id="where_not_deleted">
- WHERE deleted_at IS NULL
- </sql>
- <!-- 1. 查询所有(未删除) -->
- <select id="selectPhysicalMemberLevelConfigPage" resultType="org.dromara.physical.domain.vo.PhysicalMemberLevelConfigVo">
- SELECT
- <include refid="columns"/>
- FROM physical_member_level_config
- ${ew.customSqlSegment}
- </select>
- <!-- 2. 根据 ID 查询 -->
- <select id="selectPhysicalMemberLevelConfigById" parameterType="long" resultType="org.dromara.physical.domain.vo.PhysicalMemberLevelConfigVo">
- SELECT
- <include refid="columns"/>
- FROM physical_member_level_config
- WHERE id = #{id}
- </select>
- <!-- 1. 查询所有(未删除) -->
- <select id="selectPhysicalMemberLevelConfigList" resultType="org.dromara.physical.domain.vo.PhysicalMemberLevelConfigVo">
- SELECT
- <include refid="columns"/>
- FROM physical_member_level_config
- ${ew.customSqlSegment}
- </select>
- <!-- 5. 新增记录 -->
- <insert id="insertPhysicalMemberLevelConfig" useGeneratedKeys="true" keyProperty="id">
- INSERT INTO physical_member_level_config (
- <trim suffixOverrides=",">
- <if test="levelName != null and levelName != ''">level_name,</if>
- <if test="levelCode != null and levelCode != ''">level_code,</if>
- <if test="status != null and status != ''">status,</if>
- <if test="imageUrl != null">image_url,</if>
- <if test="mainTournamentGiftCount != null">main_tournament_gift_count,</if>
- <if test="sideTournamentGiftCount != null">side_tournament_gift_count,</if>
- <if test="serviceVoucherGiftCount != null">service_voucher_gift_count,</if>
- <if test="allowGift != null">allow_gift,</if>
- <if test="promotionConditions != null">promotion_conditions,</if>
- <if test="retentionConditions != null">retention_conditions,</if>
- created_at,
- updated_at
- </trim>
- ) VALUES (
- <trim suffixOverrides=",">
- <if test="levelName != null and levelName != ''">#{levelName},</if>
- <if test="levelCode != null and levelCode != ''">#{levelCode},</if>
- <if test="status != null and status != ''">#{status},</if>
- <if test="imageUrl != null">#{imageUrl},</if>
- <if test="mainTournamentGiftCount != null">#{mainTournamentGiftCount},</if>
- <if test="sideTournamentGiftCount != null">#{sideTournamentGiftCount},</if>
- <if test="serviceVoucherGiftCount != null">#{serviceVoucherGiftCount},</if>
- <if test="allowGift != null">#{allowGift},</if>
- <if test="promotionConditions != null">#{promotionConditions},</if>
- <if test="retentionConditions != null">#{retentionConditions},</if>
- NOW(),
- NOW()
- </trim>
- )
- </insert>
- <!-- 6. 更新记录(仅更新非空字段) -->
- <update id="updatePhysicalMemberLevelConfigById">
- UPDATE physical_member_level_config
- <set>
- <if test="levelName != null and levelName != ''">level_name = #{levelName},</if>
- <if test="levelCode != null and levelCode != ''">level_code = #{levelCode},</if>
- <if test="status != null and status != ''">status = #{status},</if>
- <if test="imageUrl != null">image_url = #{imageUrl},</if>
- <if test="mainTournamentGiftCount != null">main_tournament_gift_count = #{mainTournamentGiftCount},</if>
- <if test="sideTournamentGiftCount != null">side_tournament_gift_count = #{sideTournamentGiftCount},</if>
- <if test="serviceVoucherGiftCount != null">service_voucher_gift_count = #{serviceVoucherGiftCount},</if>
- <if test="allowGift != null">allow_gift = #{allowGift},</if>
- <if test="promotionConditions != null">promotion_conditions = #{promotionConditions},</if>
- <if test="retentionConditions != null">retention_conditions = #{retentionConditions},</if>
- updated_at = NOW()
- </set>
- WHERE id = #{id}
- AND deleted_at IS NULL
- </update>
- <!-- 删除记录 -->
- <delete id="deletePhysicalMemberLevelConfigById">
- DELETE FROM physical_member_level_config
- <where>
- id IN
- <foreach item="id" collection="ids" open="(" separator="," close=")">
- <if test="id > 0">
- #{id}
- </if>
- </foreach>
- </where>
- </delete>
- </mapper>
|