<?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.zcxk.process.dao.UserFormMapper">
    <!--auto generated Code-->
    <resultMap id="BaseResultMap" type="com.zcxk.process.entity.UserForm">
        <result column="id" property="id" jdbcType="INTEGER"/>
        <result column="form_name" property="formName" jdbcType="VARCHAR"/>
        <result column="form_key" property="formKey" jdbcType="VARCHAR"/>
        <result column="form_category" property="formCategory" jdbcType="VARCHAR"/>
        <result column="status" property="status" jdbcType="INTEGER"/>
        <result column="create_by" property="createBy" jdbcType="VARCHAR"/>
        <result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
        <result column="date_create" property="dateCreate" jdbcType="TIMESTAMP"/>
        <result column="date_update" property="dateUpdate" jdbcType="TIMESTAMP"/>
        <result column="form_content" property="formContent" jdbcType="VARCHAR"/>
    </resultMap>

    <!--auto generated Code-->
    <sql id="Base_Column_List">
        id,
        form_name,
        form_key,
        form_category,
        status,
        create_by,
        update_by,
        date_create,
        date_update,
        form_content
    </sql>

    <!--auto generated Code-->
    <insert id="insert" useGeneratedKeys="true" keyProperty="userForm.id">
        INSERT INTO sc_user_form (
        id,
        form_name,
        form_key,
        form_category,
        status,
        create_by,
        update_by,
        date_create,
        date_update,
        form_content
        ) VALUES (
        #{userForm.id,jdbcType=INTEGER},
        #{userForm.formName,jdbcType=VARCHAR},
        #{userForm.formKey,jdbcType=VARCHAR},
        #{userForm.formCategory,jdbcType=VARCHAR},
        #{userForm.status,jdbcType=INTEGER},
        #{userForm.createBy,jdbcType=VARCHAR},
        #{userForm.updateBy,jdbcType=VARCHAR},
        #{userForm.dateCreate,jdbcType=TIMESTAMP},
        #{userForm.dateUpdate,jdbcType=TIMESTAMP},
        #{userForm.formContent,jdbcType=VARCHAR}
        )
    </insert>

    <!--auto generated Code-->
    <insert id="insertSelective" useGeneratedKeys="true" keyProperty="userForm.id">
        INSERT INTO sc_user_form
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="userForm.id!=null">id,</if>
            <if test="userForm.formName!=null">form_name,</if>
            <if test="userForm.formKey!=null">form_key,</if>
            <if test="userForm.formCategory!=null">form_category,</if>
            <if test="userForm.status!=null">status,</if>
            <if test="userForm.createBy!=null">create_by,</if>
            <if test="userForm.updateBy!=null">update_by,</if>
            <if test="userForm.dateCreate!=null">date_create,</if>
            <if test="userForm.dateUpdate!=null">date_update,</if>
            <if test="userForm.formContent!=null">form_content,</if>
        </trim>
        VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="userForm.id!=null">#{userForm.id,jdbcType=INTEGER},
            </if>
            <if test="userForm.formName!=null">#{userForm.formName,jdbcType=VARCHAR},
            </if>
            <if test="userForm.formKey!=null">#{userForm.formKey,jdbcType=VARCHAR},
            </if>
            <if test="userForm.formCategory!=null">#{userForm.formCategory,jdbcType=VARCHAR},
            </if>
            <if test="userForm.status!=null">#{userForm.status,jdbcType=INTEGER},
            </if>
            <if test="userForm.createBy!=null">#{userForm.createBy,jdbcType=VARCHAR},
            </if>
            <if test="userForm.updateBy!=null">#{userForm.updateBy,jdbcType=VARCHAR},
            </if>
            <if test="userForm.dateCreate!=null">#{userForm.dateCreate,jdbcType=TIMESTAMP},
            </if>
            <if test="userForm.dateUpdate!=null">#{userForm.dateUpdate,jdbcType=TIMESTAMP},
            </if>
            <if test="userForm.formContent!=null">#{userForm.formContent,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>

    <!--auto generated Code-->
    <insert id="insertList">
        INSERT INTO sc_user_form (
        id,
        form_name,
        form_key,
        form_category,
        status,
        create_by,
        update_by,
        date_create,
        date_update,
        form_content
        )VALUES
        <foreach collection="userForms" item="userForm" index="index" separator=",">
            (
            #{userForm.id,jdbcType=INTEGER},
            #{userForm.formName,jdbcType=VARCHAR},
            #{userForm.formKey,jdbcType=VARCHAR},
            #{userForm.formCategory,jdbcType=VARCHAR},
            #{userForm.status,jdbcType=INTEGER},
            #{userForm.createBy,jdbcType=VARCHAR},
            #{userForm.updateBy,jdbcType=VARCHAR},
            #{userForm.dateCreate,jdbcType=TIMESTAMP},
            #{userForm.dateUpdate,jdbcType=TIMESTAMP},
            #{userForm.formContent,jdbcType=VARCHAR}
            )
        </foreach>
    </insert>

    <!--auto generated Code-->
    <update id="updateByPrimaryKeySelective">
        UPDATE sc_user_form
        <set>
            <if test="userForm.formName != null">form_name= #{userForm.formName,jdbcType=VARCHAR},</if>
            <if test="userForm.formKey != null">form_key= #{userForm.formKey,jdbcType=VARCHAR},</if>
            <if test="userForm.formCategory != null">form_category= #{userForm.formCategory,jdbcType=VARCHAR},</if>
            <if test="userForm.status != null">status= #{userForm.status,jdbcType=INTEGER},</if>
            <if test="userForm.createBy != null">create_by= #{userForm.createBy,jdbcType=VARCHAR},</if>
            <if test="userForm.updateBy != null">update_by= #{userForm.updateBy,jdbcType=VARCHAR},</if>
            <if test="userForm.dateCreate != null">date_create= #{userForm.dateCreate,jdbcType=TIMESTAMP},</if>
            <if test="userForm.dateUpdate != null">date_update= #{userForm.dateUpdate,jdbcType=TIMESTAMP},</if>
            <if test="userForm.formContent != null">form_content= #{userForm.formContent,jdbcType=VARCHAR}</if>
        </set>
        WHERE id = #{userForm.id,jdbcType=INTEGER}
    </update>
    <select id="list" resultType="com.zcxk.process.entity.UserForm">
        select
        <include refid="Base_Column_List"/>
        from
        sc_user_form
        where status = 1
        <if test="param.formKey != null">
            and form_key = #{param.formKey}
        </if>
    </select>
    <select id="singleQuery" resultType="com.zcxk.process.entity.UserForm">
        select
        <include refid="Base_Column_List"/>
        from
        sc_user_form
        where status = 1
        <if test="param.formKey != null">
            and form_key = #{param.formKey}
        </if>
        limit 1
    </select>
</mapper>

