|
@@ -0,0 +1,71 @@
|
|
|
+package com.yonge.cooleshow.student.controller;
|
|
|
+
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.ImGroupMember;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.ImGroupMemberService;
|
|
|
+import com.yonge.cooleshow.common.controller.BaseController;
|
|
|
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
+import com.yonge.cooleshow.common.exception.BizException;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 即时通讯群组(ImGroupMember)表控制层
|
|
|
+ *
|
|
|
+ * @author zx
|
|
|
+ * @since 2022-03-22 10:45:56
|
|
|
+ */
|
|
|
+@Api(tags = "即时通讯群组联系人")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/imGroupMember")
|
|
|
+public class ImGroupMemberController extends BaseController {
|
|
|
+ /**
|
|
|
+ * 服务对象
|
|
|
+ */
|
|
|
+ @Resource
|
|
|
+ private ImGroupMemberService imGroupMemberService;
|
|
|
+
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "groupId", dataType = "Long", value = "群编号",required = true),
|
|
|
+ @ApiImplicitParam(name = "userId", dataType = "Long", value = "用户编号",required = true),
|
|
|
+ })
|
|
|
+ @ApiOperation("获取好友详情")
|
|
|
+ @PostMapping(value = "/getUserDetail")
|
|
|
+ public HttpResponseResult<ImGroupMember> getUserDetail(@RequestBody Map<String,Long> params) throws Exception {
|
|
|
+ if(Objects.isNull(params.get("groupId")) || Objects.isNull(params.get("userId"))){
|
|
|
+ throw new BizException("参数校验失败");
|
|
|
+ }
|
|
|
+ return succeed(imGroupMemberService.getUserDetail(params.get("userId"),params.get("groupId")));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "search", dataType = "String", value = "根据用户编号、昵称模糊查询"),
|
|
|
+ @ApiImplicitParam(name = "groupId", dataType = "Long", value = "群编号")
|
|
|
+ })
|
|
|
+ @ApiOperation("分页查询")
|
|
|
+ @PostMapping(value = "/queryPage")
|
|
|
+ public HttpResponseResult<List<ImGroupMember>> queryPage(@RequestBody Map<String,Object> params) throws Exception {
|
|
|
+ if(Objects.isNull(params.get("search")) || Objects.isNull(params.get("groupId"))){
|
|
|
+ throw new BizException("参数校验失败");
|
|
|
+ }
|
|
|
+ List<ImGroupMember> iPage = imGroupMemberService.getBaseMapper().selectList(Wrappers.<ImGroupMember>query().lambda()
|
|
|
+ .or(e->e.eq(ImGroupMember::getUserId, params.get("search"))
|
|
|
+ .like(ImGroupMember::getNickname, params.get("search")))
|
|
|
+ .eq(ImGroupMember::getGroupId,params.get("groupId")).orderByDesc(ImGroupMember::getId));
|
|
|
+ return succeed(iPage);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|