<?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.boco.nbd.wios.manage.mapper.def.UploadFileMapper">
  
<resultMap id="BaseResultMap" type="com.boco.nbd.wios.manage.entity.common.bo.UploadFile">
  <id column="id" jdbcType="INTEGER" property="id" />
  <result column="type" jdbcType="INTEGER" property="type" />
  <result column="use_type" jdbcType="INTEGER" property="useType" />
  <result column="third_party_id" jdbcType="VARCHAR" property="thirdPartyId" />
  <result column="name" jdbcType="VARCHAR" property="name" />
  <result column="url" jdbcType="VARCHAR" property="url" />
  <result column="status" jdbcType="INTEGER" property="status" />
  <result column="remark" jdbcType="VARCHAR" property="remark" />
  <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
  <result column="create_by" jdbcType="VARCHAR" property="createBy" />
  <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>

  
<sql id="Base_Column_List">
  id, type, use_type, third_party_id, name, url, status, remark, update_by, create_by, 
  update_time, create_time
</sql>

  
<delete id="delete" parameterType="java.lang.Integer">
  delete from t_upload_file
  where id = #{id,jdbcType=INTEGER}
</delete>

  
<insert id="insert" parameterType="com.boco.nbd.wios.manage.entity.common.bo.UploadFile">
  insert into t_upload_file (id, type, use_type, 
    third_party_id, name, url, 
    status, remark, update_by, 
    create_by, update_time, create_time
    )
  values (#{id,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{useType,jdbcType=INTEGER}, 
    #{thirdPartyId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, 
    #{status,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR}, 
    #{createBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}
    )
</insert>

  
<insert id="insertDynamic" parameterType="com.boco.nbd.wios.manage.entity.common.bo.UploadFile">
  insert into t_upload_file
  <trim prefix="(" suffix=")" suffixOverrides=",">
    <if test="id != null">
      id,
    </if>
    <if test="type != null">
      type,
    </if>
    <if test="useType != null">
      use_type,
    </if>
    <if test="thirdPartyId != null">
      third_party_id,
    </if>
    <if test="name != null">
      name,
    </if>
    <if test="url != null">
      url,
    </if>
    <if test="status != null">
      status,
    </if>
    <if test="remark != null">
      remark,
    </if>
    <if test="updateBy != null">
      update_by,
    </if>
    <if test="createBy != null">
      create_by,
    </if>
    <if test="updateTime != null">
      update_time,
    </if>
    <if test="createTime != null">
      create_time,
    </if>
  </trim>
  <trim prefix="values (" suffix=")" suffixOverrides=",">
    <if test="id != null">
      #{id,jdbcType=INTEGER},
    </if>
    <if test="type != null">
      #{type,jdbcType=INTEGER},
    </if>
    <if test="useType != null">
      #{useType,jdbcType=INTEGER},
    </if>
    <if test="thirdPartyId != null">
      #{thirdPartyId,jdbcType=VARCHAR},
    </if>
    <if test="name != null">
      #{name,jdbcType=VARCHAR},
    </if>
    <if test="url != null">
      #{url,jdbcType=VARCHAR},
    </if>
    <if test="status != null">
      #{status,jdbcType=INTEGER},
    </if>
    <if test="remark != null">
      #{remark,jdbcType=VARCHAR},
    </if>
    <if test="updateBy != null">
      #{updateBy,jdbcType=VARCHAR},
    </if>
    <if test="createBy != null">
      #{createBy,jdbcType=VARCHAR},
    </if>
    <if test="updateTime != null">
      #{updateTime,jdbcType=TIMESTAMP},
    </if>
    <if test="createTime != null">
      #{createTime,jdbcType=TIMESTAMP},
    </if>
  </trim>
</insert>

  
<update id="updateDynamic" parameterType="com.boco.nbd.wios.manage.entity.common.bo.UploadFile">
  update t_upload_file
  <set>
    <if test="type != null">
      type = #{type,jdbcType=INTEGER},
    </if>
    <if test="useType != null">
      use_type = #{useType,jdbcType=INTEGER},
    </if>
    <if test="thirdPartyId != null">
      third_party_id = #{thirdPartyId,jdbcType=VARCHAR},
    </if>
    <if test="name != null">
      name = #{name,jdbcType=VARCHAR},
    </if>
    <if test="url != null">
      url = #{url,jdbcType=VARCHAR},
    </if>
    <if test="status != null">
      status = #{status,jdbcType=INTEGER},
    </if>
    <if test="remark != null">
      remark = #{remark,jdbcType=VARCHAR},
    </if>
    <if test="updateBy != null">
      update_by = #{updateBy,jdbcType=VARCHAR},
    </if>
    <if test="createBy != null">
      create_by = #{createBy,jdbcType=VARCHAR},
    </if>
    <if test="updateTime != null">
      update_time = #{updateTime,jdbcType=TIMESTAMP},
    </if>
    <if test="createTime != null">
      create_time = #{createTime,jdbcType=TIMESTAMP},
    </if>
  </set>
  where id = #{id,jdbcType=INTEGER}
</update>

  
<update id="update" parameterType="com.boco.nbd.wios.manage.entity.common.bo.UploadFile">
  update t_upload_file
  set type = #{type,jdbcType=INTEGER},
    use_type = #{useType,jdbcType=INTEGER},
    third_party_id = #{thirdPartyId,jdbcType=VARCHAR},
    name = #{name,jdbcType=VARCHAR},
    url = #{url,jdbcType=VARCHAR},
    status = #{status,jdbcType=INTEGER},
    remark = #{remark,jdbcType=VARCHAR},
    update_by = #{updateBy,jdbcType=VARCHAR},
    create_by = #{createBy,jdbcType=VARCHAR},
    update_time = #{updateTime,jdbcType=TIMESTAMP},
    create_time = #{createTime,jdbcType=TIMESTAMP}
  where id = #{id,jdbcType=INTEGER}
</update>

  
<select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  select
	<include refid="Base_Column_List" />
  from  t_upload_file
  where id = #{id,jdbcType=INTEGER}
</select>

<select id="selectByExample" parameterType="com.boco.nbd.wios.manage.entity.common.bo.UploadFile"
        resultType="com.boco.nbd.wios.manage.entity.common.bo.UploadFile">
   select t.* from t_upload_file t
   <where>
	    <if test="type != null ">
	        and t.type=#{type}
	    </if>
	    <if test="thirdPartyId != null and thirdPartyId != ''">
	        and t.third_party_id = #{thirdPartyId}
	    </if>
	    <if test="status != null">
	        and t.status = #{status}
	    </if>
   </where>
</select>

<insert id="batchInsert" parameterType="java.util.List">
insert into t_upload_file (id, type,use_type, third_party_id, 
    name, url, status, 
    remark, update_by, create_by, 
    update_time, create_time)
  values 
  <foreach collection="list" item="item" separator=",">
  (#{item.id,jdbcType=INTEGER}, #{item.type,jdbcType=INTEGER}, #{item.useType,jdbcType=INTEGER}, #{item.thirdPartyId,jdbcType=VARCHAR}, 
    #{item.name,jdbcType=VARCHAR}, #{item.url,jdbcType=VARCHAR}, #{item.status,jdbcType=INTEGER}, 
    #{item.remark,jdbcType=VARCHAR}, #{item.updateBy,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR}, 
    #{item.updateTime,jdbcType=TIMESTAMP}, #{item.createTime,jdbcType=TIMESTAMP})
    </foreach>
</insert>

<delete id="deleteByTypeAndThirdPartyId">
  update t_upload_file
  set status = 2
  where type=#{type} and third_party_id = #{tPId}
</delete>

</mapper>