package com.ruoyi.project.common.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.common.dto.MessageChatContentDto;
import com.ruoyi.project.common.service.IMessageChatContentService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Comparator;
import java.util.List;

/**
 * 聊天记录Controller
 *
 * @author jubs
 * @date 2024-05-14
 */
@RestController
@RequestMapping("/common/MessageChatContent")
public class MessageChatContentController extends BaseController {
    @Resource
    private IMessageChatContentService messageChatContentService;


    @GetMapping("/getPageList")
    public TableDataInfo getPageList(MessageChatContentDto messageChatContentDto) {
        startPage();
        List<MessageChatContentDto> list= messageChatContentService.getMessageChatContentListPage(messageChatContentDto.getMessageChatId());
        list.sort(Comparator.comparing(MessageChatContentDto::getCreateTime)  );
        return getDataTable(list);
    }

}
