<?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.base.biz.mapper.InstanceInfoMapper">

    <select id="getInstanceInfoDTOList" parameterType="com.base.biz.model.dto.request.InstanceInfoDTOListReq" resultType="com.base.biz.model.dto.InstanceInfoDTO">
        select * from instance_info
        <where>
            <if test="req.satelliteCode!=null and req.satelliteCode!=''">
                satellite_code like "%${req.satelliteCode}%"
            </if>
        </where>
        <choose>
            <when test="req.orderBy!=null and req.orderBy!=''">
                order by #{req.orderBy}
            </when>
            <otherwise>
                order by epoch_time
            </otherwise>
        </choose>
        <choose>
            <when test="req.sort!=null and req.sort!=''">
                #{req.sort}
            </when>
            <otherwise>
                desc
            </otherwise>
        </choose>
    </select>

</mapper>
