<?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.vetti.hotake.mapper.HotakeAccessibilityMapper">
    
    <resultMap type="HotakeAccessibility" id="HotakeAccessibilityResult">
        <result property="id"    column="id"    />
        <result property="colorMode"    column="color_mode"    />
        <result property="highContrastMode"    column="high_contrast_mode"    />
        <result property="reduceMotion"    column="reduce_motion"    />
        <result property="fontSize"    column="font_size"    />
        <result property="screenReaderSupport"    column="screen_reader_support"    />
        <result property="audioDescriptions"    column="audio_descriptions"    />
        <result property="enhancedKeyboardNavigation"    column="enhanced_keyboard_navigation"    />
        <result property="focusIndicators"    column="focus_indicators"    />
        <result property="language"    column="language"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectHotakeAccessibilityVo">
        select id, color_mode, high_contrast_mode, reduce_motion, font_size, 
               screen_reader_support, audio_descriptions, enhanced_keyboard_navigation, 
               focus_indicators, language,
               del_flag, create_by, create_time, update_by, update_time, remark 
        from hotake_accessibility
    </sql>

    <select id="selectHotakeAccessibilityList" parameterType="HotakeAccessibility" resultMap="HotakeAccessibilityResult">
        <include refid="selectHotakeAccessibilityVo"/>
        <where>  
            <if test="colorMode != null and colorMode != ''"> and color_mode = #{colorMode}</if>
            <if test="highContrastMode != null"> and high_contrast_mode = #{highContrastMode}</if>
            <if test="reduceMotion != null"> and reduce_motion = #{reduceMotion}</if>
            <if test="fontSize != null and fontSize != ''"> and font_size = #{fontSize}</if>
            <if test="screenReaderSupport != null"> and screen_reader_support = #{screenReaderSupport}</if>
            <if test="audioDescriptions != null"> and audio_descriptions = #{audioDescriptions}</if>
            <if test="enhancedKeyboardNavigation != null"> and enhanced_keyboard_navigation = #{enhancedKeyboardNavigation}</if>
            <if test="focusIndicators != null"> and focus_indicators = #{focusIndicators}</if>
            <if test="language != null and language != ''"> and language = #{language}</if>
            <if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
            <if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
        </where>
    </select>
    
    <select id="selectHotakeAccessibilityById" parameterType="Integer" resultMap="HotakeAccessibilityResult">
        <include refid="selectHotakeAccessibilityVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertHotakeAccessibility" parameterType="HotakeAccessibility" useGeneratedKeys="true" keyProperty="id">
        insert into hotake_accessibility
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="colorMode != null and colorMode != ''">color_mode,</if>
            <if test="highContrastMode != null">high_contrast_mode,</if>
            <if test="reduceMotion != null">reduce_motion,</if>
            <if test="fontSize != null and fontSize != ''">font_size,</if>
            <if test="screenReaderSupport != null">screen_reader_support,</if>
            <if test="audioDescriptions != null">audio_descriptions,</if>
            <if test="enhancedKeyboardNavigation != null">enhanced_keyboard_navigation,</if>
            <if test="focusIndicators != null">focus_indicators,</if>
            <if test="language != null and language != ''">language,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="colorMode != null and colorMode != ''">#{colorMode},</if>
            <if test="highContrastMode != null">#{highContrastMode},</if>
            <if test="reduceMotion != null">#{reduceMotion},</if>
            <if test="fontSize != null and fontSize != ''">#{fontSize},</if>
            <if test="screenReaderSupport != null">#{screenReaderSupport},</if>
            <if test="audioDescriptions != null">#{audioDescriptions},</if>
            <if test="enhancedKeyboardNavigation != null">#{enhancedKeyboardNavigation},</if>
            <if test="focusIndicators != null">#{focusIndicators},</if>
            <if test="language != null and language != ''">#{language},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateHotakeAccessibility" parameterType="HotakeAccessibility">
        update hotake_accessibility
        <trim prefix="SET" suffixOverrides=",">
            <if test="colorMode != null and colorMode != ''">color_mode = #{colorMode},</if>
            <if test="highContrastMode != null">high_contrast_mode = #{highContrastMode},</if>
            <if test="reduceMotion != null">reduce_motion = #{reduceMotion},</if>
            <if test="fontSize != null and fontSize != ''">font_size = #{fontSize},</if>
            <if test="screenReaderSupport != null">screen_reader_support = #{screenReaderSupport},</if>
            <if test="audioDescriptions != null">audio_descriptions = #{audioDescriptions},</if>
            <if test="enhancedKeyboardNavigation != null">enhanced_keyboard_navigation = #{enhancedKeyboardNavigation},</if>
            <if test="focusIndicators != null">focus_indicators = #{focusIndicators},</if>
            <if test="language != null and language != ''">language = #{language},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteHotakeAccessibilityById" parameterType="Integer">
        delete from hotake_accessibility where id = #{id}
    </delete>

    <delete id="deleteHotakeAccessibilityByIds" parameterType="String">
        delete from hotake_accessibility where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
