<?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.edu.whu.boot.xml.mapper.XmlEnityMapper">
    <resultMap id="BaseResultMap" type="cn.edu.whu.boot.xml.domain.XmlEnity">
        <id column="id" jdbcType="INTEGER" property="id" />
        <result column="file_name" jdbcType="VARCHAR" property="fileName" />
        <result column="md5_code" jdbcType="VARCHAR" property="md5Code" />
        <result column="file_path" jdbcType="VARCHAR" property="filePath" />
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
        <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
    </resultMap>
    <sql id="Example_Where_Clause">
        <where>
            <foreach collection="oredCriteria" item="criteria" separator="or">
                <if test="criteria.valid">
                    <trim prefix="(" prefixOverrides="and" suffix=")">
                        <foreach collection="criteria.criteria" item="criterion">
                            <choose>
                                <when test="criterion.noValue">
                                    and ${criterion.condition}
                                </when>
                                <when test="criterion.singleValue">
                                    and ${criterion.condition} #{criterion.value}
                                </when>
                                <when test="criterion.betweenValue">
                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                                </when>
                                <when test="criterion.listValue">
                                    and ${criterion.condition}
                                    <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                                        #{listItem}
                                    </foreach>
                                </when>
                            </choose>
                        </foreach>
                    </trim>
                </if>
            </foreach>
        </where>
    </sql>
    <sql id="Update_By_Example_Where_Clause">
        <where>
            <foreach collection="example.oredCriteria" item="criteria" separator="or">
                <if test="criteria.valid">
                    <trim prefix="(" prefixOverrides="and" suffix=")">
                        <foreach collection="criteria.criteria" item="criterion">
                            <choose>
                                <when test="criterion.noValue">
                                    and ${criterion.condition}
                                </when>
                                <when test="criterion.singleValue">
                                    and ${criterion.condition} #{criterion.value}
                                </when>
                                <when test="criterion.betweenValue">
                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                                </when>
                                <when test="criterion.listValue">
                                    and ${criterion.condition}
                                    <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                                        #{listItem}
                                    </foreach>
                                </when>
                            </choose>
                        </foreach>
                    </trim>
                </if>
            </foreach>
        </where>
    </sql>
    <sql id="Base_Column_List">
        id, file_name, md5_code, file_path, create_time, modify_time
    </sql>
    <select id="selectByExample" parameterType="cn.edu.whu.boot.xml.domain.XmlEnityExample" resultMap="BaseResultMap">
        select
        <if test="distinct">
            distinct
        </if>
        <include refid="Base_Column_List" />
        from xml
        <if test="_parameter != null">
            <include refid="Example_Where_Clause" />
        </if>
        <if test="orderByClause != null">
            order by ${orderByClause}
        </if>
    </select>
    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from xml
        where id = #{id,jdbcType=INTEGER}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete from xml
        where id = #{id,jdbcType=INTEGER}
    </delete>
    <delete id="deleteByExample" parameterType="cn.edu.whu.boot.xml.domain.XmlEnityExample">
        delete from xml
        <if test="_parameter != null">
            <include refid="Example_Where_Clause" />
        </if>
    </delete>
    <insert id="insert" parameterType="cn.edu.whu.boot.xml.domain.XmlEnity">
        <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
            SELECT currval('xml_id_seq'::regclass)
        </selectKey>
        insert into xml (file_name, md5_code,
        file_path, create_time, modify_time
        )
        values (#{fileName,jdbcType=VARCHAR}, #{md5Code,jdbcType=VARCHAR},
        #{filePath,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP}
        )
    </insert>
    <insert id="insertSelective" parameterType="cn.edu.whu.boot.xml.domain.XmlEnity">
        <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
            SELECT currval('xml_id_seq'::regclass)
        </selectKey>
        insert into xml
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="fileName != null">
                file_name,
            </if>
            <if test="md5Code != null">
                md5_code,
            </if>
            <if test="filePath != null">
                file_path,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="modifyTime != null">
                modify_time,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=INTEGER},
            </if>
            <if test="fileName != null">
                #{fileName,jdbcType=VARCHAR},
            </if>
            <if test="md5Code != null">
                #{md5Code,jdbcType=VARCHAR},
            </if>
            <if test="filePath != null">
                #{filePath,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="modifyTime != null">
                #{modifyTime,jdbcType=TIMESTAMP},
            </if>
        </trim>
    </insert>
    <select id="countByExample" parameterType="cn.edu.whu.boot.xml.domain.XmlEnityExample" resultType="java.lang.Long">
        select count(*) from xml
        <if test="_parameter != null">
            <include refid="Example_Where_Clause" />
        </if>
    </select>
    <update id="updateByExampleSelective" parameterType="map">
        update xml
        <set>
            <if test="record.id != null">
                id = #{record.id,jdbcType=INTEGER},
            </if>
            <if test="record.fileName != null">
                file_name = #{record.fileName,jdbcType=VARCHAR},
            </if>
            <if test="record.md5Code != null">
                md5_code = #{record.md5Code,jdbcType=VARCHAR},
            </if>
            <if test="record.filePath != null">
                file_path = #{record.filePath,jdbcType=VARCHAR},
            </if>
            <if test="record.createTime != null">
                create_time = #{record.createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="record.modifyTime != null">
                modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
            </if>
        </set>
        <if test="_parameter != null">
            <include refid="Update_By_Example_Where_Clause" />
        </if>
    </update>
    <update id="updateByExample" parameterType="map">
        update xml
        set id = #{record.id,jdbcType=INTEGER},
        file_name = #{record.fileName,jdbcType=VARCHAR},
        md5_code = #{record.md5Code,jdbcType=VARCHAR},
        file_path = #{record.filePath,jdbcType=VARCHAR},
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
        modify_time = #{record.modifyTime,jdbcType=TIMESTAMP}
        <if test="_parameter != null">
            <include refid="Update_By_Example_Where_Clause" />
        </if>
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="cn.edu.whu.boot.xml.domain.XmlEnity">
        update xml
        <set>
            <if test="fileName != null">
                file_name = #{fileName,jdbcType=VARCHAR},
            </if>
            <if test="md5Code != null">
                md5_code = #{md5Code,jdbcType=VARCHAR},
            </if>
            <if test="filePath != null">
                file_path = #{filePath,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="modifyTime != null">
                modify_time = #{modifyTime,jdbcType=TIMESTAMP},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>
    <update id="updateByPrimaryKey" parameterType="cn.edu.whu.boot.xml.domain.XmlEnity">
        update xml
        set file_name = #{fileName,jdbcType=VARCHAR},
        md5_code = #{md5Code,jdbcType=VARCHAR},
        file_path = #{filePath,jdbcType=VARCHAR},
        create_time = #{createTime,jdbcType=TIMESTAMP},
        modify_time = #{modifyTime,jdbcType=TIMESTAMP}
        where id = #{id,jdbcType=INTEGER}
    </update>
</mapper>