<?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.flossom.common.core.mapper.WxModeCombineInfoMapper">

    <resultMap type="WxModeCombineInfo" id="WxModeCombineInfoResult">
        <result property="id"    column="id"    />
        <result property="modeId"    column="mode_id"    />
        <result property="combine"    column="combine"    />
        <result property="combineModeId"    column="combine_mode_id"    />
        <result property="technologyInfo"    column="technology_info"    />
        <result property="effectContent"    column="effect_content"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
    </resultMap>

    <sql id="selectWxModeCombineInfoVo">
        select id, combine_mode_id,mode_id, combine, technology_info, effect_content, create_time, create_by from wx_mode_combine_info
    </sql>

    <select id="selectWxModeCombineInfoList" parameterType="WxModeCombineInfo" resultMap="WxModeCombineInfoResult">
        <include refid="selectWxModeCombineInfoVo"/>
        <where>
            <if test="modeId != null "> and mode_id = #{modeId}</if>
            <if test="combineModeId != null "> and combine_mode_id = #{combineModeId}</if>
            <if test="combine != null "> and combine = #{combine}</if>
            <if test="technologyInfo != null  and technologyInfo != ''"> and technology_info = #{technologyInfo}</if>
            <if test="effectContent != null  and effectContent != ''"> and effect_content = #{effectContent}</if>
        </where>
        order by create_time desc
    </select>

    <select id="selectWxModeCombineInfoById" parameterType="Long" resultMap="WxModeCombineInfoResult">
        <include refid="selectWxModeCombineInfoVo"/>
        where id = #{id}
    </select>

    <insert id="insertWxModeCombineInfo" parameterType="WxModeCombineInfo">
        insert into wx_mode_combine_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="modeId != null">mode_id,</if>
            <if test="combineModeId != null">combine_mode_id,</if>
            <if test="combine != null">combine,</if>
            <if test="technologyInfo != null">technology_info,</if>
            <if test="effectContent != null">effect_content,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="modeId != null">#{modeId},</if>
            <if test="combineModeId != null">#{combineModeId},</if>
            <if test="combine != null">#{combine},</if>
            <if test="technologyInfo != null">#{technologyInfo},</if>
            <if test="effectContent != null">#{effectContent},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
         </trim>
    </insert>

    <update id="updateWxModeCombineInfo" parameterType="WxModeCombineInfo">
        update wx_mode_combine_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="modeId != null">mode_id = #{modeId},</if>
            <if test="combineModeId != null">combine_mode_id = #{combineModeId},</if>
            <if test="combine != null">combine = #{combine},</if>
            <if test="technologyInfo != null">technology_info = #{technologyInfo},</if>
            <if test="effectContent != null">effect_content = #{effectContent},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteWxModeCombineInfoById" parameterType="Long">
        delete from wx_mode_combine_info where id = #{id}
    </delete>

    <delete id="deleteWxModeCombineInfoByModeId" parameterType="Long">
        delete from wx_mode_combine_info where mode_id = #{modeId}
    </delete>


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