<?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="cn.timer.api.dao.spmk.SpmkInitiatorConfigMapper">

    <resultMap id="BaseResultMap" type="cn.timer.api.bean.spmk.SpmkInitiatorConfig" >
                <id column="id" property="id" />
                <result column="custom_approval_id" property="customApprovalId" />
                <result column="asso_id" property="assoId" />
                <result column="type" property="type" />
    </resultMap>

    <sql id="Base_Column_List">
                id,
                custom_approval_id,
                asso_id,
                type
    </sql>
    
    <sql id="Base_Column_List_Alias">
                id SpmkInitiatorConfig_id,
                custom_approval_id SpmkInitiatorConfig_custom_approval_id,
                asso_id SpmkInitiatorConfig_asso_id,
                type SpmkInitiatorConfig_type
    </sql>
    
    <insert id="insertList" useGeneratedKeys="true" keyColumn="id" parameterType="list">
        INSERT INTO spmk_initiator_config 
        	(custom_approval_id,asso_id,type)
        values
        <foreach item="item" index="index" collection="list" open="" separator="," close="">
        (
        	#{item.customApprovalId},#{item.assoId},#{item.type}
        )
		</foreach>
    </insert>

	<!-- 

    <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.spmk.SpmkInitiatorConfig">
        INSERT INTO spmk_initiator_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
                        <if test ='null != customApprovalId'>
                        custom_approval_id,
                        </if>
                        <if test ='null != assoId'>
                        asso_id,
                        </if>
                        <if test ='null != type'>
                        type
                        </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                        <if test ='null != customApprovalId'>
                        #{customApprovalId},
                        </if>
                        <if test ='null != assoId'>
                        #{assoId},
                        </if>
                        <if test ='null != type'>
                        #{type}
                        </if>
        </trim>
    </insert>

    <delete id="delete" >
        DELETE FROM spmk_initiator_config
        WHERE id = #{id}
    </delete>

    <update id="update" parameterType="cn.timer.api.bean.spmk.SpmkInitiatorConfig">
        UPDATE spmk_initiator_config
        <set>
                    <if test ='null != customApprovalId'>custom_approval_id = #{customApprovalId},</if>
                    <if test ='null != assoId'>asso_id = #{assoId},</if>
                    <if test ='null != type'>type = #{type}</if>
        </set>
        WHERE id = #{id}
    </update>


    <select id="load" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM spmk_initiator_config
        WHERE id = #{id}
    </select>

    <select id="pageList" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM spmk_initiator_config
        LIMIT #{offset}, #{pageSize}
    </select>

    <select id="pageListCount" resultType="java.lang.Integer">
        SELECT count(1)
        FROM spmk_initiator_config
    </select>

	 -->

</mapper>