<?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.WxParameterSettingMapper">
    
    <resultMap type="WxParameterSetting" id="WxParameterSettingResult">
        <result property="id"    column="id"    />
        <result property="appid"    column="appid"    />
        <result property="appkey"    column="appkey"    />
        <result property="merchantId"    column="merchant_id"    />
        <result property="merchantApiKey"    column="merchant_api_key"    />
        <result property="openKey"    column="open_key"    />
        <result property="openSecret"    column="open_secret"    />
        <result property="bindingIp"    column="binding_ip"    />
        <result property="syKey"    column="sy_key"    />
        <result property="sySecret"    column="sy_secret"    />
        <result property="syUrl"    column="sy_url"    />
        <result property="syShopId"    column="sy_shop_id"    />
        <result property="status"    column="status"    />
        <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="selectWxParameterSettingVo">
        select id, appid, appkey, merchant_id, merchant_api_key, open_key, open_secret, binding_ip, sy_key, sy_secret, sy_url, sy_shop_id, status, create_by, create_time, update_by, update_time, remark from wx_parameter_setting
    </sql>

    <select id="selectWxParameterSettingList" parameterType="WxParameterSetting" resultMap="WxParameterSettingResult">
        <include refid="selectWxParameterSettingVo"/>
        <where>  
            <if test="appid != null  and appid != ''"> and appid = #{appid}</if>
            <if test="appkey != null  and appkey != ''"> and appkey = #{appkey}</if>
            <if test="merchantId != null  and merchantId != ''"> and merchant_id = #{merchantId}</if>
            <if test="merchantApiKey != null  and merchantApiKey != ''"> and merchant_api_key = #{merchantApiKey}</if>
            <if test="openKey != null  and openKey != ''"> and open_key = #{openKey}</if>
            <if test="openSecret != null  and openSecret != ''"> and open_secret = #{openSecret}</if>
            <if test="bindingIp != null  and bindingIp != ''"> and binding_ip = #{bindingIp}</if>
            <if test="syKey != null  and syKey != ''"> and sy_key = #{syKey}</if>
            <if test="sySecret != null  and sySecret != ''"> and sy_secret = #{sySecret}</if>
            <if test="syUrl != null  and syUrl != ''"> and sy_url = #{syUrl}</if>
            <if test="syShopId != null  and syShopId != ''"> and sy_shop_id = #{syShopId}</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectWxParameterSettingById" parameterType="Long" resultMap="WxParameterSettingResult">
        <include refid="selectWxParameterSettingVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertWxParameterSetting" parameterType="WxParameterSetting">
        insert into wx_parameter_setting
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="appid != null">appid,</if>
            <if test="appkey != null">appkey,</if>
            <if test="merchantId != null">merchant_id,</if>
            <if test="merchantApiKey != null">merchant_api_key,</if>
            <if test="openKey != null">open_key,</if>
            <if test="openSecret != null">open_secret,</if>
            <if test="bindingIp != null">binding_ip,</if>
            <if test="syKey != null">sy_key,</if>
            <if test="sySecret != null">sy_secret,</if>
            <if test="syUrl != null">sy_url,</if>
            <if test="syShopId != null">sy_shop_id,</if>
            <if test="status != null">status,</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="id != null">#{id},</if>
            <if test="appid != null">#{appid},</if>
            <if test="appkey != null">#{appkey},</if>
            <if test="merchantId != null">#{merchantId},</if>
            <if test="merchantApiKey != null">#{merchantApiKey},</if>
            <if test="openKey != null">#{openKey},</if>
            <if test="openSecret != null">#{openSecret},</if>
            <if test="bindingIp != null">#{bindingIp},</if>
            <if test="syKey != null">#{syKey},</if>
            <if test="sySecret != null">#{sySecret},</if>
            <if test="syUrl != null">#{syUrl},</if>
            <if test="syShopId != null">#{syShopId},</if>
            <if test="status != null">#{status},</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="updateWxParameterSetting" parameterType="WxParameterSetting">
        update wx_parameter_setting
        <trim prefix="SET" suffixOverrides=",">
            <if test="appid != null">appid = #{appid},</if>
            <if test="appkey != null">appkey = #{appkey},</if>
            <if test="merchantId != null">merchant_id = #{merchantId},</if>
            <if test="merchantApiKey != null">merchant_api_key = #{merchantApiKey},</if>
            <if test="openKey != null">open_key = #{openKey},</if>
            <if test="openSecret != null">open_secret = #{openSecret},</if>
            <if test="bindingIp != null">binding_ip = #{bindingIp},</if>
            <if test="syKey != null">sy_key = #{syKey},</if>
            <if test="sySecret != null">sy_secret = #{sySecret},</if>
            <if test="syUrl != null">sy_url = #{syUrl},</if>
            <if test="syShopId != null">sy_shop_id = #{syShopId},</if>
            <if test="status != null">status = #{status},</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="deleteWxParameterSettingById" parameterType="Long">
        delete from wx_parameter_setting where id = #{id}
    </delete>

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