<?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">
<!--  Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved. -->
<!--  文件内容由代码生成器产生，请不要手动修改！ -->
<!--  version: 1.0  -->
<!--  author:  maven-cctp-plugin    -->
<!--  date:  2022-09-28 14:54:23  -->
<mapper namespace="net.northking.cctp.device.db.dao.CdEngineReleasesDao">
  <resultMap id="BaseResultMap" type="net.northking.cctp.device.db.entity.CdEngineReleases">
    <!-- 主键id -->
    <id column="id" jdbcType="VARCHAR" property="id"/>
    <!-- 更新包名称 -->
    <result column="package_name" jdbcType="VARCHAR" property="packageName"/>
    <!-- 发行版本号 -->
    <result column="release_version" jdbcType="VARCHAR" property="releaseVersion"/>
    <!-- 发行标题 -->
    <result column="release_title" jdbcType="VARCHAR" property="releaseTitle"/>
    <!-- 发行内容 -->
    <result column="release_note" jdbcType="VARCHAR" property="releaseNote"/>
    <!-- 发行人 -->
    <result column="release_by" jdbcType="VARCHAR" property="releaseBy"/>
    <!-- 发行时间 -->
    <result column="release_time" jdbcType="TIMESTAMP" property="releaseTime"/>

    <result column="resource_id" jdbcType="VARCHAR" property="resourceId"/>
  </resultMap>

  <sql id="Base_Column_List">
    id
    ,package_name
    ,release_version
    ,release_title
    ,release_note
    ,release_by
    ,release_time
    ,resource_id
  </sql>

  <sql id="Table_Name">
    ${defaultSchema}.cd_engine_releases
  </sql>

  <select id="findByPrimaryKey" parameterType="String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from
    <include refid="Table_Name"/>
    where id = #{id,jdbcType=VARCHAR}
  </select>

  <select id="findByPrimaryKeys" parameterType="java.util.List">
    select
    <include refid="Base_Column_List"/>
    from
    <include refid="Table_Name"/>
    where id in
    <foreach collection="list" item="idItem" open="(" separator="," close=")">
      #{idItem, jdbcType=VARCHAR}
    </foreach>
  </select>

  <delete id="deleteByPrimaryKey" parameterType="String">
    delete from
    <include refid="Table_Name"/>
    where id = #{id,jdbcType=VARCHAR}
  </delete>

  <delete id="deleteByPrimaryKeys" parameterType="String">
    delete from
    <include refid="Table_Name"/>
    where id in
    <foreach collection="list" item="idItem" open="(" separator="," close=")">
      #{idItem, jdbcType=VARCHAR}
    </foreach>
  </delete>

  <delete id="deleteByExample" parameterType="net.northking.cctp.device.db.entity.CdEngineReleases">
    delete from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <choose>
        <when test="id != null">
          id = #{id,jdbcType=VARCHAR}
        </when>
      </choose>
              <if test="id != null">
          AND id=#{id,jdbcType=VARCHAR}
        </if>
              <if test="packageName != null">
          AND package_name=#{packageName,jdbcType=VARCHAR}
        </if>
              <if test="releaseVersion != null">
          AND release_version=#{releaseVersion,jdbcType=VARCHAR}
        </if>
              <if test="releaseTitle != null">
          AND release_title=#{releaseTitle,jdbcType=VARCHAR}
        </if>
              <if test="releaseNote != null">
          AND release_note=#{releaseNote,jdbcType=VARCHAR}
        </if>
              <if test="releaseBy != null">
          AND release_by=#{releaseBy,jdbcType=VARCHAR}
        </if>
              <if test="releaseTime != null">
          AND release_time=#{releaseTime,jdbcType=TIMESTAMP}
        </if>
              <if test="resourceId != null">
          AND resource_id=#{resourceId,jdbcType=VARCHAR}
        </if>
          </trim>
  </delete>

  <insert id="insert" parameterType="net.northking.cctp.device.db.entity.CdEngineReleases">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="packageName != null">
        package_name,
      </if>
      <if test="releaseVersion != null">
        release_version,
      </if>
      <if test="releaseTitle != null">
        release_title,
      </if>
      <if test="releaseNote != null">
        release_note,
      </if>
      <if test="releaseBy != null">
        release_by,
      </if>
      <if test="releaseTime != null">
        release_time,
      </if>
      <if test="resourceId != null">
        resource_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
          #{id, jdbcType=VARCHAR},
      </if>
      <if test="packageName != null">
          #{packageName, jdbcType=VARCHAR},
      </if>
      <if test="releaseVersion != null">
          #{releaseVersion, jdbcType=VARCHAR},
      </if>
      <if test="releaseTitle != null">
          #{releaseTitle, jdbcType=VARCHAR},
      </if>
      <if test="releaseNote != null">
          #{releaseNote, jdbcType=VARCHAR},
      </if>
      <if test="releaseBy != null">
          #{releaseBy, jdbcType=VARCHAR},
      </if>
      <if test="releaseTime != null">
          #{releaseTime, jdbcType=TIMESTAMP},
      </if>
      <if test="resourceId != null">
        #{resourceId, jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>

  <insert id="insertByBatch" parameterType="java.util.List">
    insert into
    <include refid="Table_Name"/>
    <trim prefix="(" suffix=")" suffixOverrides=",">
    id,
    package_name,
    release_version,
    release_title,
    release_note,
    release_by,
    release_time,
    resource_id,
    </trim>
    values
    <foreach collection="list" item="item" index="index" separator=",">
      <trim prefix="(" suffix=")" suffixOverrides=",">
    #{item.id, jdbcType=VARCHAR},
    #{item.packageName, jdbcType=VARCHAR},
    #{item.releaseVersion, jdbcType=VARCHAR},
    #{item.releaseTitle, jdbcType=VARCHAR},
    #{item.releaseNote, jdbcType=VARCHAR},
    #{item.releaseBy, jdbcType=VARCHAR},
    #{item.releaseTime, jdbcType=TIMESTAMP},
    #{item.resourceId, jdbcType=VARCHAR},
      </trim>
    </foreach>
  </insert>

  <update id="updateByPrimaryKey" parameterType="net.northking.cctp.device.db.entity.CdEngineReleases">
    update
    <include refid="Table_Name"/>
    <set>
      <if test="packageName != null">
        package_name = #{packageName, jdbcType=VARCHAR},
      </if>
      <if test="releaseVersion != null">
        release_version = #{releaseVersion, jdbcType=VARCHAR},
      </if>
      <if test="releaseTitle != null">
        release_title = #{releaseTitle, jdbcType=VARCHAR},
      </if>
      <if test="releaseNote != null">
        release_note = #{releaseNote, jdbcType=VARCHAR},
      </if>
      <if test="releaseBy != null">
        release_by = #{releaseBy, jdbcType=VARCHAR},
      </if>
      <if test="releaseTime != null">
        release_time = #{releaseTime, jdbcType=TIMESTAMP},
      </if>
      <if test="resourceId != null">
        resource_id = #{resourceId, jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>

  <select id="query" resultMap="BaseResultMap" parameterType="net.northking.cctp.device.db.entity.CdEngineReleases">
    select
    <include refid="Base_Column_List" />
    from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id = #{id,jdbcType=VARCHAR}
      </if>
      <if test="packageName != null">
        AND package_name = #{packageName,jdbcType=VARCHAR}
      </if>
      <if test="releaseVersion != null">
        AND release_version = #{releaseVersion,jdbcType=VARCHAR}
      </if>
      <if test="releaseTitle != null">
        AND release_title = #{releaseTitle,jdbcType=VARCHAR}
      </if>
      <if test="releaseNote != null">
        AND release_note = #{releaseNote,jdbcType=VARCHAR}
      </if>
      <if test="releaseBy != null">
        AND release_by = #{releaseBy,jdbcType=VARCHAR}
      </if>
      <if test="releaseTime != null">
        AND release_time = #{releaseTime,jdbcType=TIMESTAMP}
      </if>
      <if test="resourceId != null">
        AND resource_id = #{resourceId,jdbcType=VARCHAR}
      </if>
    </trim>
  </select>

  <select id="queryCount" resultType="java.lang.Long" parameterType="net.northking.cctp.device.db.entity.CdEngineReleases">
    select count(*) from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id=#{id,jdbcType=VARCHAR}
      </if>
      <if test="packageName != null">
        AND package_name=#{packageName,jdbcType=VARCHAR}
      </if>
      <if test="releaseVersion != null">
        AND release_version=#{releaseVersion,jdbcType=VARCHAR}
      </if>
      <if test="releaseTitle != null">
        AND release_title=#{releaseTitle,jdbcType=VARCHAR}
      </if>
      <if test="releaseNote != null">
        AND release_note=#{releaseNote,jdbcType=VARCHAR}
      </if>
      <if test="releaseBy != null">
        AND release_by=#{releaseBy,jdbcType=VARCHAR}
      </if>
      <if test="releaseTime != null">
        AND release_time=#{releaseTime,jdbcType=TIMESTAMP}
      </if>
      <if test="resourceId != null">
        AND resource_id = #{resourceId,jdbcType=VARCHAR}
      </if>
    </trim>
  </select>

</mapper>