From 048ea322dcac11a4bccff8c3d39d49b502be902d Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Fri, 25 Jun 2021 09:15:32 +0800
Subject: [PATCH] 1.群聊接口编写
---
src/main/java/org/springblade/modules/chatrg/entity/Chatgroup.java | 82 +++++
src/main/java/org/springblade/modules/chatrg/mapper/ChatgroupMapper.java | 43 ++
src/main/java/org/springblade/modules/chatrgc/service/IChatgroupcService.java | 44 ++
src/main/java/org/springblade/modules/chatrg/controller/ChatgroupController.java | 134 ++++++++
src/main/java/org/springblade/modules/chatrg/dto/ChatgroupDTO.java | 34 ++
src/main/java/org/springblade/modules/chatrgc/mapper/ChatgroupcMapper.java | 43 ++
src/main/java/org/springblade/modules/chatrg/vo/ChatgroupVO.java | 36 ++
src/main/java/org/springblade/modules/chatrgc/entity/Chatgroupc.java | 85 +++++
src/main/java/org/springblade/modules/chatrgc/service/impl/ChatgroupcServiceImpl.java | 49 +++
src/main/java/org/springblade/modules/chatrgc/vo/ChatgroupcVO.java | 36 ++
src/main/java/org/springblade/modules/chatrg/service/impl/ChatgroupServiceImpl.java | 49 +++
src/main/java/org/springblade/modules/chatrg/mapper/ChatgroupMapper.xml | 26 +
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/chatrgc/mapper/ChatgroupcMapper.xml | 41 ++
src/main/java/org/springblade/modules/chatrgc/dto/ChatgroupcDTO.java | 34 ++
16 files changed, 915 insertions(+), 0 deletions(-)
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..809331e
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrg/controller/ChatgroupController.java
@@ -0,0 +1,134 @@
+/*
+ * 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 io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+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.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.chatrg.entity.Chatgroup;
+import org.springblade.modules.chatrg.vo.ChatgroupVO;
+import org.springblade.modules.chatrg.service.IChatgroupService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 控制器
+ *
+ * @author BladeX
+ * @since 2021-06-24
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/chatgroup")
+@Api(value = "", tags = "接口")
+public class ChatgroupController extends BladeController {
+
+ private final IChatgroupService chatgroupService;
+
+ /**
+ * 详情
+ */
+ @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));
+ 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) {
+ 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
+ */
+ @PostMapping("/selectList")
+ public R selectList() {
+ return R.data(chatgroupService.selectList());
+ }
+
+}
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..e21b200
--- /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 org.springblade.modules.chatrg.entity.Chatgroup;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @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..e867fd0
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrg/entity/Chatgroup.java
@@ -0,0 +1,82 @@
+/*
+ * 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.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 实体类
+ *
+ * @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;
+ /**
+ * 群主id
+ */
+ @ApiModelProperty(value = "群主id")
+ @TableField("GroupId")
+ private Integer 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..220c372
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrg/mapper/ChatgroupMapper.java
@@ -0,0 +1,43 @@
+/*
+ * 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 org.springblade.modules.chatrg.entity.Chatgroup;
+import org.springblade.modules.chatrg.vo.ChatgroupVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+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();
+}
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..e756d9c
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrg/mapper/ChatgroupMapper.xml
@@ -0,0 +1,26 @@
+<?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"/>
+ </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
+ </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..8127331
--- /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 org.springblade.modules.chatrg.entity.Chatgroup;
+import org.springblade.modules.chatrg.vo.ChatgroupVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+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();
+}
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..9188fa1
--- /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 org.springblade.modules.chatrg.entity.Chatgroup;
+import org.springblade.modules.chatrg.vo.ChatgroupVO;
+import org.springblade.modules.chatrg.mapper.ChatgroupMapper;
+import org.springblade.modules.chatrg.service.IChatgroupService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+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() {
+ return baseMapper.selectList();
+ }
+
+}
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..9e70a62
--- /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 org.springblade.modules.chatrg.entity.Chatgroup;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 视图实体类
+ *
+ * @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..7e4a789
--- /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 io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+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.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.chatrgc.entity.Chatgroupc;
+import org.springblade.modules.chatrgc.vo.ChatgroupcVO;
+import org.springblade.modules.chatrgc.service.IChatgroupcService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 聊天记录表 控制器
+ *
+ * @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 groupid 群主id
+ * @return
+ */
+ @PostMapping("/selectList")
+ public R selectList(String groupid) {
+ return R.data(chatgroupcService.selectList(groupid));
+ }
+
+}
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..1e2aa88
--- /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 org.springblade.modules.chatrgc.entity.Chatgroupc;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 聊天记录表数据传输对象实体类
+ *
+ * @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..82ec5cd
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrgc/entity/Chatgroupc.java
@@ -0,0 +1,85 @@
+/*
+ * 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.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 聊天记录表实体类
+ *
+ * @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 Boolean messageType;
+ /**
+ * 接收状态 0 已接收 1 未接收
+ */
+ @ApiModelProperty(value = "接收状态 0 已接收 1 未接收")
+ private Boolean status;
+ /**
+ * 发送时间
+ */
+ @ApiModelProperty(value = "发送时间")
+ private LocalDateTime postTime;
+ /**
+ * 群主id
+ */
+ @ApiModelProperty(value = "群主id")
+ private Long groupId;
+ /**
+ * 发送人id
+ */
+ @ApiModelProperty(value = "发送人id")
+ private Long senderId;
+ /**
+ * 群id
+ */
+ @ApiModelProperty(value = "群id")
+ private Integer 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..5fa96df
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrgc/mapper/ChatgroupcMapper.java
@@ -0,0 +1,43 @@
+/*
+ * 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 org.springblade.modules.chatrgc.entity.Chatgroupc;
+import org.springblade.modules.chatrgc.vo.ChatgroupcVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+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 groupid);
+}
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..74247a1
--- /dev/null
+++ b/src/main/java/org/springblade/modules/chatrgc/mapper/ChatgroupcMapper.xml
@@ -0,0 +1,41 @@
+<?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.post_message,
+ c.message_type,
+ c.post_time,
+ c.group_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.group_id=#{groudid}
+ </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..fe81aac
--- /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 org.springblade.modules.chatrgc.entity.Chatgroupc;
+import org.springblade.modules.chatrgc.vo.ChatgroupcVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+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 groupid);
+}
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..b277963
--- /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 org.springblade.modules.chatrgc.entity.Chatgroupc;
+import org.springblade.modules.chatrgc.vo.ChatgroupcVO;
+import org.springblade.modules.chatrgc.mapper.ChatgroupcMapper;
+import org.springblade.modules.chatrgc.service.IChatgroupcService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+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 groupid) {
+ return baseMapper.selectList(groupid);
+ }
+
+}
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..9b844a2
--- /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 org.springblade.modules.chatrgc.entity.Chatgroupc;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 聊天记录表视图实体类
+ *
+ * @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;
+
+}
--
Gitblit v1.9.3