<?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.liquidnet.service.kylin.mapper.KylinRoadShowsMapper">

    <resultMap id="misRoadShowListResult" type="com.liquidnet.service.kylin.dao.RoadShowAdminListDao">
        <result column="road_shows_id" property="roadShowId"/>
        <result column="title" property="title"/>
        <result column="performance_count" property="performanceCount"/>
        <result column="created_at" property="createdAt"/>
    </resultMap>

    <select id="misRoadShowList" parameterType="java.util.Map" resultMap="misRoadShowListResult">
        SELECT
        rs.road_shows_id ,
        rs.title ,
        count(pr.road_show_id) AS 'performance_count' ,
        rs.created_at
        FROM kylin_road_shows AS rs
        LEFT JOIN kylin_performance_relations AS pr ON pr.road_show_id = rs.road_shows_id
        <where>
            <if test="title!=''">
                AND rs.title LIKE concat('%', #{title}, '%')
            </if>
        </where>
        GROUP BY rs.road_shows_id
    </select>

</mapper>
