<?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.superdesk.uniorder.dao.mapper.common.UploadFilesMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.common.UploadFiles">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="uid" jdbcType="VARCHAR" property="uid" />
    <result column="app_id" jdbcType="VARCHAR" property="appId" />
    <result column="group_name" jdbcType="VARCHAR" property="groupName" />
    <result column="provider" jdbcType="VARCHAR" property="provider" />
    <result column="file_original_name" jdbcType="VARCHAR" property="fileOriginalName" />
    <result column="file_name" jdbcType="VARCHAR" property="fileName" />
    <result column="file_url" jdbcType="VARCHAR" property="fileUrl" />
    <result column="file_location" jdbcType="VARCHAR" property="fileLocation" />
    <result column="suffix" jdbcType="VARCHAR" property="suffix" />
    <result column="mime_type" jdbcType="VARCHAR" property="mimeType" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="create_user_id" jdbcType="BIGINT" property="createUserId" />
    <result column="create_user_name" jdbcType="VARCHAR" property="createUserName" />
  </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, uid, app_id, group_name, provider, file_original_name, file_name, file_url, file_location, 
    suffix, mime_type, create_time, create_user_id, create_user_name
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.common.UploadFilesExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from upload_files
    <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.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from upload_files
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from upload_files
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.common.UploadFilesExample">
    delete from upload_files
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.common.UploadFiles">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into upload_files (uid, app_id, group_name, 
      provider, file_original_name, file_name, 
      file_url, file_location, suffix, 
      mime_type, create_time, create_user_id, 
      create_user_name)
    values (#{uid,jdbcType=VARCHAR}, #{appId,jdbcType=VARCHAR}, #{groupName,jdbcType=VARCHAR}, 
      #{provider,jdbcType=VARCHAR}, #{fileOriginalName,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR}, 
      #{fileUrl,jdbcType=VARCHAR}, #{fileLocation,jdbcType=VARCHAR}, #{suffix,jdbcType=VARCHAR}, 
      #{mimeType,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{createUserId,jdbcType=BIGINT}, 
      #{createUserName,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.common.UploadFiles">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into upload_files
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="uid != null">
        uid,
      </if>
      <if test="appId != null">
        app_id,
      </if>
      <if test="groupName != null">
        group_name,
      </if>
      <if test="provider != null">
        provider,
      </if>
      <if test="fileOriginalName != null">
        file_original_name,
      </if>
      <if test="fileName != null">
        file_name,
      </if>
      <if test="fileUrl != null">
        file_url,
      </if>
      <if test="fileLocation != null">
        file_location,
      </if>
      <if test="suffix != null">
        suffix,
      </if>
      <if test="mimeType != null">
        mime_type,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="createUserId != null">
        create_user_id,
      </if>
      <if test="createUserName != null">
        create_user_name,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="uid != null">
        #{uid,jdbcType=VARCHAR},
      </if>
      <if test="appId != null">
        #{appId,jdbcType=VARCHAR},
      </if>
      <if test="groupName != null">
        #{groupName,jdbcType=VARCHAR},
      </if>
      <if test="provider != null">
        #{provider,jdbcType=VARCHAR},
      </if>
      <if test="fileOriginalName != null">
        #{fileOriginalName,jdbcType=VARCHAR},
      </if>
      <if test="fileName != null">
        #{fileName,jdbcType=VARCHAR},
      </if>
      <if test="fileUrl != null">
        #{fileUrl,jdbcType=VARCHAR},
      </if>
      <if test="fileLocation != null">
        #{fileLocation,jdbcType=VARCHAR},
      </if>
      <if test="suffix != null">
        #{suffix,jdbcType=VARCHAR},
      </if>
      <if test="mimeType != null">
        #{mimeType,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUserId != null">
        #{createUserId,jdbcType=BIGINT},
      </if>
      <if test="createUserName != null">
        #{createUserName,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.common.UploadFilesExample" resultType="java.lang.Long">
    select count(*) from upload_files
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update upload_files
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.uid != null">
        uid = #{record.uid,jdbcType=VARCHAR},
      </if>
      <if test="record.appId != null">
        app_id = #{record.appId,jdbcType=VARCHAR},
      </if>
      <if test="record.groupName != null">
        group_name = #{record.groupName,jdbcType=VARCHAR},
      </if>
      <if test="record.provider != null">
        provider = #{record.provider,jdbcType=VARCHAR},
      </if>
      <if test="record.fileOriginalName != null">
        file_original_name = #{record.fileOriginalName,jdbcType=VARCHAR},
      </if>
      <if test="record.fileName != null">
        file_name = #{record.fileName,jdbcType=VARCHAR},
      </if>
      <if test="record.fileUrl != null">
        file_url = #{record.fileUrl,jdbcType=VARCHAR},
      </if>
      <if test="record.fileLocation != null">
        file_location = #{record.fileLocation,jdbcType=VARCHAR},
      </if>
      <if test="record.suffix != null">
        suffix = #{record.suffix,jdbcType=VARCHAR},
      </if>
      <if test="record.mimeType != null">
        mime_type = #{record.mimeType,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createUserId != null">
        create_user_id = #{record.createUserId,jdbcType=BIGINT},
      </if>
      <if test="record.createUserName != null">
        create_user_name = #{record.createUserName,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update upload_files
    set id = #{record.id,jdbcType=BIGINT},
      uid = #{record.uid,jdbcType=VARCHAR},
      app_id = #{record.appId,jdbcType=VARCHAR},
      group_name = #{record.groupName,jdbcType=VARCHAR},
      provider = #{record.provider,jdbcType=VARCHAR},
      file_original_name = #{record.fileOriginalName,jdbcType=VARCHAR},
      file_name = #{record.fileName,jdbcType=VARCHAR},
      file_url = #{record.fileUrl,jdbcType=VARCHAR},
      file_location = #{record.fileLocation,jdbcType=VARCHAR},
      suffix = #{record.suffix,jdbcType=VARCHAR},
      mime_type = #{record.mimeType,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      create_user_id = #{record.createUserId,jdbcType=BIGINT},
      create_user_name = #{record.createUserName,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.common.UploadFiles">
    update upload_files
    <set>
      <if test="uid != null">
        uid = #{uid,jdbcType=VARCHAR},
      </if>
      <if test="appId != null">
        app_id = #{appId,jdbcType=VARCHAR},
      </if>
      <if test="groupName != null">
        group_name = #{groupName,jdbcType=VARCHAR},
      </if>
      <if test="provider != null">
        provider = #{provider,jdbcType=VARCHAR},
      </if>
      <if test="fileOriginalName != null">
        file_original_name = #{fileOriginalName,jdbcType=VARCHAR},
      </if>
      <if test="fileName != null">
        file_name = #{fileName,jdbcType=VARCHAR},
      </if>
      <if test="fileUrl != null">
        file_url = #{fileUrl,jdbcType=VARCHAR},
      </if>
      <if test="fileLocation != null">
        file_location = #{fileLocation,jdbcType=VARCHAR},
      </if>
      <if test="suffix != null">
        suffix = #{suffix,jdbcType=VARCHAR},
      </if>
      <if test="mimeType != null">
        mime_type = #{mimeType,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUserId != null">
        create_user_id = #{createUserId,jdbcType=BIGINT},
      </if>
      <if test="createUserName != null">
        create_user_name = #{createUserName,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.common.UploadFiles">
    update upload_files
    set uid = #{uid,jdbcType=VARCHAR},
      app_id = #{appId,jdbcType=VARCHAR},
      group_name = #{groupName,jdbcType=VARCHAR},
      provider = #{provider,jdbcType=VARCHAR},
      file_original_name = #{fileOriginalName,jdbcType=VARCHAR},
      file_name = #{fileName,jdbcType=VARCHAR},
      file_url = #{fileUrl,jdbcType=VARCHAR},
      file_location = #{fileLocation,jdbcType=VARCHAR},
      suffix = #{suffix,jdbcType=VARCHAR},
      mime_type = #{mimeType,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_user_id = #{createUserId,jdbcType=BIGINT},
      create_user_name = #{createUserName,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>