<?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.upyuns.platform.rs.website.mapper.IndustryApplicationInfoMapper">

    <select id="selectList" resultType="com.upyuns.platform.rs.website.entity.IndustryApplicationInfo">
        SELECT iai.*, iat1.title as firstTitle, iat2.title as secondTitle from industry_application_info iai
        LEFT JOIN industry_application_type iat1 on iat1.id = iai.first_type_id
        LEFT JOIN industry_application_type iat2 on iat2.id = iai.second_type_id
        <where>
            <if test="status != null">
               and iai.status = #{status}
            </if>
            <if test="indexShow != null">
                and iai.index_show = #{indexShow}
            </if>
            <if test="firstTypeId != null">
                and iai.first_type_id = #{firstTypeId}
            </if>
            <if test="secondTypeId != null">
                and iai.second_type_id = #{secondTypeId}
            </if>
            <if test="title != null and title != ''">
                and iai.title like concat('%', #{title}, '%')
            </if>
            and iai.is_del = 0
        </where>
        <if test="sortType == 1">
            order by iai.rank
        </if>
        <if test="sortType != 1">
            order by iai.upd_time DESC
        </if>

    </select>

</mapper>