<?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.AppBondConfigMapper">
    
    <resultMap type="AppBondConfig" id="AppBondConfigResult">
        <result property="id"    column="id"    />
        <result property="bondTitle"    column="bond_title"    />
        <result property="bondText"    column="bond_text"    />
        <result property="bondUrl"    column="bond_url"    />
        <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="selectAppBondConfigVo">
        select id, bond_title, bond_text, bond_url, remark, create_time, create_by, update_time, update_by, del_flag from app_bond_config
    </sql>

    <select id="selectAppBondConfigList" parameterType="AppBondConfig" resultMap="AppBondConfigResult">
        <include refid="selectAppBondConfigVo"/>
        <where>  
            <if test="bondTitle != null  and bondTitle != ''"> and bond_title = #{bondTitle}</if>
            <if test="bondText != null  and bondText != ''"> and bond_text = #{bondText}</if>
            <if test="bondUrl != null  and bondUrl != ''"> and bond_url = #{bondUrl}</if>
        </where>
    </select>
    
    <select id="selectAppBondConfigById" parameterType="Long" resultMap="AppBondConfigResult">
        <include refid="selectAppBondConfigVo"/>
        where id = #{id}
    </select>
    <select id="getAppBondConfig" resultType="com.ruoyi.model.domain.AppBondConfig">
        <include refid="selectAppBondConfigVo"/> where del_flag = 0;
    </select>

    <insert id="insertAppBondConfig" parameterType="AppBondConfig">
        insert into app_bond_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="bondTitle != null">bond_title,</if>
            <if test="bondText != null">bond_text,</if>
            <if test="bondUrl != null">bond_url,</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="bondTitle != null">#{bondTitle},</if>
            <if test="bondText != null">#{bondText},</if>
            <if test="bondUrl != null">#{bondUrl},</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="updateAppBondConfig" parameterType="AppBondConfig">
        update app_bond_config
        <trim prefix="SET" suffixOverrides=",">
            <if test="bondTitle != null">bond_title = #{bondTitle},</if>
            <if test="bondText != null">bond_text = #{bondText},</if>
            <if test="bondUrl != null">bond_url = #{bondUrl},</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="deleteAppBondConfigById" parameterType="Long">
        delete from app_bond_config where id = #{id}
    </delete>

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