package org.ta.pddserver.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.ta.pdd.entity.GDReplyEntity;
import org.ta.pddserver.model.api.response.GDReplyListResponse;

import java.util.List;

@Mapper
public interface GDReplyMapper extends BaseMapper<GDReplyEntity> {

    @Select("SELECT a.* , IFNULL(GROUP_CONCAT(b.`url` SEPARATOR ';'), '') AS attach_paths FROM `gd_reply` a LEFT JOIN `gd_reply_attachment` b ON a.`uid` = b.`replyId` WHERE  a.`ticket_id` = #{ticket_id} GROUP BY a.`uid` ORDER BY a.`uid` ASC")
    List<GDReplyListResponse> findListByTicketId(@Param("ticket_id") Long ticket_id);
}
