<?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.ruoyi.model.mapper.AppPlatformAgreementConfigMapper">
    
    <resultMap type="AppPlatformAgreementConfig" id="AppPlatformAgreementConfigResult">
        <result property="id"    column="id"    />
        <result property="platformAgreementText"    column="platform_agreement_text"    />
        <result property="remark"    column="remark"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="delFlag"    column="del_flag"    />
    </resultMap>

    <sql id="selectAppPlatformAgreementConfigVo">
        select id, platform_agreement_text, remark, create_time, create_by, update_time, update_by, del_flag from app_platform_agreement_config
    </sql>

    <select id="selectAppPlatformAgreementConfigList" parameterType="AppPlatformAgreementConfig" resultMap="AppPlatformAgreementConfigResult">
        <include refid="selectAppPlatformAgreementConfigVo"/>
        <where>  
            <if test="platformAgreementText != null  and platformAgreementText != ''"> and platform_agreement_text = #{platformAgreementText}</if>
        </where>
    </select>
    
    <select id="selectAppPlatformAgreementConfigById" parameterType="Long" resultMap="AppPlatformAgreementConfigResult">
        <include refid="selectAppPlatformAgreementConfigVo"/>
        where id = #{id}
    </select>
    <select id="getAppPlatformAgreementConfig" resultType="com.ruoyi.model.domain.AppPlatformAgreementConfig">
        <include refid="selectAppPlatformAgreementConfigVo"/> where del_flag = 0;
    </select>

    <insert id="insertAppPlatformAgreementConfig" parameterType="AppPlatformAgreementConfig">
        insert into app_platform_agreement_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="platformAgreementText != null">platform_agreement_text,</if>
            <if test="remark != null">remark,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="delFlag != null">del_flag,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="platformAgreementText != null">#{platformAgreementText},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="delFlag != null">#{delFlag},</if>
         </trim>
    </insert>

    <update id="updateAppPlatformAgreementConfig" parameterType="AppPlatformAgreementConfig">
        update app_platform_agreement_config
        <trim prefix="SET" suffixOverrides=",">
            <if test="platformAgreementText != null">platform_agreement_text = #{platformAgreementText},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteAppPlatformAgreementConfigById" parameterType="Long">
        delete from app_platform_agreement_config where id = #{id}
    </delete>

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