package com.cyksj.model.manage.views;

import com.ejlchina.searcher.SearchResult;
import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.DbIgnore;
import com.ejlchina.searcher.bean.SearchBean;
import lombok.Data;

import java.util.List;

/**
 * 会话聊天框列表
 * @author chan
 * @date 2024/1/22 17:16
 */
@Data
@SearchBean(tables = "(SELECT external_userid userid, q.follow_id follow_id, MAX(id) msgId " +
        "FROM qy_msg_content q " +
        " :keyword: " +
        "GROUP BY q.external_userid , q.follow_id " +
        "ORDER BY MAX(q.id) desc limit 1) t " +
        "LEFT JOIN qy_msg_content qm on qm.id = t.msgId " +
        "LEFT JOIN corp_user_auth cu on cu.external_userid = t.userid " +
        "LEFT JOIN corp_user c on c.id = cu.corp_user_id "
)
public class CorpFollowMsgView {

    /**
     * 用户名称
     */
    @DbField("c.name")
    private String name;

    /**
     * 用户头像
     */
    @DbField("c.avatar")
    private String avatar;

    /**
     * 成员id
     */
    @DbField("t.follow_id")
    private String followId;

    /**
     * 用户id
     */
    @DbField("t.userid")
    private String userid;

    /**
     * 最近消息文本内容
     */
    @DbField("qm.text")
    private String msgText;

    /**
     * 最近消息类型
     */
    @DbField("qm.msgtype")
    private String msgType;

    /**
     * 最近消息时间
     */
    @DbField("qm.msgtime")
    private String msgtime;


}
