<?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.fdkankan.ucenter.mapper.IFolderSceneMapper">

    <select id="getByTypeNum" resultType="com.fdkankan.ucenter.entity.FolderScene">
        SELECT b.* from t_folder a left join t_folder_scene b on a.id = b.folder_id
        where  b.rec_status ='A' and b.num = #{num}
        <if test= 'type != null'>
         and a.type = #{type}
        </if>
        limit 1
    </select>

    <select id="getByType" resultType="com.fdkankan.ucenter.entity.FolderScene">
        SELECT b.* from t_folder a left join t_folder_scene b on a.id = b.folder_id
        where  b.rec_status ='A' and b.scene_id = #{sceneId}
        <if test= 'type != null'>
            and a.type = #{type}
        </if>
        limit 1
    </select>
    <select id="getGroupByFolderIds" resultType="com.fdkankan.ucenter.vo.response.GroupByCount">
        SELECT folder_id as id ,count(scene_id) as count  FROM t_folder_scene
        where rec_status = 'A'
        and folder_id in
        <foreach item="folderId" collection="folderIds" open="(" separator="," close=")">
            #{folderId}
        </foreach>
        GROUP BY folder_id
    </select>
</mapper>
