package com.example.demo.module.friend;

import com.alibaba.fastjson.JSONObject;
import com.example.demo.common.GlobalRoot;
import pers.jc.sql.SQL;

import java.util.List;

/**
 * Socket服务-好友
 */
public class FriendService {
    public static FriendService ins = new FriendService();

    public boolean checkHasFriendRequest(int myID) {
        List<JSONObject> res = GlobalRoot.db.select(new SQL(){{
            SELECT("*");
            FROM("user_friend_request");
            JOIN("user_login on user_friend_request.otherID = user_login.id");
            WHERE("user_friend_request.myID = " + myID);
            LIMIT("1");
        }});
        return res.size() > 0;
    }
}
