<?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="io.renren.modules.sys.dao.algs.AlgTrainMapper">
  <resultMap id="BaseResultMap" type="io.renren.modules.sys.entity.algs.AlgTrain">
    <id column="algorithm_training_id" jdbcType="BIGINT" property="algorithmTrainingId" />
    <result column="miss_name" jdbcType="VARCHAR" property="missName" />
    <result column="alg_frame_id" jdbcType="BIGINT" property="algFrameId" />
    <result column="category_id" jdbcType="BIGINT" property="categoryId" />
    <result column="miss_status" jdbcType="TINYINT" property="missStatus" />
    <result column="miss_creation_time" jdbcType="TIMESTAMP" property="missCreationTime" />
    <result column="miss_stop_time" jdbcType="TIMESTAMP" property="missStopTime" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="uid" jdbcType="BIGINT" property="uid" />
    <result column="algorithm_id" jdbcType="BIGINT" property="algorithmId" />
    <result column="version_id" jdbcType="BIGINT" property="versionId" />
    <result column="container_id" jdbcType="VARCHAR" property="containerId" />
    <result column="runfile_name" jdbcType="VARCHAR" property="runfileName" />
    <result column="ip_address" jdbcType="VARCHAR" property="ipAddress" />
    <result column="has_run" jdbcType="INTEGER" property="hasRun" />
    <result column="log_file" jdbcType="VARCHAR" property="logFile" />
    <result column="platform_id" jdbcType="VARCHAR" property="platformId" />
  </resultMap>
  <sql id="Base_Column_List">
    algorithm_training_id, miss_name, alg_frame_id, category_id, miss_status, miss_creation_time, miss_stop_time, remark,
    uid, algorithm_id, version_id, container_id, runfile_name, ip_address, has_run, log_file, platform_id
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from algorithm_training
    where algorithm_training_id = #{algorithmTrainingId,jdbcType=BIGINT}
  </select>
  <select id="selectByMissName" parameterType="java.lang.String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from algorithm_training
    where miss_name = #{missName,jdbcType=VARCHAR}
  </select>
  <select id="selectByMissNameAndPlatformId" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from algorithm_training
    where platform_id = #{platformId} and miss_name = #{missName,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from algorithm_training
    where algorithm_training_id = #{algorithmTrainingId,jdbcType=BIGINT}
  </delete>
  <insert id="insert" useGeneratedKeys="true" keyProperty="algorithmTrainingId" parameterType="io.renren.modules.sys.entity.algs.AlgTrain">
    insert into algorithm_training (algorithm_training_id, miss_name, alg_frame_id, category_id,
      miss_status, miss_creation_time, miss_stop_time, remark,
      uid, algorithm_id, version_id, 
      container_id,runfile_name,ip_address, has_run, log_file, platform_id)
    values (#{algorithmTrainingId,jdbcType=BIGINT}, #{missName,jdbcType=VARCHAR}, #{algFrameId,jdbcType=BIGINT}, #{categoryId,jdbcType=BIGINT},
      #{missStatus,jdbcType=TINYINT}, #{missCreationTime,jdbcType=TIMESTAMP}, #{missStopTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR},
      #{uid,jdbcType=BIGINT}, #{algorithmId,jdbcType=BIGINT}, #{versionId,jdbcType=BIGINT}, 
      #{containerId,jdbcType=VARCHAR},#{runfileName,jdbcType=VARCHAR},#{ipAddress,jdbcType=VARCHAR}, #{hasRun,jdbcType=INTEGER},#{logFile,jdbcType=VARCHAR},
      #{platformId,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective"  useGeneratedKeys="true" keyProperty="algorithmTrainingId" parameterType="io.renren.modules.sys.entity.algs.AlgTrain">
    insert into algorithm_training
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="algorithmTrainingId != null">
        algorithm_training_id,
      </if>
      <if test="missName != null">
        miss_name,
      </if>
      <if test="algFrameId!=null">
        alg_frame_id,
      </if>
      <if test="categoryId != null">
        category_id,
      </if>
      <if test="missStatus != null">
        miss_status,
      </if>
      <if test="missCreationTime != null">
        miss_creation_time,
      </if>
      <if test="missStopTime != null">
        miss_stop_time,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="uid != null">
        uid,
      </if>
      <if test="algorithmId != null">
        algorithm_id,
      </if>
      <if test="versionId != null">
        version_id,
      </if>
      <if test="containerId != null">
        container_id,
      </if>
      <if test="runfileName != null">
        runfile_name,
      </if>
      <if test="ipAddress != null">
        ip_address,
      </if>
      <if test="hasRun != null">
        has_run,
      </if>
      <if test="logFile != null">
        log_file,
      </if>
      <if test="platformId != null">
        platform_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="algorithmTrainingId != null">
        #{algorithmTrainingId,jdbcType=BIGINT},
      </if>
      <if test="missName != null">
        #{missName,jdbcType=VARCHAR},
      </if>
      <if test="algFrameId !=null">
        #{algFrameId,jdbcType=BIGINT},
      </if>
      <if test="categoryId != null">
        #{categoryId,jdbcType=BIGINT},
      </if>
      <if test="missStatus != null">
        #{missStatus,jdbcType=TINYINT},
      </if>
      <if test="missCreationTime != null">
        #{missCreationTime,jdbcType=TIMESTAMP},
      </if>
      <if test="missStopTime != null">
        #{missStopTime,jdbcType=TIMESTAMP},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="uid != null">
        #{uid,jdbcType=BIGINT},
      </if>
      <if test="algorithmId != null">
        #{algorithmId,jdbcType=BIGINT},
      </if>
      <if test="versionId != null">
        #{versionId,jdbcType=BIGINT},
      </if>
      <if test="containerId != null">
        #{containerId,jdbcType=VARCHAR},
      </if>
      <if test="runfileName != null">
        #{runfileName,jdbcType=VARCHAR},
      </if>
      <if test="ipAddress != null">
        #{ipAddress,jdbcType=VARCHAR},
      </if>
      <if test="hasRun != null">
        #{hasRun,jdbcType=INTEGER},
      </if>
      <if test="logFile != null">
        #{logFile,jdbcType=VARCHAR},
      </if>
      <if test="platformId != null">
        #{aplatformId,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="io.renren.modules.sys.entity.algs.AlgTrain">
    update algorithm_training
    <set>
      <if test="missName != null">
        miss_name = #{missName,jdbcType=VARCHAR},
      </if>
      <if test="algFrameId !=null">
        alg_frame_id = #{algFrameId,jdbcType=BIGINT},
      </if>
      <if test="categoryId != null">
        category_id = #{categoryId,jdbcType=BIGINT},
      </if>
      <if test="missStatus != null">
        miss_status = #{missStatus,jdbcType=TINYINT},
      </if>
      <if test="missCreationTime != null">
        miss_creation_time = #{missCreationTime,jdbcType=TIMESTAMP},
      </if>
      <if test="missStopTime != null">
        miss_stop_time = #{missStopTime,jdbcType=TIMESTAMP},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="uid != null">
        uid = #{uid,jdbcType=BIGINT},
      </if>
      <if test="algorithmId != null">
        algorithm_id = #{algorithmId,jdbcType=BIGINT},
      </if>
      <if test="versionId != null">
        version_id = #{versionId,jdbcType=BIGINT},
      </if>
      <if test="containerId != null">
        container_id = #{containerId,jdbcType=VARCHAR},
      </if>
      <if test="runfileName != null">
        runfile_name = #{runfileName,jdbcType=VARCHAR},
      </if>
      <if test="ipAddress !=null">
        ip_address = #{ipAddress,jdbcType=VARCHAR},
      </if>
      <if test="hasRun !=null">
        has_run = #{hasRun,jdbcType=INTEGER},
      </if>
      <if test="logFile !=null">
        log_file = #{logFile,jdbcType=VARCHAR},
      </if>
      <if test="platformId !=null">
        platform_id = #{platformId,jdbcType=BIGINT},
      </if>
    </set>
    where algorithm_training_id = #{algorithmTrainingId,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="io.renren.modules.sys.entity.algs.AlgTrain">
    update algorithm_training
    set miss_name = #{missName,jdbcType=VARCHAR},
      alg_frame_id = #{algFrameId,jdbcType=BIGINT},
      category_id = #{categoryId,jdbcType=BIGINT},
      miss_status = #{missStatus,jdbcType=TINYINT},
      miss_creation_time = #{missCreationTime,jdbcType=TIMESTAMP},
      miss_stop_time = #{missStopTime,jdbcType=TIMESTAMP},
      remark = #{remark,jdbcType=VARCHAR},
      uid = #{uid,jdbcType=BIGINT},
      algorithm_id = #{algorithmId,jdbcType=BIGINT},
      version_id = #{versionId,jdbcType=BIGINT},
      container_id = #{containerId,jdbcType=VARCHAR},
      runfile_name=#{runfileName,jdbcType=VARCHAR},
      ip_address = #{ipAddress,jdbcType=VARCHAR},
      has_run = #{hasRun,jdbcType=INTEGER},
      log_file = #{logFile,jdbcType=VARCHAR},
      platform_id = #{platformId,jdbcType=BIGINT},
    where algorithm_training_id = #{algorithmTrainingId,jdbcType=BIGINT}
  </update>
</mapper>