<?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.sckw.system.dao.SysVersionDao">


  <select id="findList" resultType="com.sckw.system.model.SysVersion">
    select *
      from sys_version
     where del_flag = 0
       and status = 0
    <if test="systemType != null">
      and system_type = #{systemType}
    </if>
    <if test="clientType != null and clientType != ''">
      and client_type = #{clientType}
    </if>
    <if test="versionName != null and versionName != ''">
      and version_name like concat('%', #{versionName}, '%')
    </if>
    <if test="versionCode != null and versionCode != ''">
      and version_code like concat('%', #{versionCode}, '%')
    </if>
    <if test="startTime != null">
      and update_time >= #{startTime}
    </if>
    <if test="endTime != null">
      and update_time &lt;= #{endTime}
    </if>
  </select>

  <select id="findLatestVersion" resultType="com.sckw.system.model.SysVersion">
    select *
      from sys_version
     where del_flag = 0
       and status = 0
       and client_type = #{clientType}
       and system_type = #{systemType}
     order by update_time desc
     limit 1
  </select>

</mapper>