From d180f69b4aac9322576398a193f3a64dcec8a32f Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Thu, 19 Aug 2021 15:03:00 +0800
Subject: [PATCH] 好友
---
src/main/java/org/springblade/modules/chatrg/entity/Chatgroup.java | 87 +++
src/main/java/org/springblade/modules/chatrgc/service/IChatgroupcService.java | 44 +
src/main/java/org/springblade/modules/chatrg/controller/ChatgroupController.java | 162 +++++++
src/main/java/org/springblade/modules/chatrg/dto/ChatgroupDTO.java | 34 +
src/main/java/org/springblade/modules/chatrecords/entity/ChatRecords.java | 74 +++
src/main/java/org/springblade/modules/chatrgc/entity/Chatgroupc.java | 89 +++
src/main/java/org/springblade/modules/chatrgc/vo/ChatgroupcVO.java | 36 +
src/main/resources/application-dev.yml | 2
src/main/java/org/springblade/modules/chatrecords/controller/ChatRecordsController.java | 105 ++++
src/main/java/org/springblade/modules/chatrecords/mapper/ChatRecordsMapper.xml | 35 +
src/main/java/org/springblade/modules/chatrecords/mapper/ChatRecordsMapper.java | 32 +
src/main/java/org/springblade/modules/chatrgc/mapper/ChatgroupcMapper.xml | 44 +
src/main/java/org/springblade/modules/chatrgc/dto/ChatgroupcDTO.java | 34 +
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml | 6
src/main/java/org/springblade/modules/chatrecords/service/ChatRecordsService.java | 45 +
src/main/java/org/springblade/modules/chatrg/mapper/ChatgroupMapper.java | 44 +
src/main/java/org/springblade/modules/chatrecords/vo/ChatRecordsVo.java | 30 +
src/main/java/org/springblade/common/config/BladeConfiguration.java | 3
src/main/java/org/springblade/modules/chatrgc/mapper/ChatgroupcMapper.java | 44 +
src/main/java/org/springblade/modules/chatrg/vo/ChatgroupVO.java | 36 +
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java | 6
src/main/java/org/springblade/modules/chatrecords/service/impl/ChatRecordsServiceImpl.java | 60 ++
src/main/java/org/springblade/modules/chatrgc/service/impl/ChatgroupcServiceImpl.java | 49 ++
src/main/java/org/springblade/modules/chatrg/service/impl/ChatgroupServiceImpl.java | 49 ++
src/main/java/org/springblade/modules/chatrg/mapper/ChatgroupMapper.xml | 31 +
src/main/java/org/springblade/modules/chatrg/service/IChatgroupService.java | 44 +
src/main/java/org/springblade/modules/chatrgc/controller/ChatgroupcController.java | 135 +++++
src/main/java/org/springblade/modules/system/mapper/UserMapper.java | 2
src/main/java/org/springblade/modules/system/service/IUserService.java | 2
29 files changed, 1,363 insertions(+), 1 deletions(-)
diff --git a/src/main/java/org/springblade/common/config/BladeConfiguration.java b/src/main/java/org/springblade/common/config/BladeConfiguration.java
index 037c37d..0cf23fc 100644
--- a/src/main/java/org/springblade/common/config/BladeConfiguration.java
+++ b/src/main/java/org/springblade/common/config/BladeConfiguration.java
@@ -78,6 +78,9 @@
secureRegistry.excludePathPatterns("/pushMsg/**");
secureRegistry.excludePathPatterns("/owner/**");
secureRegistry.excludePathPatterns("/friend/**");
+ secureRegistry.excludePathPatterns("/chat-records/**");
+ secureRegistry.excludePathPatterns("/chatgroup/**");
+ secureRegistry.excludePathPatterns("/chatgroupc/**");
return secureRegistry;
}
diff --git a/src/main/java/org/springblade/modules/chatrecords/controller/ChatRecordsController.java b/src/main/java/org/springblade/modules/chatrecords/controller/ChatRecordsController.java
new file mode 100644
index 0000000..901df4e
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrecords/controller/ChatRecordsController.java
@@ -0,0 +1,105 @@
+package org.springblade.modules.chatrecords.controller;
+
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.modules.chatrecords.entity.ChatRecords;
+import org.springblade.modules.chatrecords.service.ChatRecordsService;
+import org.springblade.modules.system.entity.User;
+import org.springblade.modules.system.service.IUserService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author zhongrj
+ * @time 2021-06-18
+ * 聊天消息控制层
+ */
+@AllArgsConstructor
+@RestController
+@RequestMapping("/chat-records")
+public class ChatRecordsController extends BladeController {
+
+ private final IUserService iUserService;
+
+ private final ChatRecordsService chatRecordsService;
+
+ /**
+ * 查询单聊消息记录
+ * @param chatRecords 消息记录对象
+ * @param response 响应
+ * @param query 查询条件,分页
+ * @return
+ */
+ @GetMapping("/getSingleMessagePage")
+ public R getSingleMessagePage(@Valid ChatRecords chatRecords, HttpServletResponse response, Query query){
+ //跨域设置
+ crossDomain(response);
+ Map<String, Object> map = new HashMap<>(2);
+ //查询单聊人的信息
+ List<User> user = Arrays.asList(iUserService.getById(chatRecords.getSenderId()), iUserService.getById(chatRecords.getRecipientId()));
+ //查询单聊记录信息
+ if (null==query.getCurrent()){
+ map.put("chatRecordsIPage",chatRecordsService.selectChatlist(chatRecords));
+ }else {
+ map.put("chatRecordsIPage",chatRecordsService.selectChatRecordsPage(Condition.getPage(query), chatRecords));
+ }
+ //封装数据
+ map.put("user",user);
+ //返回数据
+ return R.data(map);
+ }
+
+
+ /**
+ * 查询当前用户的聊天列表
+ * @param chatRecords 消息记录对象
+ * @param response 响应
+ * @param query 查询条件,分页
+ * @return
+ */
+ @GetMapping("/getChatListPage")
+ public R getChatListPage(@Valid ChatRecords chatRecords, HttpServletResponse response, Query query){
+ //跨域设置
+ crossDomain(response);
+ if(null==query.getCurrent()){
+ //不分页
+ return R.data(chatRecordsService.getChatList( chatRecords));
+ }
+ //查询当前人员的聊天列表,并返回数据
+ return R.data(chatRecordsService.getChatListPage(Condition.getPage(query), chatRecords));
+ }
+
+
+ /**
+ * 单聊消息插入
+ * @param chatRecords 消息记录对象
+ * @param response 响应
+ * @return
+ */
+ @PostMapping("/insertSingleChat")
+ public R insertSingleChat(@Valid @RequestBody ChatRecords chatRecords, HttpServletResponse response){
+ //跨域设置
+ crossDomain(response);
+ //单聊消息插入
+ return R.data(chatRecordsService.save(chatRecords));
+ }
+
+ /**
+ * 配置跨域设置
+ * @param response
+ */
+ private void crossDomain(HttpServletResponse response) {
+ response.setHeader("Access-Control-Allow-Origin", "*");
+ response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
+ response.setHeader("Access-Control-Allow-Credentials","true");
+ }
+}
diff --git a/src/main/java/org/springblade/modules/chatrecords/entity/ChatRecords.java b/src/main/java/org/springblade/modules/chatrecords/entity/ChatRecords.java
new file mode 100644
index 0000000..256f7dc
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrecords/entity/ChatRecords.java
@@ -0,0 +1,74 @@
+package org.springblade.modules.chatrecords.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ *
+ * @author zhongrj
+ * @time 2021-06-18
+ * @desc 聊天记录实体类
+ *
+ */
+
+@Data
+@TableName("sys_chat_records")
+public class ChatRecords implements Serializable {
+ /**
+ * 主键id
+ */
+ @TableId(value = "id",type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 发送消息内容
+ */
+ @TableField("post_message")
+ private String postMessage;
+
+ /**
+ * 消息类型 0 文本 1 表情 2 图片 3 视频...
+ */
+ @TableField("message_type")
+ private Integer messageType;
+
+ /**
+ * 接收状态 0 已接收 1 未接收
+ */
+ private Integer status;
+
+ /**
+ * 发送时间
+ */
+ @TableField("post_time")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date postTime;
+
+ /**
+ * 发送消息人id
+ *
+ */
+ @NotNull(message = "发送消息人id不能为空")
+ @TableField("sender_id")
+ @JsonFormat(shape = JsonFormat.Shape.STRING)
+ private Long senderId;
+
+ /**
+ * 接收消息人id
+ * @NotNull(message = "接收消息人id不能为空")
+ */
+ @TableField("recipient_id")
+ @JsonFormat(shape = JsonFormat.Shape.STRING)
+ private Long recipientId;
+
+}
diff --git a/src/main/java/org/springblade/modules/chatrecords/mapper/ChatRecordsMapper.java b/src/main/java/org/springblade/modules/chatrecords/mapper/ChatRecordsMapper.java
new file mode 100644
index 0000000..a1fb7aa
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrecords/mapper/ChatRecordsMapper.java
@@ -0,0 +1,32 @@
+package org.springblade.modules.chatrecords.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.chatrecords.entity.ChatRecords;
+import org.springblade.modules.chatrecords.vo.ChatRecordsVo;
+
+import java.util.List;
+
+
+/**
+ * @author zhongrj
+ * mapper 映射层
+ */
+public interface ChatRecordsMapper extends BaseMapper<ChatRecords> {
+
+ /**
+ * 查询单聊消息记录分页信息
+ * @param page
+ * @param chatRecords 聊天消息对象
+ * @return
+ */
+ List<ChatRecords> selectChatRecordsPage(IPage<ChatRecords> page, ChatRecords chatRecords);
+
+ /**
+ * 查询当前用户的聊天列表
+ * @param chatRecords 消息记录对象
+ * @param page
+ * @return
+ */
+ List<ChatRecordsVo> getChatListPage(IPage<ChatRecordsVo> page, ChatRecords chatRecords);
+}
diff --git a/src/main/java/org/springblade/modules/chatrecords/mapper/ChatRecordsMapper.xml b/src/main/java/org/springblade/modules/chatrecords/mapper/ChatRecordsMapper.xml
new file mode 100644
index 0000000..5d0af50
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrecords/mapper/ChatRecordsMapper.xml
@@ -0,0 +1,35 @@
+<?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="org.springblade.modules.chatrecords.mapper.ChatRecordsMapper">
+
+ <!--查询单聊的消息记录列表-->
+ <select id="selectChatRecordsPage" resultType="org.springblade.modules.chatrecords.entity.ChatRecords">
+ select * from sys_chat_records where sender_id = #{chatRecords.senderId} and recipient_id = #{chatRecords.recipientId}
+ union
+ select * from sys_chat_records where sender_id = #{chatRecords.recipientId} and recipient_id = #{chatRecords.senderId}
+ order by post_time desc
+ </select>
+
+ <!--聊天列表-->
+ <select id="getChatListPage" resultType="org.springblade.modules.chatrecords.vo.ChatRecordsVo">
+ select scrss.*,name recipientNickName,real_name recipientName,avatar from blade_user bu
+ right join
+ (
+ select scr.id,scrs.uid recipientId,post_time postTime,post_message postMessage from sys_chat_records scr
+ right join
+ (
+ select max(max_id) id,uid from (
+ select recipient_id as uid,max(id) as max_id from sys_chat_records where sender_id = #{chatRecords.senderId} group by recipient_id
+ union all
+ select sender_id as uid,max(id) as max_id from sys_chat_records where recipient_id = #{chatRecords.senderId} group by sender_id
+ )t group by uid
+ ) scrs
+ on
+ scr.id = scrs.id
+ ) scrss
+ on
+ bu.id = scrss.recipientId
+ order by postTime desc
+ </select>
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/chatrecords/service/ChatRecordsService.java b/src/main/java/org/springblade/modules/chatrecords/service/ChatRecordsService.java
new file mode 100644
index 0000000..ae3ebd5
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrecords/service/ChatRecordsService.java
@@ -0,0 +1,45 @@
+package org.springblade.modules.chatrecords.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.chatrecords.entity.ChatRecords;
+import org.springblade.modules.chatrecords.vo.ChatRecordsVo;
+
+import java.util.List;
+
+/**
+ * @author zhongrj
+ * 聊天消息接口层
+ */
+public interface ChatRecordsService extends IService<ChatRecords> {
+
+ /**
+ * 查询聊天消息分页信息
+ * @param page
+ * @param chatRecords 聊天消息对象
+ * @return
+ */
+ IPage<ChatRecords> selectChatRecordsPage(IPage<ChatRecords> page, ChatRecords chatRecords);
+
+ /**
+ * 查询当前用户的聊天列表
+ * @param chatRecords 消息记录对象
+ * @param page
+ * @return
+ */
+ IPage<ChatRecordsVo> getChatListPage(IPage<ChatRecordsVo> page, ChatRecords chatRecords);
+
+ /**
+ * 查询当前用户的聊天列表(不分页)
+ * @param chatRecords 消息记录对象
+ * @return
+ */
+ List<ChatRecordsVo> getChatList(ChatRecords chatRecords);
+
+ /**
+ * 查询单聊消息记录 (不分页)
+ * @param chatRecords 消息记录对象
+ * @return
+ */
+ List<ChatRecords> selectChatlist(ChatRecords chatRecords);
+}
diff --git a/src/main/java/org/springblade/modules/chatrecords/service/impl/ChatRecordsServiceImpl.java b/src/main/java/org/springblade/modules/chatrecords/service/impl/ChatRecordsServiceImpl.java
new file mode 100644
index 0000000..d951983
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrecords/service/impl/ChatRecordsServiceImpl.java
@@ -0,0 +1,60 @@
+package org.springblade.modules.chatrecords.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.modules.chatrecords.entity.ChatRecords;
+import org.springblade.modules.chatrecords.mapper.ChatRecordsMapper;
+import org.springblade.modules.chatrecords.service.ChatRecordsService;
+import org.springblade.modules.chatrecords.vo.ChatRecordsVo;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author zhongrj
+ */
+@Service
+public class ChatRecordsServiceImpl extends ServiceImpl<ChatRecordsMapper, ChatRecords> implements ChatRecordsService {
+
+ /**
+ * 查询聊天消息分页信息
+ * @param page
+ * @param chatRecords 聊天消息对象
+ * @return
+ */
+ @Override
+ public IPage<ChatRecords> selectChatRecordsPage(IPage<ChatRecords> page, ChatRecords chatRecords) {
+ return page.setRecords(baseMapper.selectChatRecordsPage(page,chatRecords));
+ }
+
+ /**
+ * 查询当前用户的聊天列表
+ * @param chatRecords 消息记录对象
+ * @param page
+ * @return
+ */
+ @Override
+ public IPage<ChatRecordsVo> getChatListPage(IPage<ChatRecordsVo> page, ChatRecords chatRecords) {
+ return page.setRecords(baseMapper.getChatListPage(page,chatRecords));
+ }
+
+ /**
+ * 查询当前用户的聊天列表(不分页)
+ * @param chatRecords 消息记录对象
+ * @return
+ */
+ @Override
+ public List<ChatRecordsVo> getChatList(ChatRecords chatRecords) {
+ return baseMapper.getChatListPage(null,chatRecords);
+ }
+
+ /**
+ * 查询单聊消息记录 (不分页)
+ * @param chatRecords 消息记录对象
+ * @return
+ */
+ @Override
+ public List<ChatRecords> selectChatlist(ChatRecords chatRecords) {
+ return baseMapper.selectChatRecordsPage(null,chatRecords);
+ }
+}
diff --git a/src/main/java/org/springblade/modules/chatrecords/vo/ChatRecordsVo.java b/src/main/java/org/springblade/modules/chatrecords/vo/ChatRecordsVo.java
new file mode 100644
index 0000000..f9c42f1
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrecords/vo/ChatRecordsVo.java
@@ -0,0 +1,30 @@
+package org.springblade.modules.chatrecords.vo;
+
+import lombok.Data;
+import org.springblade.modules.chatrecords.entity.ChatRecords;
+
+import java.io.Serializable;
+
+/**
+ * @author zhongrj
+ * @time 2021-06-19
+ * @desc 聊天列表vo
+ */
+@Data
+public class ChatRecordsVo extends ChatRecords implements Serializable {
+ /**
+ * 接收或者发送的昵称
+ */
+ private String recipientNickName;
+
+ /**
+ * 接收或者发送的姓名
+ */
+ private String recipientName;
+
+ /**
+ * 接收或者发送的头像 url
+ */
+ private String avatar;
+
+}
diff --git a/src/main/java/org/springblade/modules/chatrg/controller/ChatgroupController.java b/src/main/java/org/springblade/modules/chatrg/controller/ChatgroupController.java
new file mode 100644
index 0000000..0900854
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrg/controller/ChatgroupController.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.chatrg.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.chatrg.entity.Chatgroup;
+import org.springblade.modules.chatrg.service.IChatgroupService;
+import org.springblade.modules.chatrg.vo.ChatgroupVO;
+import org.springblade.modules.system.service.IUserService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 控制器
+ *
+ * @author BladeX
+ * @since 2021-06-24
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/chatgroup")
+@Api(value = "", tags = "接口")
+public class ChatgroupController extends BladeController {
+
+ private final IChatgroupService chatgroupService;
+ private final IUserService iUserService;
+
+ /**
+ * 详情
+ */
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 1)
+ @ApiOperation(value = "详情", notes = "传入chatgroup")
+ public R<Chatgroup> detail(Chatgroup chatgroup) {
+ Chatgroup detail = chatgroupService.getOne(Condition.getQueryWrapper(chatgroup));
+ return R.data(detail);
+ }
+
+ /**
+ * 分页
+ */
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 2)
+ @ApiOperation(value = "分页", notes = "传入chatgroup")
+ public R<IPage<Chatgroup>> list(Chatgroup chatgroup, Query query) {
+ IPage<Chatgroup> pages = chatgroupService.page(Condition.getPage(query), Condition.getQueryWrapper(chatgroup));
+ List<Map<String, Object>> list = iUserService.selectUser();
+ for (int i = 0; i < pages.getTotal(); i++) {
+ StringBuffer deptNameBuiffer = new StringBuffer();
+ String groupmember = pages.getRecords().get(i).getGroupmember();
+ String[] split = groupmember.split(",");
+ List<String> lists = Arrays.asList(split);
+ //数据匹配封装
+ for (String deptId : lists) {
+ for (Map<String, Object> deptVo : list) {
+ if (deptId.equals(deptVo.get("groupmember").toString())) {
+ deptNameBuiffer.append(deptVo.get("rname")).append("/");
+ }
+ }
+ }
+ pages.getRecords().get(i).setGroupmember(deptNameBuiffer.substring(0, deptNameBuiffer.length() - 1));
+ }
+ return R.data(pages);
+ }
+
+ /**
+ * 自定义分页
+ */
+ @GetMapping("/page")
+ @ApiOperationSupport(order = 3)
+ @ApiOperation(value = "分页", notes = "传入chatgroup")
+ public R<IPage<ChatgroupVO>> page(ChatgroupVO chatgroup, Query query) {
+ IPage<ChatgroupVO> pages = chatgroupService.selectChatgroupPage(Condition.getPage(query), chatgroup);
+ return R.data(pages);
+ }
+
+ /**
+ * 新增
+ */
+ @PostMapping("/save")
+ @ApiOperationSupport(order = 4)
+ @ApiOperation(value = "新增", notes = "传入chatgroup")
+ public R save(@Valid @RequestBody Chatgroup chatgroup) {
+ Date dd = new Date();
+ SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ String end = sim.format(dd);
+ chatgroup.setTime(end);
+ return R.status(chatgroupService.save(chatgroup));
+ }
+
+ /**
+ * 修改
+ */
+ @PostMapping("/update")
+ @ApiOperationSupport(order = 5)
+ @ApiOperation(value = "修改", notes = "传入chatgroup")
+ public R update(@Valid @RequestBody Chatgroup chatgroup) {
+ return R.status(chatgroupService.updateById(chatgroup));
+ }
+
+ /**
+ * 新增或修改
+ */
+ @PostMapping("/submit")
+ @ApiOperationSupport(order = 6)
+ @ApiOperation(value = "新增或修改", notes = "传入chatgroup")
+ public R submit(@Valid @RequestBody Chatgroup chatgroup) {
+ return R.status(chatgroupService.saveOrUpdate(chatgroup));
+ }
+
+
+ /**
+ * 删除
+ */
+ @PostMapping("/remove")
+ @ApiOperationSupport(order = 8)
+ @ApiOperation(value = "删除", notes = "传入ids")
+ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+ return R.status(chatgroupService.removeByIds(Func.toLongList(ids)));
+ }
+
+ /**
+ * 群列表
+ *
+ * @return
+ */
+ @GetMapping("/selectList")
+ public R selectList(String id) {
+ return R.data(chatgroupService.selectList(id));
+ }
+
+}
diff --git a/src/main/java/org/springblade/modules/chatrg/dto/ChatgroupDTO.java b/src/main/java/org/springblade/modules/chatrg/dto/ChatgroupDTO.java
new file mode 100644
index 0000000..045474b
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrg/dto/ChatgroupDTO.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.chatrg.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.chatrg.entity.Chatgroup;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-06-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ChatgroupDTO extends Chatgroup {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/chatrg/entity/Chatgroup.java b/src/main/java/org/springblade/modules/chatrg/entity/Chatgroup.java
new file mode 100644
index 0000000..14969e7
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrg/entity/Chatgroup.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.chatrg.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2021-06-24
+ */
+@Data
+@TableName("sys_chatgroup")
+@ApiModel(value = "Chatgroup对象", description = "Chatgroup对象")
+public class Chatgroup implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+ /**
+ * 群名称
+ */
+ @ApiModelProperty(value = "群名称")
+ @TableField("GroupName")
+ private String groupname;
+ /**
+ * 群备注
+ */
+ @ApiModelProperty(value = "群备注")
+ @TableField("GroupRemarks")
+ private String groupremarks;
+ /**
+ * 群介绍
+ */
+ @ApiModelProperty(value = "群介绍")
+ @TableField("GroupContent")
+ private String groupcontent;
+ /**
+ * 群介绍
+ */
+ @ApiModelProperty(value = "群公告")
+ @TableField("GroupNotice")
+ private String groupnotice;
+ /**
+ * 群主id
+ */
+ @ApiModelProperty(value = "群主id")
+ @TableField("GroupId")
+ private String groupid;
+ /**
+ * 群成员id
+ */
+ @ApiModelProperty(value = "群成员id")
+ @TableField("GroupMember")
+ private String groupmember;
+ /**
+ * 群创建时间
+ */
+ @ApiModelProperty(value = "群创建时间")
+ private String time;
+
+
+}
diff --git a/src/main/java/org/springblade/modules/chatrg/mapper/ChatgroupMapper.java b/src/main/java/org/springblade/modules/chatrg/mapper/ChatgroupMapper.java
new file mode 100644
index 0000000..b86e698
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrg/mapper/ChatgroupMapper.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.chatrg.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.chatrg.entity.Chatgroup;
+import org.springblade.modules.chatrg.vo.ChatgroupVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-06-24
+ */
+public interface ChatgroupMapper extends BaseMapper<Chatgroup> {
+
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param chatgroup
+ * @return
+ */
+ List<ChatgroupVO> selectChatgroupPage(IPage page, ChatgroupVO chatgroup);
+ List<Map<String, Object>> selectList(String id);
+}
diff --git a/src/main/java/org/springblade/modules/chatrg/mapper/ChatgroupMapper.xml b/src/main/java/org/springblade/modules/chatrg/mapper/ChatgroupMapper.xml
new file mode 100644
index 0000000..3abc239
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrg/mapper/ChatgroupMapper.xml
@@ -0,0 +1,31 @@
+<?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="org.springblade.modules.chatrg.mapper.ChatgroupMapper">
+
+ <!-- 通用查询映射结果 -->
+ <resultMap id="chatgroupResultMap" type="org.springblade.modules.chatrg.entity.Chatgroup">
+ <id column="id" property="id"/>
+ <result column="GroupName" property="groupname"/>
+ <result column="GroupRemarks" property="groupremarks"/>
+ <result column="GroupContent" property="groupcontent"/>
+ <result column="GroupId" property="groupid"/>
+ <result column="GroupMember" property="groupmember"/>
+ <result column="time" property="time"/>
+ <result column="GroupNotice" property="groupnotice"/>
+ </resultMap>
+
+
+ <select id="selectChatgroupPage" resultMap="chatgroupResultMap">
+ select * from sys_chatgroup where is_deleted = 0
+ </select>
+
+
+ <select id="selectList" resultType="java.util.HashMap">
+ SELECT p.*,u.real_name,u.avatar FROM sys_chatgroup p LEFT JOIN blade_user u ON p.GroupId=u.id
+ where
+ (p.GroupMember like concat('%',#{id},'%')
+ or p.GroupId = #{id}
+ )
+ </select>
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/chatrg/service/IChatgroupService.java b/src/main/java/org/springblade/modules/chatrg/service/IChatgroupService.java
new file mode 100644
index 0000000..11ed628
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrg/service/IChatgroupService.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.chatrg.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.chatrg.entity.Chatgroup;
+import org.springblade.modules.chatrg.vo.ChatgroupVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 服务类
+ *
+ * @author BladeX
+ * @since 2021-06-24
+ */
+public interface IChatgroupService extends IService<Chatgroup> {
+
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param chatgroup
+ * @return
+ */
+ IPage<ChatgroupVO> selectChatgroupPage(IPage<ChatgroupVO> page, ChatgroupVO chatgroup);
+ List<Map<String, Object>> selectList(String id);
+}
diff --git a/src/main/java/org/springblade/modules/chatrg/service/impl/ChatgroupServiceImpl.java b/src/main/java/org/springblade/modules/chatrg/service/impl/ChatgroupServiceImpl.java
new file mode 100644
index 0000000..943c80b
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrg/service/impl/ChatgroupServiceImpl.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.chatrg.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.modules.chatrg.entity.Chatgroup;
+import org.springblade.modules.chatrg.mapper.ChatgroupMapper;
+import org.springblade.modules.chatrg.service.IChatgroupService;
+import org.springblade.modules.chatrg.vo.ChatgroupVO;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-06-24
+ */
+@Service
+public class ChatgroupServiceImpl extends ServiceImpl<ChatgroupMapper, Chatgroup> implements IChatgroupService {
+
+ @Override
+ public IPage<ChatgroupVO> selectChatgroupPage(IPage<ChatgroupVO> page, ChatgroupVO chatgroup) {
+ return page.setRecords(baseMapper.selectChatgroupPage(page, chatgroup));
+ }
+
+ @Override
+ public List<Map<String, Object>> selectList(String id) {
+ return baseMapper.selectList(id);
+ }
+
+}
diff --git a/src/main/java/org/springblade/modules/chatrg/vo/ChatgroupVO.java b/src/main/java/org/springblade/modules/chatrg/vo/ChatgroupVO.java
new file mode 100644
index 0000000..dbfdadd
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrg/vo/ChatgroupVO.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.chatrg.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.chatrg.entity.Chatgroup;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2021-06-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "ChatgroupVO对象", description = "ChatgroupVO对象")
+public class ChatgroupVO extends Chatgroup {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/chatrgc/controller/ChatgroupcController.java b/src/main/java/org/springblade/modules/chatrgc/controller/ChatgroupcController.java
new file mode 100644
index 0000000..e841f4e
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrgc/controller/ChatgroupcController.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.chatrgc.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.chatrgc.entity.Chatgroupc;
+import org.springblade.modules.chatrgc.service.IChatgroupcService;
+import org.springblade.modules.chatrgc.vo.ChatgroupcVO;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ * 聊天记录表 控制器
+ *
+ * @author BladeX
+ * @since 2021-06-24
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/chatgroupc")
+@Api(value = "聊天记录表", tags = "聊天记录表接口")
+public class ChatgroupcController extends BladeController {
+
+ private final IChatgroupcService chatgroupcService;
+
+ /**
+ * 详情
+ */
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 1)
+ @ApiOperation(value = "详情", notes = "传入chatgroupc")
+ public R<Chatgroupc> detail(Chatgroupc chatgroupc) {
+ Chatgroupc detail = chatgroupcService.getOne(Condition.getQueryWrapper(chatgroupc));
+ return R.data(detail);
+ }
+
+ /**
+ * 分页 聊天记录表
+ */
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 2)
+ @ApiOperation(value = "分页", notes = "传入chatgroupc")
+ public R<IPage<Chatgroupc>> list(Chatgroupc chatgroupc, Query query) {
+ IPage<Chatgroupc> pages = chatgroupcService.page(Condition.getPage(query), Condition.getQueryWrapper(chatgroupc));
+ return R.data(pages);
+ }
+
+ /**
+ * 自定义分页 聊天记录表
+ */
+ @GetMapping("/page")
+ @ApiOperationSupport(order = 3)
+ @ApiOperation(value = "分页", notes = "传入chatgroupc")
+ public R<IPage<ChatgroupcVO>> page(ChatgroupcVO chatgroupc, Query query) {
+ IPage<ChatgroupcVO> pages = chatgroupcService.selectChatgroupcPage(Condition.getPage(query), chatgroupc);
+ return R.data(pages);
+ }
+
+ /**
+ * 新增 聊天记录表
+ */
+ @PostMapping("/save")
+ @ApiOperationSupport(order = 4)
+ @ApiOperation(value = "新增", notes = "传入chatgroupc")
+ public R save(@Valid @RequestBody Chatgroupc chatgroupc) {
+ return R.status(chatgroupcService.save(chatgroupc));
+ }
+
+ /**
+ * 修改 聊天记录表
+ */
+ @PostMapping("/update")
+ @ApiOperationSupport(order = 5)
+ @ApiOperation(value = "修改", notes = "传入chatgroupc")
+ public R update(@Valid @RequestBody Chatgroupc chatgroupc) {
+ return R.status(chatgroupcService.updateById(chatgroupc));
+ }
+
+ /**
+ * 新增或修改 聊天记录表
+ */
+ @PostMapping("/submit")
+ @ApiOperationSupport(order = 6)
+ @ApiOperation(value = "新增或修改", notes = "传入chatgroupc")
+ public R submit(@Valid @RequestBody Chatgroupc chatgroupc) {
+ return R.status(chatgroupcService.saveOrUpdate(chatgroupc));
+ }
+
+
+ /**
+ * 删除 聊天记录表
+ */
+ @PostMapping("/remove")
+ @ApiOperationSupport(order = 8)
+ @ApiOperation(value = "删除", notes = "传入ids")
+ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+ return R.status(chatgroupcService.removeByIds(Func.toLongList(ids)));
+ }
+
+ /**
+ * 群消息
+ * @param
+ * @return
+ */
+ @PostMapping("/selectList")
+ public R selectList(String gid) {
+ return R.data(chatgroupcService.selectList(gid));
+ }
+
+}
diff --git a/src/main/java/org/springblade/modules/chatrgc/dto/ChatgroupcDTO.java b/src/main/java/org/springblade/modules/chatrgc/dto/ChatgroupcDTO.java
new file mode 100644
index 0000000..0f4f124
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrgc/dto/ChatgroupcDTO.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.chatrgc.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.chatrgc.entity.Chatgroupc;
+
+/**
+ * 聊天记录表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-06-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ChatgroupcDTO extends Chatgroupc {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/chatrgc/entity/Chatgroupc.java b/src/main/java/org/springblade/modules/chatrgc/entity/Chatgroupc.java
new file mode 100644
index 0000000..dde9bb5
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrgc/entity/Chatgroupc.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.chatrgc.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 聊天记录表实体类
+ *
+ * @author BladeX
+ * @since 2021-06-24
+ */
+@Data
+@TableName("sys_chatgroupc")
+@ApiModel(value = "Chatgroupc对象", description = "聊天记录表")
+public class Chatgroupc implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键
+ */
+ @ApiModelProperty(value = "主键")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+ /**
+ * 发送消息内容
+ */
+ @ApiModelProperty(value = "发送消息内容")
+ private String postMessage;
+ /**
+ * 消息类型 0 文本 1 表情 2 图片 3 视频...
+ */
+ @ApiModelProperty(value = "消息类型 0 文本 1 表情 2 图片 3 视频...")
+ private Integer messageType;
+ /**
+ * 接收状态 0 已接收 1 未接收
+ */
+ @ApiModelProperty(value = "接收状态 0 已接收 1 未接收")
+ private Integer status;
+ /**
+ * 发送时间
+ */
+ @ApiModelProperty(value = "发送时间")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date postTime;
+ /**
+ * 群主id
+ */
+ @ApiModelProperty(value = "群主id")
+ private Long groupId;
+ /**
+ * 发送人id
+ */
+ @ApiModelProperty(value = "发送人id")
+ private Long senderId;
+ /**
+ * 群id
+ */
+ @ApiModelProperty(value = "群id")
+ private Long gid;
+
+
+}
diff --git a/src/main/java/org/springblade/modules/chatrgc/mapper/ChatgroupcMapper.java b/src/main/java/org/springblade/modules/chatrgc/mapper/ChatgroupcMapper.java
new file mode 100644
index 0000000..a82a1b8
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrgc/mapper/ChatgroupcMapper.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.chatrgc.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.chatrgc.entity.Chatgroupc;
+import org.springblade.modules.chatrgc.vo.ChatgroupcVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 聊天记录表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-06-24
+ */
+public interface ChatgroupcMapper extends BaseMapper<Chatgroupc> {
+
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param chatgroupc
+ * @return
+ */
+ List<ChatgroupcVO> selectChatgroupcPage(IPage page, ChatgroupcVO chatgroupc);
+ List<Map<String, Object>> selectList(String gid);
+}
diff --git a/src/main/java/org/springblade/modules/chatrgc/mapper/ChatgroupcMapper.xml b/src/main/java/org/springblade/modules/chatrgc/mapper/ChatgroupcMapper.xml
new file mode 100644
index 0000000..0faae68
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrgc/mapper/ChatgroupcMapper.xml
@@ -0,0 +1,44 @@
+<?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="org.springblade.modules.chatrgc.mapper.ChatgroupcMapper">
+
+ <!-- 通用查询映射结果 -->
+ <resultMap id="chatgroupcResultMap" type="org.springblade.modules.chatrgc.entity.Chatgroupc">
+ <id column="id" property="id"/>
+ <result column="post_message" property="postMessage"/>
+ <result column="message_type" property="messageType"/>
+ <result column="status" property="status"/>
+ <result column="post_time" property="postTime"/>
+ <result column="group_id" property="groupId"/>
+ <result column="sender_id" property="senderId"/>
+ <result column="gid" property="gid"/>
+ </resultMap>
+
+
+ <select id="selectChatgroupcPage" resultMap="chatgroupcResultMap">
+ select * from sys_chatgroupc where is_deleted = 0
+ </select>
+
+
+ <!--群消息-->
+ <select id="selectList" resultType="java.util.HashMap">
+ SELECT
+ c.id,
+ c.post_message,
+ c.message_type,
+ c.post_time,
+ c.group_id,
+ c.sender_id,
+ u.real_name,
+ u.avatar,
+ us.real_name AS groudname,
+ us.avatar AS groupavatar
+ FROM
+ sys_chatgroupc c
+ LEFT JOIN blade_user u ON c.sender_id = u.id
+ LEFT JOIN blade_user us ON c.group_id = us.id
+ WHERE c.gid=#{gid}
+ order by c.post_time desc
+ </select>
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/chatrgc/service/IChatgroupcService.java b/src/main/java/org/springblade/modules/chatrgc/service/IChatgroupcService.java
new file mode 100644
index 0000000..6aece3b
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrgc/service/IChatgroupcService.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.chatrgc.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.chatrgc.entity.Chatgroupc;
+import org.springblade.modules.chatrgc.vo.ChatgroupcVO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 聊天记录表 服务类
+ *
+ * @author BladeX
+ * @since 2021-06-24
+ */
+public interface IChatgroupcService extends IService<Chatgroupc> {
+
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param chatgroupc
+ * @return
+ */
+ IPage<ChatgroupcVO> selectChatgroupcPage(IPage<ChatgroupcVO> page, ChatgroupcVO chatgroupc);
+ List<Map<String, Object>> selectList(String gid);
+}
diff --git a/src/main/java/org/springblade/modules/chatrgc/service/impl/ChatgroupcServiceImpl.java b/src/main/java/org/springblade/modules/chatrgc/service/impl/ChatgroupcServiceImpl.java
new file mode 100644
index 0000000..b3061b3
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrgc/service/impl/ChatgroupcServiceImpl.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.chatrgc.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.modules.chatrgc.entity.Chatgroupc;
+import org.springblade.modules.chatrgc.mapper.ChatgroupcMapper;
+import org.springblade.modules.chatrgc.service.IChatgroupcService;
+import org.springblade.modules.chatrgc.vo.ChatgroupcVO;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 聊天记录表 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-06-24
+ */
+@Service
+public class ChatgroupcServiceImpl extends ServiceImpl<ChatgroupcMapper, Chatgroupc> implements IChatgroupcService {
+
+ @Override
+ public IPage<ChatgroupcVO> selectChatgroupcPage(IPage<ChatgroupcVO> page, ChatgroupcVO chatgroupc) {
+ return page.setRecords(baseMapper.selectChatgroupcPage(page, chatgroupc));
+ }
+
+ @Override
+ public List<Map<String, Object>> selectList(String gid) {
+ return baseMapper.selectList(gid);
+ }
+
+}
diff --git a/src/main/java/org/springblade/modules/chatrgc/vo/ChatgroupcVO.java b/src/main/java/org/springblade/modules/chatrgc/vo/ChatgroupcVO.java
new file mode 100644
index 0000000..821e5ee
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrgc/vo/ChatgroupcVO.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.chatrgc.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.chatrgc.entity.Chatgroupc;
+
+/**
+ * 聊天记录表视图实体类
+ *
+ * @author BladeX
+ * @since 2021-06-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "ChatgroupcVO对象", description = "聊天记录表")
+public class ChatgroupcVO extends Chatgroupc {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/system/mapper/UserMapper.java b/src/main/java/org/springblade/modules/system/mapper/UserMapper.java
index 85caca4..d57bdfe 100644
--- a/src/main/java/org/springblade/modules/system/mapper/UserMapper.java
+++ b/src/main/java/org/springblade/modules/system/mapper/UserMapper.java
@@ -129,4 +129,6 @@
* @return
*/
UserVO getUserAgeById(@Param("userId") Long userId);
+
+ List<Map<String, Object>> selectUser();
}
diff --git a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
index e71440d..82b34a5 100644
--- a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -360,4 +360,10 @@
<select id="getUserAgeById" resultType="org.springblade.modules.system.vo.UserVO">
select id,ifnull(TIMESTAMPDIFF(YEAR, birthday, CURDATE()),0) age from blade_user where id = #{userId}
</select>
+
+
+ <select id="selectUser" resultType="java.util.HashMap">
+ select CAST(id AS CHAR) as groupmember,real_name as rname from blade_user
+ </select>
+
</mapper>
diff --git a/src/main/java/org/springblade/modules/system/service/IUserService.java b/src/main/java/org/springblade/modules/system/service/IUserService.java
index a992a59..1da4208 100644
--- a/src/main/java/org/springblade/modules/system/service/IUserService.java
+++ b/src/main/java/org/springblade/modules/system/service/IUserService.java
@@ -277,4 +277,6 @@
* @return
*/
UserVO getUserAgeById(Long userId);
+
+ List<Map<String, Object>> selectUser();
}
diff --git a/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java b/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
index d680728..a36bcd8 100644
--- a/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
+++ b/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
@@ -518,4 +518,10 @@
public UserVO getUserAgeById(Long userId) {
return baseMapper.getUserAgeById(userId);
}
+
+ @Override
+ public List<Map<String, Object>> selectUser() {
+ return baseMapper.selectUser();
+ }
+
}
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index 683021c..ee29b81 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -13,7 +13,7 @@
# commandTimeout: 5000
datasource:
# MySql
-# url: jdbc:mysql://localhost:3306/zhbaw?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
+# url: jdbc:mysql://localhost:2083/zhbaw?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
# username: root
# password: zhba0728
--
Gitblit v1.9.3