<?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.miaxis.carousel.mapper.CarouselChartInfoMapper">

    <resultMap type="CarouselChartInfo" id="CarouselChartInfoResult">
        <result property="id"    column="id"    />
        <result property="pictureName"    column="picture_name"    />
        <result property="fileId"    column="file_id"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="status"    column="status"    />
    </resultMap>

    <sql id="selectCarouselChartInfoVo">
        select id, picture_name, file_id, create_time, update_time, status from carousel_chart_info
    </sql>

    <select id="selectCarouselChartInfoList" resultType="com.miaxis.carousel.vo.CarouselChartInfoVo">
        select
        ci.id,
        ci.picture_name as pictureName,
        f.file_url as fileUrl,
        ci.status
        from carousel_chart_info ci
        LEFT JOIN file_info f on f.file_id = ci.file_id
        <where>
            <if test="pictureName != null  and pictureName != ''"> and picture_name like concat('%', #{pictureName}, '%')</if>
            <if test="fileId != null "> and file_id = #{fileId}</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
    </select>

</mapper>
