<?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.neusoft.smart.pos.ota.persistent.mapper.ApkVersionMapper">
  <resultMap id="BaseResultMap" type="com.neusoft.smart.pos.ota.persistent.domain.ApkVersion">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="app_id" jdbcType="INTEGER" property="appId" />
    <result column="apk_name" jdbcType="VARCHAR" property="apkName" />
    <result column="apk_size" jdbcType="INTEGER" property="apkSize" />
    <result column="apk_version" jdbcType="VARCHAR" property="apkVersion" />
    <result column="apk_download_path" jdbcType="VARCHAR" property="apkDownloadPath" />
    <result column="apk_release_note" jdbcType="VARCHAR" property="apkReleaseNote" />
    <result column="create_by" jdbcType="INTEGER" property="createBy" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, app_id, apk_name, apk_size, apk_version, apk_download_path, apk_release_note, 
    create_by, create_time
  </sql>
  <select id="selectByExample" parameterType="com.neusoft.smart.pos.ota.persistent.domain.ApkVersionExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from apk_version
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    <if test="offset != null and limit != null">
      limit ${offset}, ${limit}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from apk_version
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from apk_version
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.neusoft.smart.pos.ota.persistent.domain.ApkVersionExample">
    delete from apk_version
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.ota.persistent.domain.ApkVersion" useGeneratedKeys="true">
    insert into apk_version (app_id, apk_name, apk_size, 
      apk_version, apk_download_path, apk_release_note, 
      create_by, create_time)
    values (#{appId,jdbcType=INTEGER}, #{apkName,jdbcType=VARCHAR}, #{apkSize,jdbcType=INTEGER}, 
      #{apkVersion,jdbcType=VARCHAR}, #{apkDownloadPath,jdbcType=VARCHAR}, #{apkReleaseNote,jdbcType=VARCHAR}, 
      #{createBy,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.ota.persistent.domain.ApkVersion" useGeneratedKeys="true">
    insert into apk_version
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="appId != null">
        app_id,
      </if>
      <if test="apkName != null">
        apk_name,
      </if>
      <if test="apkSize != null">
        apk_size,
      </if>
      <if test="apkVersion != null">
        apk_version,
      </if>
      <if test="apkDownloadPath != null">
        apk_download_path,
      </if>
      <if test="apkReleaseNote != null">
        apk_release_note,
      </if>
      <if test="createBy != null">
        create_by,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="appId != null">
        #{appId,jdbcType=INTEGER},
      </if>
      <if test="apkName != null">
        #{apkName,jdbcType=VARCHAR},
      </if>
      <if test="apkSize != null">
        #{apkSize,jdbcType=INTEGER},
      </if>
      <if test="apkVersion != null">
        #{apkVersion,jdbcType=VARCHAR},
      </if>
      <if test="apkDownloadPath != null">
        #{apkDownloadPath,jdbcType=VARCHAR},
      </if>
      <if test="apkReleaseNote != null">
        #{apkReleaseNote,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null">
        #{createBy,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.neusoft.smart.pos.ota.persistent.domain.ApkVersionExample" resultType="java.lang.Integer">
    select count(*) from apk_version
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update apk_version
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.appId != null">
        app_id = #{record.appId,jdbcType=INTEGER},
      </if>
      <if test="record.apkName != null">
        apk_name = #{record.apkName,jdbcType=VARCHAR},
      </if>
      <if test="record.apkSize != null">
        apk_size = #{record.apkSize,jdbcType=INTEGER},
      </if>
      <if test="record.apkVersion != null">
        apk_version = #{record.apkVersion,jdbcType=VARCHAR},
      </if>
      <if test="record.apkDownloadPath != null">
        apk_download_path = #{record.apkDownloadPath,jdbcType=VARCHAR},
      </if>
      <if test="record.apkReleaseNote != null">
        apk_release_note = #{record.apkReleaseNote,jdbcType=VARCHAR},
      </if>
      <if test="record.createBy != null">
        create_by = #{record.createBy,jdbcType=INTEGER},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update apk_version
    set id = #{record.id,jdbcType=INTEGER},
      app_id = #{record.appId,jdbcType=INTEGER},
      apk_name = #{record.apkName,jdbcType=VARCHAR},
      apk_size = #{record.apkSize,jdbcType=INTEGER},
      apk_version = #{record.apkVersion,jdbcType=VARCHAR},
      apk_download_path = #{record.apkDownloadPath,jdbcType=VARCHAR},
      apk_release_note = #{record.apkReleaseNote,jdbcType=VARCHAR},
      create_by = #{record.createBy,jdbcType=INTEGER},
      create_time = #{record.createTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.neusoft.smart.pos.ota.persistent.domain.ApkVersion">
    update apk_version
    <set>
      <if test="appId != null">
        app_id = #{appId,jdbcType=INTEGER},
      </if>
      <if test="apkName != null">
        apk_name = #{apkName,jdbcType=VARCHAR},
      </if>
      <if test="apkSize != null">
        apk_size = #{apkSize,jdbcType=INTEGER},
      </if>
      <if test="apkVersion != null">
        apk_version = #{apkVersion,jdbcType=VARCHAR},
      </if>
      <if test="apkDownloadPath != null">
        apk_download_path = #{apkDownloadPath,jdbcType=VARCHAR},
      </if>
      <if test="apkReleaseNote != null">
        apk_release_note = #{apkReleaseNote,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null">
        create_by = #{createBy,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.neusoft.smart.pos.ota.persistent.domain.ApkVersion">
    update apk_version
    set app_id = #{appId,jdbcType=INTEGER},
      apk_name = #{apkName,jdbcType=VARCHAR},
      apk_size = #{apkSize,jdbcType=INTEGER},
      apk_version = #{apkVersion,jdbcType=VARCHAR},
      apk_download_path = #{apkDownloadPath,jdbcType=VARCHAR},
      apk_release_note = #{apkReleaseNote,jdbcType=VARCHAR},
      create_by = #{createBy,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <insert id="batchInsert">
    <if test="items.get(0) != null">
            insert into apk_version  (app_id, apk_name, apk_size, 
        apk_version, apk_download_path, apk_release_note, 
        create_by, create_time)
      values
      <foreach collection="items" item="item" index="index" separator=",">
      (#{item.appId,jdbcType=INTEGER}, #{item.apkName,jdbcType=VARCHAR}, #{item.apkSize,jdbcType=INTEGER}, 
        #{item.apkVersion,jdbcType=VARCHAR}, #{item.apkDownloadPath,jdbcType=VARCHAR}, #{item.apkReleaseNote,jdbcType=VARCHAR}, 
        #{item.createBy,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP})
      </foreach>
    </if>
  </insert>
</mapper>