<?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.SpmkCustomApprovalMapper">

    <resultMap id="BaseResultMap" type="cn.timer.api.bean.spmk.SpmkCustomApproval" >
                <id column="id" property="id" />
                <result column="org_code" property="orgCode" />
                <result column="approval_g_id" property="approvalGId" />
                <result column="icon_url" property="iconUrl" />
                <result column="name" property="name" />
                <result column="description" property="description" />
                <result column="is_open" property="isOpen" />
                <result column="ranks" property="ranks" />
                <result column="is_opinion" property="isOpinion" />
                <result column="update_time" property="updateTime" />
                <result column="create_time" property="createTime" />
                <result column="asso_type" property="assoType" />
                <result column="is_allvisible" property="isAllvisible" />
                <result column="froms" property="froms" />
                <result column="router" property="router" />
    </resultMap>

    <sql id="Base_Column_List">
                id,
                org_code,
                approval_g_id,
                icon_url,
                name,
                description,
                is_open,
                ranks,
                is_opinion,
                update_time,
                create_time,
                asso_type,
                is_allvisible,
                froms,
                router
    </sql>
    
    <sql id="Base_Column_List_Alias">
                id SpmkCustomApproval_id,
                org_code SpmkCustomApproval_org_code,
                approval_g_id SpmkCustomApproval_approval_g_id,
                icon_url SpmkCustomApproval_icon_url,
                name SpmkCustomApproval_name,
                description SpmkCustomApproval_description,
                is_open SpmkCustomApproval_is_open,
                ranks SpmkCustomApproval_ranks,
                is_opinion SpmkCustomApproval_is_opinion,
                update_time SpmkCustomApproval_update_time,
                create_time SpmkCustomApproval_create_time,
                asso_type SpmkCustomApproval_asso_type,
                is_allvisible SpmkCustomApproval_is_allvisible,
                froms SpmkCustomApproval_froms,
                router SpmkCustomApproval_router
    </sql>
    
    <update id="updateListRandsById" parameterType="list">
        <foreach item="item" index="index" collection="list" open="" separator=";" close="">
	        		UPDATE spmk_custom_approval
			        <set>
			                    <if test ='null != item.ranks'>ranks = #{item.ranks},</if>
			        </set>
			        WHERE id = #{item.id}
		</foreach>
    </update>

	<!-- 

    <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.spmk.SpmkCustomApproval">
        INSERT INTO spmk_custom_approval
        <trim prefix="(" suffix=")" suffixOverrides=",">
                        <if test ='null != orgCode'>
                        org_code,
                        </if>
                        <if test ='null != approvalGId'>
                        approval_g_id,
                        </if>
                        <if test ='null != iconUrl'>
                        icon_url,
                        </if>
                        <if test ='null != name'>
                        name,
                        </if>
                        <if test ='null != description'>
                        description,
                        </if>
                        <if test ='null != isOpen'>
                        is_open,
                        </if>
                        <if test ='null != ranks'>
                        ranks,
                        </if>
                        <if test ='null != isOpinion'>
                        is_opinion,
                        </if>
                        <if test ='null != updateTime'>
                        update_time,
                        </if>
                        <if test ='null != createTime'>
                        create_time,
                        </if>
                        <if test ='null != assoType'>
                        asso_type,
                        </if>
                        <if test ='null != isAllvisible'>
                        is_allvisible,
                        </if>
                        <if test ='null != froms'>
                        froms,
                        </if>
                        <if test ='null != router'>
                        router
                        </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                        <if test ='null != orgCode'>
                        #{orgCode},
                        </if>
                        <if test ='null != approvalGId'>
                        #{approvalGId},
                        </if>
                        <if test ='null != iconUrl'>
                        #{iconUrl},
                        </if>
                        <if test ='null != name'>
                        #{name},
                        </if>
                        <if test ='null != description'>
                        #{description},
                        </if>
                        <if test ='null != isOpen'>
                        #{isOpen},
                        </if>
                        <if test ='null != ranks'>
                        #{ranks},
                        </if>
                        <if test ='null != isOpinion'>
                        #{isOpinion},
                        </if>
                        <if test ='null != updateTime'>
                        #{updateTime},
                        </if>
                        <if test ='null != createTime'>
                        #{createTime},
                        </if>
                        <if test ='null != assoType'>
                        #{assoType},
                        </if>
                        <if test ='null != isAllvisible'>
                        #{isAllvisible},
                        </if>
                        <if test ='null != froms'>
                        #{froms},
                        </if>
                        <if test ='null != router'>
                        #{router}
                        </if>
        </trim>
    </insert>

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

    <update id="update" parameterType="cn.timer.api.bean.spmk.SpmkCustomApproval">
        UPDATE spmk_custom_approval
        <set>
                    <if test ='null != orgCode'>org_code = #{orgCode},</if>
                    <if test ='null != approvalGId'>approval_g_id = #{approvalGId},</if>
                    <if test ='null != iconUrl'>icon_url = #{iconUrl},</if>
                    <if test ='null != name'>name = #{name},</if>
                    <if test ='null != description'>description = #{description},</if>
                    <if test ='null != isOpen'>is_open = #{isOpen},</if>
                    <if test ='null != ranks'>ranks = #{ranks},</if>
                    <if test ='null != isOpinion'>is_opinion = #{isOpinion},</if>
                    <if test ='null != updateTime'>update_time = #{updateTime},</if>
                    <if test ='null != createTime'>create_time = #{createTime},</if>
                    <if test ='null != assoType'>asso_type = #{assoType},</if>
                    <if test ='null != isAllvisible'>is_allvisible = #{isAllvisible},</if>
                    <if test ='null != froms'>froms = #{froms},</if>
                    <if test ='null != router'>router = #{router}</if>
        </set>
        WHERE id = #{id}
    </update>


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

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

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

	 -->

</mapper>