<?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.AlgorithmModelMapper">
  <resultMap id="BaseResultMap" type="io.renren.modules.sys.entity.algs.AlgorithmModel">
    <id column="model_id" jdbcType="BIGINT" property="modelId" />
    <result column="model_name" jdbcType="VARCHAR" property="modelName" />
    <result column="category_id" jdbcType="BIGINT" property="categoryId" />
    <result column="form" jdbcType="TINYINT" property="form" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="uid" jdbcType="BIGINT" property="uid" />
    <result column="dfs_url" jdbcType="VARCHAR" property="dfsUrl" />
    <result column="is_approvaled" jdbcType="TINYINT" property="isApprovaled" />
    <result column="app_file" jdbcType="VARCHAR" property="appFile" />
    <result column="image_file" jdbcType="VARCHAR" property="imageFile" />
    <result column="algorithm_id" jdbcType="BIGINT" property="algorithmId" />
  </resultMap>
  <sql id="Base_Column_List">
    model_id, model_name, category_id, form, remark, uid, dfs_url, is_approvaled, app_file, image_file, algorithm_id
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from algorithm_model
    where model_id = #{modelId,jdbcType=BIGINT}
  </select>

  <select id="selectByModelName" parameterType="java.lang.String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from algorithm_model
    where model_name=#{modelName,jdbcType=VARCHAR}
  </select>

  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from algorithm_model
    where model_id = #{modelId,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="io.renren.modules.sys.entity.algs.AlgorithmModel">
    insert into algorithm_model (model_id, model_name, category_id,
      form, remark, uid, dfs_url, is_approvaled, app_file, image_file, algorithm_id
      )
    values (#{modelId,jdbcType=BIGINT}, #{modelName,jdbcType=VARCHAR}, #{categoryId,jdbcType=BIGINT},
      #{form,jdbcType=TINYINT}, #{remark,jdbcType=VARCHAR}, #{uid,jdbcType=BIGINT},
      #{dfsUrl,jdbcType=VARCHAR}, #{isApprovaled,jdbcType=TINYINT}, #{appFile,jdbcType=VARCHAR},
      #{imageFile,jdbcType=VARCHAR},#{algorithmId,jdbcType=BIGINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="io.renren.modules.sys.entity.algs.AlgorithmModel">
    insert into algorithm_model
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="modelId != null">
        model_id,
      </if>
      <if test="modelName != null">
        model_name,
      </if>
      <if test="categoryId != null">
        category_id,
      </if>
      <if test="form != null">
        form,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="uid != null">
        uid,
      </if>
      <if test="dfsUrl != null">
        dfs_url,
      </if>
      <if test="isApprovaled!=null">
        is_approvaled,
      </if>
      <if test="appFile!=null">
        app_file,
      </if>
      <if test="imageFile!=null">
        image_file,
      </if>
      <if test="algorithmId!=null">
        algorithm_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="modelId != null">
        #{modelId,jdbcType=BIGINT},
      </if>
      <if test="modelName != null">
        #{modelName,jdbcType=VARCHAR},
      </if>
      <if test="categoryId != null">
        #{categoryId,jdbcType=BIGINT},
      </if>
      <if test="form != null">
        #{form,jdbcType=TINYINT},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="uid != null">
        #{uid,jdbcType=BIGINT},
      </if>
      <if test="dfsUrl != null">
        #{dfsUrl,jdbcType=VARCHAR},
      </if>
      <if test="isApprovaled!=null">
        #{isApprovaled,jdbcType=TINYINT},
      </if>
      <if test="appFile!=null">
        #{appFile,jdbcType=VARCHAR},
      </if>
      <if test="imageFile!=null">
        #{imageFile,jdbcType=VARCHAR},
      </if>
      <if test="algorithmId!=null">
        #{algorithmId,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="io.renren.modules.sys.entity.algs.AlgorithmModel">
    update algorithm_model
    <set>
      <if test="modelName != null">
        model_name = #{modelName,jdbcType=VARCHAR},
      </if>
      <if test="categoryId != null">
        category_id = #{categoryId,jdbcType=BIGINT},
      </if>
      <if test="form != null">
        form = #{form,jdbcType=TINYINT},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="uid != null">
        uid = #{uid,jdbcType=BIGINT},
      </if>
      <if test="dfsUrl != null">
        dfs_url = #{dfsUrl,jdbcType=VARCHAR},
      </if>
      <if test="isApprovaled!=null">
        is_approvaled = #{isApprovaled,jdbcType=TINYINT},
      </if>
      <if test="appFile!=null">
        app_file = #{appFile,jdbcType=VARCHAR},
      </if>
      <if test="imageFile!=null">
        image_file = #{imageFile,jdbcType=VARCHAR},
      </if>
      <if test="algorithmId!=null">
        algorithm__id = #{algorithmId,jdbcType=BIGINT},
      </if>
    </set>
    where model_id = #{modelId,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="io.renren.modules.sys.entity.algs.AlgorithmModel">
    update algorithm_model
    set model_name = #{modelName,jdbcType=VARCHAR},
      category_id = #{categoryId,jdbcType=BIGINT},
      form = #{form,jdbcType=TINYINT},
      remark = #{remark,jdbcType=VARCHAR},
      uid = #{uid,jdbcType=BIGINT},
      dfs_url = #{dfsUrl,jdbcType=VARCHAR},
      is_approvaled = #{isApprovaled,jdbcType=TINYINT},
      app_file = #{appFile,jdbcType=VARCHAR},
      image_file = #{imageFile,jdbcType=VARCHAR},
      algorithm__id = #{algorithmId,jdbcType=BIGINT}
    where model_id = #{modelId,jdbcType=BIGINT}
  </update>
</mapper>