<?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.web.modules.content.mapper.BizMerchantEntryAgreementMapper">

    <resultMap id="BizMerchantEntryAgreementResult" type="com.ruoyi.web.modules.content.domain.BizMerchantEntryAgreement">
        <id property="configId" column="config_id"/>
        <result property="agreementTitle" column="agreement_title"/>
        <result property="versionLabel" column="version_label"/>
        <result property="content" column="content"/>
        <result property="enableFlag" column="enable_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="selectVo">
        select config_id, agreement_title, version_label, content, enable_flag,
               create_by, create_time, update_by, update_time, remark
        from biz_merchant_entry_agreement
    </sql>

    <select id="selectById" resultMap="BizMerchantEntryAgreementResult">
        <include refid="selectVo"/>
        where config_id = #{configId}
    </select>

    <insert id="insert">
        insert into biz_merchant_entry_agreement (
            config_id, agreement_title, version_label, content, enable_flag,
            create_by, create_time, remark
        ) values (
            #{configId}, #{agreementTitle}, #{versionLabel}, #{content}, #{enableFlag},
            #{createBy}, sysdate(), #{remark}
        )
    </insert>

    <update id="update">
        update biz_merchant_entry_agreement
        <set>
            agreement_title = #{agreementTitle},
            version_label = #{versionLabel},
            content = #{content},
            enable_flag = #{enableFlag},
            <if test="remark != null">remark = #{remark},</if>
            update_by = #{updateBy},
            update_time = sysdate()
        </set>
        where config_id = #{configId}
    </update>

</mapper>
