<?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="net.northking.cctp.device.db.dao.CdEngineReleasesDao">
  <resultMap id="DetailMap" type="net.northking.cctp.device.dto.engineReleases.CdEngineReleasesDetailDto">
    <!-- 主键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>


  <select id="pagingQuery"  resultMap="DetailMap" parameterType="net.northking.cctp.device.dto.engineReleases.CdEngineReleasesQueryDto">
    SELECT
    id
    ,package_name
    ,release_version
    ,release_title
    ,release_note
    ,release_by
    ,release_time
    ,resource_id
    FROM
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="releaseTitle != null">
        AND LOCATE(#{releaseTitle,jdbcType=VARCHAR},release_title) > 0
      </if>
      <if test="releaseNote != null">
        AND LOCATE(#{releaseNote,jdbcType=VARCHAR},release_note) > 0
      </if>
      <if test="packageName != null">
        AND LOCATE(#{packageName,jdbcType=VARCHAR},package_name) > 0
      </if>
    </trim>
    order by release_time desc
  </select>
  <!-- 请在本文件内添加自定义SQL语句 -->

  <select id="findPackage" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List"/>
    FROM
    <include refid="Table_Name"/>
    GROUP BY release_time DESC
    LIMIT 1
  </select>



</mapper>