<?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="cn.cecep.talroad.mapper.AppVersionAddressManagementMapper">


    <select id="findUpToDateVersionAddress" resultType="cn.cecep.talroad.domain.AppVersionAddressManagement">
        select
        ID                            id,
        DOWNLOAD_URL                  downloadUrl,
        COALESCE(DOWNLOAD_RELATIVELY_URL, '')       downloadRelativelyUrl,
        COALESCE(LOG_IMG_URL, '')       logImgUrl,
        UPDATE_HINT                   updateHint,
        VERSION_NAME                  versionName,
        IS_FORCED_UPDATE              isForcedUpdate,
        IS_DEBUG                      isDebug,
        STATUS                        status,
        ADD_TIME                      addTime,
        UPDATE_TIME                   updateTime
        from
        app_version_address_management
        where
        STATUS = 0
        <if test="isDebug != null">
            and IS_DEBUG = #{isDebug,jdbcType=INTEGER}
        </if>
        order by ADD_TIME desc
        limit 1
    </select>
</mapper>