From aa8836a65e97e297340fff3a42615f0a36f314e7 Mon Sep 17 00:00:00 2001
From: baizonghao <1719256278@qq.com>
Date: 星期一, 22 五月 2023 16:10:10 +0800
Subject: [PATCH] 后台管理端删除聊天记录,新增新增头像,用户管理删选条件等

---
 src/main/java/com/example/jz/controller/GroupController.java |   33 +++++++++++++++++++++++++--------
 1 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/example/jz/controller/GroupController.java b/src/main/java/com/example/jz/controller/GroupController.java
index 88968fe..e11878e 100644
--- a/src/main/java/com/example/jz/controller/GroupController.java
+++ b/src/main/java/com/example/jz/controller/GroupController.java
@@ -2,12 +2,12 @@
 
 
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.api.ApiController;
 import com.example.jz.modle.R;
 import com.example.jz.modle.entity.Announcement;
 import com.example.jz.modle.entity.Group;
 import com.example.jz.modle.entity.GroupUser;
-import com.example.jz.modle.entity.Message;
 import com.example.jz.modle.vo.GroupMessageVo;
 import com.example.jz.modle.vo.GroupUserVo;
 import com.example.jz.service.GroupService;
@@ -55,6 +55,14 @@
         return R.ok(groupService.getAllMessage(id));
     }
 
+//    @GetMapping("deleteGroupMessage")
+//    @ApiOperation(value = "鍒犻櫎缇ゆ秷鎭�")
+//    @ApiImplicitParam(name = "messageId", value = "娑堟伅id", required = true, dataType = "Integer")
+//    public R deleteMessage(@RequestParam("messageId") Integer messageId){
+//        boolean flag = groupService.removeById(messageId);
+//        return flag ? R.ok(true, "鍒犻櫎鎴愬姛") : R.failed("鍒犻櫎鎴愬姛");
+//    }
+
 
     @GetMapping("getGroupMessage")
     @ApiOperation(value = "鑾峰彇褰撳墠缇ょ粍娑堟伅閫氳繃鎴愬憳鎴栬�呭唴瀹�")
@@ -62,28 +70,34 @@
             @ApiImplicitParam(name = "report", value = "缇ょ粍id", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "context", value = "缇ょ粍id", required = true, dataType = "String")
     })
-    public R<List<GroupMessageVo>> get(@RequestParam(value = "report" ,required = false) String reporter, @RequestParam(value = "context",required = false) String context,Integer groupId) {
-        return R.ok(groupService.getByCondition(reporter, context,groupId));
+    public R<List<GroupMessageVo>> get(@RequestParam(value = "report", required = false) String reporter, @RequestParam(value = "context", required = false) String context, Integer groupId) {
+        return R.ok(groupService.getByCondition(reporter, context, groupId));
     }
 
     @PutMapping("banSpeech")
     @ApiOperation(value = "绂佽█")
     @ApiImplicitParam(name = "id", value = "缇ょ粍id", required = true, dataType = "Integer")
-    public R setBanSpeech(@RequestParam("id") Integer id) {
-        return R.ok(groupUserService.update(new UpdateWrapper<GroupUser>().set("ban_speech",1).eq("user_id",id)));
+    public R setBanSpeech(@RequestParam("id") Integer id, @RequestParam("groupId") Integer groupId) {
+        return R.ok(groupUserService.update(new UpdateWrapper<GroupUser>().set("ban_speech", 1).eq("user_id", id).eq("group_id", groupId)));
     }
 
     @PutMapping("allowSpeech")
     @ApiOperation(value = "鍏佽鍙戣█")
     @ApiImplicitParam(name = "id", value = "缇ょ粍id", required = true, dataType = "Integer")
-    public R setAllowSpeech(@RequestParam("id") Integer id) {
-        return R.ok(groupUserService.update(new UpdateWrapper<GroupUser>().set("ban_speech",0).eq("user_id",id)));
+    public R setAllowSpeech(@RequestParam("id") Integer id, @RequestParam("groupId") Integer groupId) {
+        return R.ok(groupUserService.update(new UpdateWrapper<GroupUser>().set("ban_speech", 0).eq("user_id", id).eq("group_id", groupId)));
     }
 
     @PutMapping("banSpeechAll")
     @ApiOperation(value = "鍏ㄩ儴绂佽█")
     public R setBanSpeechAll(@RequestParam("id") Integer id) {
-        return R.ok(groupUserService.update(new UpdateWrapper<GroupUser>().set("ban_speech",1).eq("group_id",id)));
+        return R.ok(groupUserService.update(new UpdateWrapper<GroupUser>().set("ban_speech", 1).eq("group_id", id)));
+    }
+
+    @PutMapping("banSpeechRemark")
+    @ApiOperation(value = "鍏ㄩ儴鍏佽鍙戣█")
+    public R setBanSpeechRemark(@RequestParam("id") Integer id) {
+        return R.ok(groupUserService.update(new UpdateWrapper<GroupUser>().set("ban_speech", 0).eq("group_id", id)));
     }
 
     /**
@@ -113,6 +127,9 @@
             @ApiImplicitParam(name = "id", value = "缇ょ粍id", required = true, dataType = "Integer")
     })
     public R<Boolean> sendMessage(@RequestParam("id") Integer id, @RequestParam("text") String text) {
+        if (StringUtils.isBlank(text)) {
+            return R.failed("鏂囨湰涓虹┖");
+        }
         return R.ok(groupService.sendMessage(id, text));
     }
 

--
Gitblit v1.8.0