<?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.reptileclient.jlifeapp.dao.hm.HmDownHistoryMapper" >
  <resultMap id="BaseResultMap" type="com.reptileclient.jlifeapp.entity.hm.HmDownHistory" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="export_name" property="exportName" jdbcType="VARCHAR" />
    <result column="export_url" property="exportUrl" jdbcType="VARCHAR" />
    <result column="export_parm" property="exportParm" jdbcType="VARCHAR" />
    <result column="parm_start_time" property="parmStartTime" jdbcType="TIMESTAMP" />
    <result column="parm_end_time" property="parmEndTime" jdbcType="TIMESTAMP" />
    <result column="return_data" property="returnData" jdbcType="VARCHAR" />
    <result column="hm_excel_address" property="hmExcelAddress" jdbcType="VARCHAR" />
    <result column="local_address" property="localAddress" jdbcType="VARCHAR" />
    <result column="local_down_url" property="localDownUrl" jdbcType="VARCHAR" />
    <result column="is_read" property="isRead" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, export_name, export_url, export_parm, parm_start_time, parm_end_time, return_data, 
    hm_excel_address, local_address, local_down_url, is_read, create_time
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select 
    <include refid="Base_Column_List" />
    from hm_down_history
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from hm_down_history
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.reptileclient.jlifeapp.entity.hm.HmDownHistory" >
    insert into hm_down_history (id, export_name, export_url, 
      export_parm, parm_start_time, parm_end_time, 
      return_data, hm_excel_address, local_address, 
      local_down_url, is_read, create_time
      )
    values (#{id,jdbcType=BIGINT}, #{exportName,jdbcType=VARCHAR}, #{exportUrl,jdbcType=VARCHAR}, 
      #{exportParm,jdbcType=VARCHAR}, #{parmStartTime,jdbcType=TIMESTAMP}, #{parmEndTime,jdbcType=TIMESTAMP}, 
      #{returnData,jdbcType=VARCHAR}, #{hmExcelAddress,jdbcType=VARCHAR}, #{localAddress,jdbcType=VARCHAR}, 
      #{localDownUrl,jdbcType=VARCHAR}, #{isRead,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.reptileclient.jlifeapp.entity.hm.HmDownHistory" >
    insert into hm_down_history
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="exportName != null" >
        export_name,
      </if>
      <if test="exportUrl != null" >
        export_url,
      </if>
      <if test="exportParm != null" >
        export_parm,
      </if>
      <if test="parmStartTime != null" >
        parm_start_time,
      </if>
      <if test="parmEndTime != null" >
        parm_end_time,
      </if>
      <if test="returnData != null" >
        return_data,
      </if>
      <if test="hmExcelAddress != null" >
        hm_excel_address,
      </if>
      <if test="localAddress != null" >
        local_address,
      </if>
      <if test="localDownUrl != null" >
        local_down_url,
      </if>
      <if test="isRead != null" >
        is_read,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=BIGINT},
      </if>
      <if test="exportName != null" >
        #{exportName,jdbcType=VARCHAR},
      </if>
      <if test="exportUrl != null" >
        #{exportUrl,jdbcType=VARCHAR},
      </if>
      <if test="exportParm != null" >
        #{exportParm,jdbcType=VARCHAR},
      </if>
      <if test="parmStartTime != null" >
        #{parmStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="parmEndTime != null" >
        #{parmEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="returnData != null" >
        #{returnData,jdbcType=VARCHAR},
      </if>
      <if test="hmExcelAddress != null" >
        #{hmExcelAddress,jdbcType=VARCHAR},
      </if>
      <if test="localAddress != null" >
        #{localAddress,jdbcType=VARCHAR},
      </if>
      <if test="localDownUrl != null" >
        #{localDownUrl,jdbcType=VARCHAR},
      </if>
      <if test="isRead != null" >
        #{isRead,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.reptileclient.jlifeapp.entity.hm.HmDownHistory" >
    update hm_down_history
    <set >
      <if test="exportName != null" >
        export_name = #{exportName,jdbcType=VARCHAR},
      </if>
      <if test="exportUrl != null" >
        export_url = #{exportUrl,jdbcType=VARCHAR},
      </if>
      <if test="exportParm != null" >
        export_parm = #{exportParm,jdbcType=VARCHAR},
      </if>
      <if test="parmStartTime != null" >
        parm_start_time = #{parmStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="parmEndTime != null" >
        parm_end_time = #{parmEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="returnData != null" >
        return_data = #{returnData,jdbcType=VARCHAR},
      </if>
      <if test="hmExcelAddress != null" >
        hm_excel_address = #{hmExcelAddress,jdbcType=VARCHAR},
      </if>
      <if test="localAddress != null" >
        local_address = #{localAddress,jdbcType=VARCHAR},
      </if>
      <if test="localDownUrl != null" >
        local_down_url = #{localDownUrl,jdbcType=VARCHAR},
      </if>
      <if test="isRead != null" >
        is_read = #{isRead,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.reptileclient.jlifeapp.entity.hm.HmDownHistory" >
    update hm_down_history
    set export_name = #{exportName,jdbcType=VARCHAR},
      export_url = #{exportUrl,jdbcType=VARCHAR},
      export_parm = #{exportParm,jdbcType=VARCHAR},
      parm_start_time = #{parmStartTime,jdbcType=TIMESTAMP},
      parm_end_time = #{parmEndTime,jdbcType=TIMESTAMP},
      return_data = #{returnData,jdbcType=VARCHAR},
      hm_excel_address = #{hmExcelAddress,jdbcType=VARCHAR},
      local_address = #{localAddress,jdbcType=VARCHAR},
      local_down_url = #{localDownUrl,jdbcType=VARCHAR},
      is_read = #{isRead,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
  
  <select id="findIsRead" resultMap="BaseResultMap"  >
    select 
    <include refid="Base_Column_List" />
    from hm_down_history
   	where export_name like CONCAT(#{exportName},'%')   
    	and is_read='0'
  </select>
  
</mapper>