浏览代码

增加ws连接记录信息

Eric 2 年之前
父节点
当前提交
0c75be80c2

+ 96 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/websocket/WsConnectRecordInfoMapper.java

@@ -0,0 +1,96 @@
+package com.ym.mec.biz.dal.dao.websocket;
+
+import com.ym.mec.biz.dal.entity.websocket.WsConnectRecordInfo;
+import com.ym.mec.biz.dal.entity.websocket.WsConnectRecordInfoExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface WsConnectRecordInfoMapper {
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    long countByExample(WsConnectRecordInfoExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    int deleteByExample(WsConnectRecordInfoExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    int deleteByPrimaryKey(Long id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    int insert(WsConnectRecordInfo record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    int insertSelective(WsConnectRecordInfo record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    List<WsConnectRecordInfo> selectByExample(WsConnectRecordInfoExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    WsConnectRecordInfo selectByPrimaryKey(Long id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    int updateByExampleSelective(@Param("record") WsConnectRecordInfo record, @Param("example") WsConnectRecordInfoExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    int updateByExample(@Param("record") WsConnectRecordInfo record, @Param("example") WsConnectRecordInfoExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    int updateByPrimaryKeySelective(WsConnectRecordInfo record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    int updateByPrimaryKey(WsConnectRecordInfo record);
+}

+ 269 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/websocket/WsConnectRecordInfo.java

@@ -0,0 +1,269 @@
+package com.ym.mec.biz.dal.entity.websocket;
+
+import java.util.Date;
+
+public class WsConnectRecordInfo {
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column ws_connect_record_info.id_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    private Long id;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column ws_connect_record_info.room_id_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    private String roomId;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column ws_connect_record_info.user_id_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    private Long userId;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column ws_connect_record_info.client_type_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    private String clientType;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column ws_connect_record_info.connect_time_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    private Date connectTime;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column ws_connect_record_info.disconnect_time_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    private Date disconnectTime;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column ws_connect_record_info.online_time_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    private Long onlineTime;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column ws_connect_record_info.created_time_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    private Date createdTime;
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column ws_connect_record_info.id_
+     *
+     * @return the value of ws_connect_record_info.id_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public Long getId() {
+        return id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column ws_connect_record_info.id_
+     *
+     * @param id the value for ws_connect_record_info.id_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column ws_connect_record_info.room_id_
+     *
+     * @return the value of ws_connect_record_info.room_id_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public String getRoomId() {
+        return roomId;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column ws_connect_record_info.room_id_
+     *
+     * @param roomId the value for ws_connect_record_info.room_id_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public void setRoomId(String roomId) {
+        this.roomId = roomId;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column ws_connect_record_info.user_id_
+     *
+     * @return the value of ws_connect_record_info.user_id_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public Long getUserId() {
+        return userId;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column ws_connect_record_info.user_id_
+     *
+     * @param userId the value for ws_connect_record_info.user_id_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column ws_connect_record_info.client_type_
+     *
+     * @return the value of ws_connect_record_info.client_type_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public String getClientType() {
+        return clientType;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column ws_connect_record_info.client_type_
+     *
+     * @param clientType the value for ws_connect_record_info.client_type_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public void setClientType(String clientType) {
+        this.clientType = clientType;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column ws_connect_record_info.connect_time_
+     *
+     * @return the value of ws_connect_record_info.connect_time_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public Date getConnectTime() {
+        return connectTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column ws_connect_record_info.connect_time_
+     *
+     * @param connectTime the value for ws_connect_record_info.connect_time_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public void setConnectTime(Date connectTime) {
+        this.connectTime = connectTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column ws_connect_record_info.disconnect_time_
+     *
+     * @return the value of ws_connect_record_info.disconnect_time_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public Date getDisconnectTime() {
+        return disconnectTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column ws_connect_record_info.disconnect_time_
+     *
+     * @param disconnectTime the value for ws_connect_record_info.disconnect_time_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public void setDisconnectTime(Date disconnectTime) {
+        this.disconnectTime = disconnectTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column ws_connect_record_info.online_time_
+     *
+     * @return the value of ws_connect_record_info.online_time_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public Long getOnlineTime() {
+        return onlineTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column ws_connect_record_info.online_time_
+     *
+     * @param onlineTime the value for ws_connect_record_info.online_time_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public void setOnlineTime(Long onlineTime) {
+        this.onlineTime = onlineTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column ws_connect_record_info.created_time_
+     *
+     * @return the value of ws_connect_record_info.created_time_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public Date getCreatedTime() {
+        return createdTime;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column ws_connect_record_info.created_time_
+     *
+     * @param createdTime the value for ws_connect_record_info.created_time_
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public void setCreatedTime(Date createdTime) {
+        this.createdTime = createdTime;
+    }
+}

+ 803 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/websocket/WsConnectRecordInfoExample.java

@@ -0,0 +1,803 @@
+package com.ym.mec.biz.dal.entity.websocket;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class WsConnectRecordInfoExample {
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    protected String orderByClause;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    protected boolean distinct;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    protected List<Criteria> oredCriteria;
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public WsConnectRecordInfoExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id_ is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id_ is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Long value) {
+            addCriterion("id_ =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Long value) {
+            addCriterion("id_ <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Long value) {
+            addCriterion("id_ >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("id_ >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Long value) {
+            addCriterion("id_ <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Long value) {
+            addCriterion("id_ <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Long> values) {
+            addCriterion("id_ in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Long> values) {
+            addCriterion("id_ not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Long value1, Long value2) {
+            addCriterion("id_ between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Long value1, Long value2) {
+            addCriterion("id_ not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomIdIsNull() {
+            addCriterion("room_id_ is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomIdIsNotNull() {
+            addCriterion("room_id_ is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomIdEqualTo(String value) {
+            addCriterion("room_id_ =", value, "roomId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomIdNotEqualTo(String value) {
+            addCriterion("room_id_ <>", value, "roomId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomIdGreaterThan(String value) {
+            addCriterion("room_id_ >", value, "roomId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomIdGreaterThanOrEqualTo(String value) {
+            addCriterion("room_id_ >=", value, "roomId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomIdLessThan(String value) {
+            addCriterion("room_id_ <", value, "roomId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomIdLessThanOrEqualTo(String value) {
+            addCriterion("room_id_ <=", value, "roomId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomIdLike(String value) {
+            addCriterion("room_id_ like", value, "roomId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomIdNotLike(String value) {
+            addCriterion("room_id_ not like", value, "roomId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomIdIn(List<String> values) {
+            addCriterion("room_id_ in", values, "roomId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomIdNotIn(List<String> values) {
+            addCriterion("room_id_ not in", values, "roomId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomIdBetween(String value1, String value2) {
+            addCriterion("room_id_ between", value1, value2, "roomId");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomIdNotBetween(String value1, String value2) {
+            addCriterion("room_id_ not between", value1, value2, "roomId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdIsNull() {
+            addCriterion("user_id_ is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdIsNotNull() {
+            addCriterion("user_id_ is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdEqualTo(Long value) {
+            addCriterion("user_id_ =", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotEqualTo(Long value) {
+            addCriterion("user_id_ <>", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdGreaterThan(Long value) {
+            addCriterion("user_id_ >", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("user_id_ >=", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdLessThan(Long value) {
+            addCriterion("user_id_ <", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdLessThanOrEqualTo(Long value) {
+            addCriterion("user_id_ <=", value, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdIn(List<Long> values) {
+            addCriterion("user_id_ in", values, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotIn(List<Long> values) {
+            addCriterion("user_id_ not in", values, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdBetween(Long value1, Long value2) {
+            addCriterion("user_id_ between", value1, value2, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserIdNotBetween(Long value1, Long value2) {
+            addCriterion("user_id_ not between", value1, value2, "userId");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientTypeIsNull() {
+            addCriterion("client_type_ is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientTypeIsNotNull() {
+            addCriterion("client_type_ is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientTypeEqualTo(String value) {
+            addCriterion("client_type_ =", value, "clientType");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientTypeNotEqualTo(String value) {
+            addCriterion("client_type_ <>", value, "clientType");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientTypeGreaterThan(String value) {
+            addCriterion("client_type_ >", value, "clientType");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientTypeGreaterThanOrEqualTo(String value) {
+            addCriterion("client_type_ >=", value, "clientType");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientTypeLessThan(String value) {
+            addCriterion("client_type_ <", value, "clientType");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientTypeLessThanOrEqualTo(String value) {
+            addCriterion("client_type_ <=", value, "clientType");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientTypeLike(String value) {
+            addCriterion("client_type_ like", value, "clientType");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientTypeNotLike(String value) {
+            addCriterion("client_type_ not like", value, "clientType");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientTypeIn(List<String> values) {
+            addCriterion("client_type_ in", values, "clientType");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientTypeNotIn(List<String> values) {
+            addCriterion("client_type_ not in", values, "clientType");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientTypeBetween(String value1, String value2) {
+            addCriterion("client_type_ between", value1, value2, "clientType");
+            return (Criteria) this;
+        }
+
+        public Criteria andClientTypeNotBetween(String value1, String value2) {
+            addCriterion("client_type_ not between", value1, value2, "clientType");
+            return (Criteria) this;
+        }
+
+        public Criteria andConnectTimeIsNull() {
+            addCriterion("connect_time_ is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andConnectTimeIsNotNull() {
+            addCriterion("connect_time_ is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andConnectTimeEqualTo(Date value) {
+            addCriterion("connect_time_ =", value, "connectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andConnectTimeNotEqualTo(Date value) {
+            addCriterion("connect_time_ <>", value, "connectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andConnectTimeGreaterThan(Date value) {
+            addCriterion("connect_time_ >", value, "connectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andConnectTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("connect_time_ >=", value, "connectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andConnectTimeLessThan(Date value) {
+            addCriterion("connect_time_ <", value, "connectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andConnectTimeLessThanOrEqualTo(Date value) {
+            addCriterion("connect_time_ <=", value, "connectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andConnectTimeIn(List<Date> values) {
+            addCriterion("connect_time_ in", values, "connectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andConnectTimeNotIn(List<Date> values) {
+            addCriterion("connect_time_ not in", values, "connectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andConnectTimeBetween(Date value1, Date value2) {
+            addCriterion("connect_time_ between", value1, value2, "connectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andConnectTimeNotBetween(Date value1, Date value2) {
+            addCriterion("connect_time_ not between", value1, value2, "connectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andDisconnectTimeIsNull() {
+            addCriterion("disconnect_time_ is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDisconnectTimeIsNotNull() {
+            addCriterion("disconnect_time_ is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDisconnectTimeEqualTo(Date value) {
+            addCriterion("disconnect_time_ =", value, "disconnectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andDisconnectTimeNotEqualTo(Date value) {
+            addCriterion("disconnect_time_ <>", value, "disconnectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andDisconnectTimeGreaterThan(Date value) {
+            addCriterion("disconnect_time_ >", value, "disconnectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andDisconnectTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("disconnect_time_ >=", value, "disconnectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andDisconnectTimeLessThan(Date value) {
+            addCriterion("disconnect_time_ <", value, "disconnectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andDisconnectTimeLessThanOrEqualTo(Date value) {
+            addCriterion("disconnect_time_ <=", value, "disconnectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andDisconnectTimeIn(List<Date> values) {
+            addCriterion("disconnect_time_ in", values, "disconnectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andDisconnectTimeNotIn(List<Date> values) {
+            addCriterion("disconnect_time_ not in", values, "disconnectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andDisconnectTimeBetween(Date value1, Date value2) {
+            addCriterion("disconnect_time_ between", value1, value2, "disconnectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andDisconnectTimeNotBetween(Date value1, Date value2) {
+            addCriterion("disconnect_time_ not between", value1, value2, "disconnectTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andOnlineTimeIsNull() {
+            addCriterion("online_time_ is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andOnlineTimeIsNotNull() {
+            addCriterion("online_time_ is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andOnlineTimeEqualTo(Long value) {
+            addCriterion("online_time_ =", value, "onlineTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andOnlineTimeNotEqualTo(Long value) {
+            addCriterion("online_time_ <>", value, "onlineTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andOnlineTimeGreaterThan(Long value) {
+            addCriterion("online_time_ >", value, "onlineTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andOnlineTimeGreaterThanOrEqualTo(Long value) {
+            addCriterion("online_time_ >=", value, "onlineTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andOnlineTimeLessThan(Long value) {
+            addCriterion("online_time_ <", value, "onlineTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andOnlineTimeLessThanOrEqualTo(Long value) {
+            addCriterion("online_time_ <=", value, "onlineTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andOnlineTimeIn(List<Long> values) {
+            addCriterion("online_time_ in", values, "onlineTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andOnlineTimeNotIn(List<Long> values) {
+            addCriterion("online_time_ not in", values, "onlineTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andOnlineTimeBetween(Long value1, Long value2) {
+            addCriterion("online_time_ between", value1, value2, "onlineTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andOnlineTimeNotBetween(Long value1, Long value2) {
+            addCriterion("online_time_ not between", value1, value2, "onlineTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedTimeIsNull() {
+            addCriterion("created_time_ is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedTimeIsNotNull() {
+            addCriterion("created_time_ is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedTimeEqualTo(Date value) {
+            addCriterion("created_time_ =", value, "createdTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedTimeNotEqualTo(Date value) {
+            addCriterion("created_time_ <>", value, "createdTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedTimeGreaterThan(Date value) {
+            addCriterion("created_time_ >", value, "createdTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("created_time_ >=", value, "createdTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedTimeLessThan(Date value) {
+            addCriterion("created_time_ <", value, "createdTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedTimeLessThanOrEqualTo(Date value) {
+            addCriterion("created_time_ <=", value, "createdTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedTimeIn(List<Date> values) {
+            addCriterion("created_time_ in", values, "createdTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedTimeNotIn(List<Date> values) {
+            addCriterion("created_time_ not in", values, "createdTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedTimeBetween(Date value1, Date value2) {
+            addCriterion("created_time_ between", value1, value2, "createdTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreatedTimeNotBetween(Date value1, Date value2) {
+            addCriterion("created_time_ not between", value1, value2, "createdTime");
+            return (Criteria) this;
+        }
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated do_not_delete_during_merge Mon Oct 31 11:58:02 CST 2022
+     */
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table ws_connect_record_info
+     *
+     * @mbg.generated Mon Oct 31 11:58:02 CST 2022
+     */
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

+ 25 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/WsConnectService.java

@@ -0,0 +1,25 @@
+package com.ym.mec.biz.service;
+
+/**
+ * Created by Eric.Shang on 2022/10/31.
+ */
+public interface WsConnectService {
+
+    /**
+     * 保存用户ws连接记录信息
+     * @param roomId 房间ID
+     * @param userid 用户ID
+     * @param clientType 客户端类型
+     * @return int
+     */
+    int saveWsConnectRecordInfo(String roomId, String userid, String clientType);
+
+    /**
+     * 更新用户ws连接断开时间
+     * @param roomId 房间ID
+     * @param userId 用户
+     * @param clientType 客户端类型
+     * @return int
+     */
+    int updateWsDisconnectRecordInfo(String roomId, String userId, String clientType);
+}

+ 80 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/WsConnectServiceImpl.java

@@ -0,0 +1,80 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.biz.dal.dao.websocket.WsConnectRecordInfoMapper;
+import com.ym.mec.biz.dal.entity.websocket.WsConnectRecordInfo;
+import com.ym.mec.biz.dal.entity.websocket.WsConnectRecordInfoExample;
+import com.ym.mec.biz.service.WsConnectService;
+import org.apache.commons.collections.CollectionUtils;
+import org.joda.time.DateTime;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * Created by Eric.Shang on 2022/10/31.
+ */
+@Service
+public class WsConnectServiceImpl implements WsConnectService {
+
+    @Autowired
+    private WsConnectRecordInfoMapper wsConnectRecordInfoMapper;
+
+
+    /**
+     * 保存用户ws连接记录信息
+     *
+     * @param roomId     房间ID
+     * @param userid     用户ID
+     * @param clientType 客户端类型
+     * @return int
+     */
+    @Override
+    public int saveWsConnectRecordInfo(String roomId, String userid, String clientType) {
+
+        // 连接记录信息
+        WsConnectRecordInfo record = new WsConnectRecordInfo();
+        record.setRoomId(roomId);
+        record.setUserId(Long.parseLong(userid));
+        record.setClientType(clientType);
+        record.setConnectTime(DateTime.now().toDate());
+
+        // 保存连接记录信息
+        return wsConnectRecordInfoMapper.insertSelective(record);
+    }
+
+    /**
+     * 更新用户ws连接断开时间
+     *
+     * @param roomId     房间ID
+     * @param userId     用户
+     * @param clientType 客户端类型
+     * @return int
+     */
+    @Override
+    public int updateWsDisconnectRecordInfo(String roomId, String userId, String clientType) {
+
+        // 查询连接记录信息
+        WsConnectRecordInfoExample example = new WsConnectRecordInfoExample();
+        example.or().andRoomIdEqualTo(roomId)
+                .andUserIdEqualTo(Long.parseLong(userId))
+                .andClientTypeEqualTo(clientType)
+                .andDisconnectTimeIsNull();
+
+        List<WsConnectRecordInfo> recordInfos = wsConnectRecordInfoMapper.selectByExample(example);
+        if (CollectionUtils.isEmpty(recordInfos)) {
+            return 0;
+        }
+
+        // 连接记录信息
+        WsConnectRecordInfo record = recordInfos.get(0);
+
+        // 更新数据
+        WsConnectRecordInfo recordInfo = new WsConnectRecordInfo();
+        recordInfo.setId(record.getId());
+        recordInfo.setDisconnectTime(DateTime.now().toDate());
+        recordInfo.setOnlineTime(recordInfo.getDisconnectTime().getTime() - record.getConnectTime().getTime());
+
+        return wsConnectRecordInfoMapper.updateByPrimaryKeySelective(recordInfo);
+    }
+}

+ 334 - 0
mec-biz/src/main/resources/config/mybatis/WsConnectRecordInfoMapper.xml

@@ -0,0 +1,334 @@
+<?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.ym.mec.biz.dal.dao.websocket.WsConnectRecordInfoMapper">
+  <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.websocket.WsConnectRecordInfo">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Oct 31 11:58:02 CST 2022.
+    -->
+    <id column="id_" jdbcType="BIGINT" property="id" />
+    <result column="room_id_" jdbcType="VARCHAR" property="roomId" />
+    <result column="user_id_" jdbcType="BIGINT" property="userId" />
+    <result column="client_type_" jdbcType="VARCHAR" property="clientType" />
+    <result column="connect_time_" jdbcType="TIMESTAMP" property="connectTime" />
+    <result column="disconnect_time_" jdbcType="TIMESTAMP" property="disconnectTime" />
+    <result column="online_time_" jdbcType="BIGINT" property="onlineTime" />
+    <result column="created_time_" jdbcType="TIMESTAMP" property="createdTime" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Oct 31 11:58:02 CST 2022.
+    -->
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Oct 31 11:58:02 CST 2022.
+    -->
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Oct 31 11:58:02 CST 2022.
+    -->
+    id_, room_id_, user_id_, client_type_, connect_time_, disconnect_time_, online_time_, 
+    created_time_
+  </sql>
+  <select id="selectByExample" parameterType="com.ym.mec.biz.dal.entity.websocket.WsConnectRecordInfoExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Oct 31 11:58:02 CST 2022.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from ws_connect_record_info
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Oct 31 11:58:02 CST 2022.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from ws_connect_record_info
+    where id_ = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Oct 31 11:58:02 CST 2022.
+    -->
+    delete from ws_connect_record_info
+    where id_ = #{id,jdbcType=BIGINT}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.ym.mec.biz.dal.entity.websocket.WsConnectRecordInfoExample">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Oct 31 11:58:02 CST 2022.
+    -->
+    delete from ws_connect_record_info
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.websocket.WsConnectRecordInfo">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Oct 31 11:58:02 CST 2022.
+    -->
+    insert into ws_connect_record_info (id_, room_id_, user_id_, 
+      client_type_, connect_time_, disconnect_time_, 
+      online_time_, created_time_)
+    values (#{id,jdbcType=BIGINT}, #{roomId,jdbcType=VARCHAR}, #{userId,jdbcType=BIGINT}, 
+      #{clientType,jdbcType=VARCHAR}, #{connectTime,jdbcType=TIMESTAMP}, #{disconnectTime,jdbcType=TIMESTAMP}, 
+      #{onlineTime,jdbcType=BIGINT}, #{createdTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.ym.mec.biz.dal.entity.websocket.WsConnectRecordInfo">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Oct 31 11:58:02 CST 2022.
+    -->
+    insert into ws_connect_record_info
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id_,
+      </if>
+      <if test="roomId != null">
+        room_id_,
+      </if>
+      <if test="userId != null">
+        user_id_,
+      </if>
+      <if test="clientType != null">
+        client_type_,
+      </if>
+      <if test="connectTime != null">
+        connect_time_,
+      </if>
+      <if test="disconnectTime != null">
+        disconnect_time_,
+      </if>
+      <if test="onlineTime != null">
+        online_time_,
+      </if>
+      <if test="createdTime != null">
+        created_time_,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=BIGINT},
+      </if>
+      <if test="roomId != null">
+        #{roomId,jdbcType=VARCHAR},
+      </if>
+      <if test="userId != null">
+        #{userId,jdbcType=BIGINT},
+      </if>
+      <if test="clientType != null">
+        #{clientType,jdbcType=VARCHAR},
+      </if>
+      <if test="connectTime != null">
+        #{connectTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="disconnectTime != null">
+        #{disconnectTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="onlineTime != null">
+        #{onlineTime,jdbcType=BIGINT},
+      </if>
+      <if test="createdTime != null">
+        #{createdTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.ym.mec.biz.dal.entity.websocket.WsConnectRecordInfoExample" resultType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Oct 31 11:58:02 CST 2022.
+    -->
+    select count(*) from ws_connect_record_info
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Oct 31 11:58:02 CST 2022.
+    -->
+    update ws_connect_record_info
+    <set>
+      <if test="record.id != null">
+        id_ = #{record.id,jdbcType=BIGINT},
+      </if>
+      <if test="record.roomId != null">
+        room_id_ = #{record.roomId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.userId != null">
+        user_id_ = #{record.userId,jdbcType=BIGINT},
+      </if>
+      <if test="record.clientType != null">
+        client_type_ = #{record.clientType,jdbcType=VARCHAR},
+      </if>
+      <if test="record.connectTime != null">
+        connect_time_ = #{record.connectTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.disconnectTime != null">
+        disconnect_time_ = #{record.disconnectTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.onlineTime != null">
+        online_time_ = #{record.onlineTime,jdbcType=BIGINT},
+      </if>
+      <if test="record.createdTime != null">
+        created_time_ = #{record.createdTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Oct 31 11:58:02 CST 2022.
+    -->
+    update ws_connect_record_info
+    set id_ = #{record.id,jdbcType=BIGINT},
+      room_id_ = #{record.roomId,jdbcType=VARCHAR},
+      user_id_ = #{record.userId,jdbcType=BIGINT},
+      client_type_ = #{record.clientType,jdbcType=VARCHAR},
+      connect_time_ = #{record.connectTime,jdbcType=TIMESTAMP},
+      disconnect_time_ = #{record.disconnectTime,jdbcType=TIMESTAMP},
+      online_time_ = #{record.onlineTime,jdbcType=BIGINT},
+      created_time_ = #{record.createdTime,jdbcType=TIMESTAMP}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.ym.mec.biz.dal.entity.websocket.WsConnectRecordInfo">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Oct 31 11:58:02 CST 2022.
+    -->
+    update ws_connect_record_info
+    <set>
+      <if test="roomId != null">
+        room_id_ = #{roomId,jdbcType=VARCHAR},
+      </if>
+      <if test="userId != null">
+        user_id_ = #{userId,jdbcType=BIGINT},
+      </if>
+      <if test="clientType != null">
+        client_type_ = #{clientType,jdbcType=VARCHAR},
+      </if>
+      <if test="connectTime != null">
+        connect_time_ = #{connectTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="disconnectTime != null">
+        disconnect_time_ = #{disconnectTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="onlineTime != null">
+        online_time_ = #{onlineTime,jdbcType=BIGINT},
+      </if>
+      <if test="createdTime != null">
+        created_time_ = #{createdTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id_ = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.ym.mec.biz.dal.entity.websocket.WsConnectRecordInfo">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Oct 31 11:58:02 CST 2022.
+    -->
+    update ws_connect_record_info
+    set room_id_ = #{roomId,jdbcType=VARCHAR},
+      user_id_ = #{userId,jdbcType=BIGINT},
+      client_type_ = #{clientType,jdbcType=VARCHAR},
+      connect_time_ = #{connectTime,jdbcType=TIMESTAMP},
+      disconnect_time_ = #{disconnectTime,jdbcType=TIMESTAMP},
+      online_time_ = #{onlineTime,jdbcType=BIGINT},
+      created_time_ = #{createdTime,jdbcType=TIMESTAMP}
+    where id_ = #{id,jdbcType=BIGINT}
+  </update>
+</mapper>

+ 24 - 2
mec-websocket/src/main/java/com/ym/mec/web/handler/WhiteboardHandler.java

@@ -12,6 +12,7 @@ import com.corundumstudio.socketio.store.pubsub.DispatchMessage;
 import com.corundumstudio.socketio.store.pubsub.PubSubStore;
 import com.corundumstudio.socketio.store.pubsub.PubSubType;
 import com.google.common.collect.Lists;
+import com.ym.mec.biz.service.WsConnectService;
 import com.ym.mec.web.support.anno.NamespaceReference;
 import com.ym.mec.web.support.anno.OnNamespace;
 import lombok.Data;
@@ -55,12 +56,16 @@ public class WhiteboardHandler {
     private static final String EVENT_CLIENT_BROADCAST = "client-broadcast";
 
     // 房间编号
-    private static final String ROOM_ID = "room";
+    private static final String ROOM_ID = "roomId";
+    private static final String USER_ID = "userId";
+    private static final String CLIENT_TYPE = "clientType";
 
     @NamespaceReference
     private SocketIONamespace namespace;
     @Autowired
     private PubSubStore pubSubStore;
+    @Autowired
+    private WsConnectService wsConnectService;
 
     /**
      * 分布式服务器,消息分发
@@ -97,14 +102,22 @@ public class WhiteboardHandler {
      */
     @OnConnect
     public void onConnect(SocketIOClient client) {
-
+        // ws连接请求,需要包含roomId, userId, clientType参数
         // 房间ID
         String roomId = client.getHandshakeData().getSingleUrlParam(ROOM_ID);
+        // 用户ID
+        String userId = client.getHandshakeData().getSingleUrlParam(USER_ID);
+        // 客户端类型
+        String clientType = client.getHandshakeData().getSingleUrlParam(CLIENT_TYPE);
 
         log.info("onConnect client={}, ns={}, roomId={}", client.getSessionId(), client.getNamespace().getName(), roomId);
         //发送初始化房间事件
         client.sendEvent(EVENT_INIT_ROOM);
 
+        if (StringUtils.isNoneBlank(roomId, userId, clientType)) {
+
+            wsConnectService.saveWsConnectRecordInfo(roomId, userId, clientType);
+        }
     }
 
     /**
@@ -116,6 +129,10 @@ public class WhiteboardHandler {
 
         // 房间ID
         String roomId = client.getHandshakeData().getSingleUrlParam(ROOM_ID);
+        // 用户ID
+        String userId = client.getHandshakeData().getSingleUrlParam(USER_ID);
+        // 客户端类型
+        String clientType = client.getHandshakeData().getSingleUrlParam(CLIENT_TYPE);
 
         log.info("onDisconnect client={}, ns={}, roomId={}", client.getSessionId(), client.getNamespace().getName(), roomId);
         client.disconnect();
@@ -135,6 +152,11 @@ public class WhiteboardHandler {
             // 消息分发
             dispatchMessage(client, roomId, EVENT_ROOM_USER_CHANGE, Collections.singletonList(collect));
         }
+
+        if (StringUtils.isNoneBlank(roomId, userId, clientType)) {
+
+            wsConnectService.updateWsDisconnectRecordInfo(roomId, userId, clientType);
+        }
     }