<?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.huatek.busi.mapper.ScheduleJobLogMapper">
      <resultMap id="BaseResultMap" type="com.huatek.busi.vo.ScheduleJobLogVo">
        <result column="id" property="id"/>
        <result column="job_id" property="jobId"/>
        <result column="bean_name" property="beanName"/>
        <result column="method_name" property="methodName"/>
         <result column="params" property="params"/>
        <result column="status" property="status"/>
        <result column="error" property="error"/>
        <result column="create_time" property="createTime"/>
    </resultMap>
    <sql id="Base_Column_List">
    	id, job_id, bean_name, method_name, params,status,error,times,create_time
  	</sql>
    <select id="findScheduleJobLogPage" parameterType="com.huatek.busi.dto.ScheduleJobLogDto" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM
        schedule_job_log j
        WHERE 1=1
        <if test="beanName != null and beanName != ''">
             and j.bean_name = #{beanName}
        </if>
        ORDER BY j.create_time DESC
    </select>
    <insert id="insertScheduleJobLog"  parameterType="com.huatek.busi.entity.ScheduleJobLog">
    	insert into schedule_job_log
	    <trim prefix="(" suffix=")" suffixOverrides=",">
	      <if test="id != null and id != ''">
	        id,
	      </if>
	      <if test="jobId != null and jobId != ''">
	        job_id,
	      </if>
	      <if test="beanName != null and beanName != ''">
	        bean_name,
	      </if>
	      <if test="methodName != null and methodName != ''">
	        method_name,
	      </if>
	      <if test="params != null and params != ''">
	        params,
	      </if>
	      <if test="status != null">
	        status,
	      </if>
	      <if test="error != null and error != ''">
	        error,
	      </if>
	       <if test="times != null">
	        times,
	      </if>
	      <if test="createTime != null">
	        create_time,
	      </if>
	    </trim>
	    <trim prefix="values (" suffix=")" suffixOverrides=",">
	      <if test="id != null and id != ''">
	        #{id,jdbcType=CHAR},
	      </if>
	       <if test="jobId != null and jobId != ''">
	        #{jobId,jdbcType=CHAR},
	      </if>
	      <if test="beanName != null and beanName != ''">
	        #{beanName,jdbcType=VARCHAR},
	      </if>
	     <if test="methodName != null and methodName != ''">
	        #{methodName,jdbcType=VARCHAR},
	      </if>
	      <if test="params != null and params != ''">
	        #{params,jdbcType=VARCHAR},
	      </if>
	     <if test="status != null">
	        #{status,jdbcType=INTEGER},
	      </if>
	      <if test="error != null and error != ''">
	        #{error,jdbcType=VARCHAR},
	      </if>
	     <if test="times != null">
	        #{times,jdbcType=INTEGER},
	      </if>
	      <if test="createTime != null">
	        #{createTime,jdbcType=TIMESTAMP},
	      </if>
	    </trim>
    </insert>
</mapper>