<?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.yida.data.school.atlas.mapper.CoreAtlasManagementDetailsMapper">
    <!-- 查询图集作品列表数据 -->
    <select id="listAtlasDetailsPage" resultType="com.yida.data.school.vo.atlas.AtlasDetailsSelectPageVO">
        select id,
        school_id,
        core_atlas_management_id,
        type,
        file_path_url,
        video_img_url,
        video_time,
        description,
        like_num,
        forward_num,
        comment_num
        from core_atlas_management_details
        where del_flag = 0
        and core_atlas_management_id = #{dto.atlasId}
        order by create_date desc
    </select>

    <!-- 根据类型查询图集作品分页数据接口 -->
    <select id="listAtlasWorkByType" resultType="com.yida.data.school.vo.atlas.app.AppAtlasWorkBaseVO">
        select id,
        school_id,
        core_atlas_management_id,
        type,
        file_path_url,
        video_img_url,
        video_time,
        description,
        like_num,
        forward_num,
        comment_num
        from core_atlas_management_details
        where del_flag = 0
        and core_atlas_management_id = #{dto.atlasId}
        and type = #{dto.type}
        order by create_date desc
    </select>

    <!-- 增加图集图片或视频的总评论数 -->
    <update id="updateCommentCount">
        update core_atlas_management_details
        set comment_num = comment_num + #{changeCount}
        where id = #{coreAtlasManagementDetailsId}
    </update>
</mapper>