|
|
@@ -1,71 +1,71 @@
|
|
|
-package seecoder.devcloud.web.controller.user;
|
|
|
-
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiImplicitParam;
|
|
|
-import io.swagger.annotations.ApiImplicitParams;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-import seecoder.devcloud.common.exceptions.ServiceException;
|
|
|
-import seecoder.devcloud.web.model.vo.Response;
|
|
|
-import seecoder.devcloud.web.model.vo.user.GroupVO;
|
|
|
-import seecoder.devcloud.web.service.user.GroupService;
|
|
|
-
|
|
|
-import javax.validation.constraints.Pattern;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-/**
|
|
|
- * @author PuHong Weng
|
|
|
- * @date 2021/3/18
|
|
|
- * @description:
|
|
|
- */
|
|
|
-@RestController
|
|
|
-@RequestMapping("/groups")
|
|
|
-@Api(tags = "组 api")
|
|
|
-public class GroupController {
|
|
|
-
|
|
|
- private final GroupService groupService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- public GroupController(GroupService groupService) {
|
|
|
- this.groupService = groupService;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "根据组id获取组", httpMethod = "GET")
|
|
|
- @ApiImplicitParam(name = "groupId",dataType ="string", paramType = "query")
|
|
|
- @GetMapping
|
|
|
- public Response<GroupVO> getGroup(@RequestParam("groupId") Integer groupId){
|
|
|
- return Response.buildSuccess(groupService.getGroup(groupId));
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "根据组id获取组成员id列表", httpMethod = "GET")
|
|
|
- @ApiImplicitParam(name = "groupId",dataType ="string", paramType = "query")
|
|
|
- @GetMapping("/members")
|
|
|
- public Response<List<Integer>> getGroupMemberIds(@RequestParam("groupId") Integer groupId){
|
|
|
- return Response.buildSuccess(groupService.getGroupMemberIds(groupId));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation(value = "创建组", httpMethod = "POST")
|
|
|
- @ApiImplicitParam(name = "name",dataType ="string", paramType = "query")
|
|
|
- @PostMapping()
|
|
|
- public Response<GroupVO> createGroup(@RequestParam("name")
|
|
|
- @Validated
|
|
|
- @Pattern(regexp = "^\\w{3,20}$", message = "组名称只能为长度为3-20且由数字、26个英文字母或者下划线组成的字符串")
|
|
|
- String name) throws ServiceException {
|
|
|
- return Response.buildSuccess(groupService.createGroup(name));
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "添加组成员", httpMethod = "POST")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "invitedUserId",dataType ="int", paramType = "query"),
|
|
|
- @ApiImplicitParam(name = "groupId",dataType ="int", paramType = "query")
|
|
|
- })
|
|
|
- @PostMapping("/members")
|
|
|
- public Response addMember(@RequestParam("invitedUserId") Integer invitedUserId,
|
|
|
- @RequestParam("groupId") Integer groupId) throws ServiceException {
|
|
|
- groupService.addMember(invitedUserId, groupId);
|
|
|
- return Response.buildSuccess();
|
|
|
- }
|
|
|
-}
|
|
|
+//package seecoder.devcloud.web.controller.user;
|
|
|
+//
|
|
|
+//import io.swagger.annotations.Api;
|
|
|
+//import io.swagger.annotations.ApiImplicitParam;
|
|
|
+//import io.swagger.annotations.ApiImplicitParams;
|
|
|
+//import io.swagger.annotations.ApiOperation;
|
|
|
+//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+//import org.springframework.validation.annotation.Validated;
|
|
|
+//import org.springframework.web.bind.annotation.*;
|
|
|
+//import seecoder.devcloud.common.exceptions.ServiceException;
|
|
|
+//import seecoder.devcloud.web.model.vo.Response;
|
|
|
+//import seecoder.devcloud.web.model.vo.user.GroupVO;
|
|
|
+//import seecoder.devcloud.web.service.user.GroupService;
|
|
|
+//
|
|
|
+//import javax.validation.constraints.Pattern;
|
|
|
+//import java.util.List;
|
|
|
+//
|
|
|
+///**
|
|
|
+// * @author PuHong Weng
|
|
|
+// * @date 2021/3/18
|
|
|
+// * @description:
|
|
|
+// */
|
|
|
+//@RestController
|
|
|
+//@RequestMapping("/groups")
|
|
|
+//@Api(tags = "组 api")
|
|
|
+//public class GroupController {
|
|
|
+//
|
|
|
+// private final GroupService groupService;
|
|
|
+//
|
|
|
+// @Autowired
|
|
|
+// public GroupController(GroupService groupService) {
|
|
|
+// this.groupService = groupService;
|
|
|
+// }
|
|
|
+//
|
|
|
+// @ApiOperation(value = "根据组id获取组", httpMethod = "GET")
|
|
|
+// @ApiImplicitParam(name = "groupId",dataType ="string", paramType = "query")
|
|
|
+// @GetMapping
|
|
|
+// public Response<GroupVO> getGroup(@RequestParam("groupId") Integer groupId){
|
|
|
+// return Response.buildSuccess(groupService.getGroup(groupId));
|
|
|
+// }
|
|
|
+//
|
|
|
+// @ApiOperation(value = "根据组id获取组成员id列表", httpMethod = "GET")
|
|
|
+// @ApiImplicitParam(name = "groupId",dataType ="string", paramType = "query")
|
|
|
+// @GetMapping("/members")
|
|
|
+// public Response<List<Integer>> getGroupMemberIds(@RequestParam("groupId") Integer groupId){
|
|
|
+// return Response.buildSuccess(groupService.getGroupMemberIds(groupId));
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// @ApiOperation(value = "创建组", httpMethod = "POST")
|
|
|
+// @ApiImplicitParam(name = "name",dataType ="string", paramType = "query")
|
|
|
+// @PostMapping()
|
|
|
+// public Response<GroupVO> createGroup(@RequestParam("name")
|
|
|
+// @Validated
|
|
|
+// @Pattern(regexp = "^\\w{3,20}$", message = "组名称只能为长度为3-20且由数字、26个英文字母或者下划线组成的字符串")
|
|
|
+// String name) throws ServiceException {
|
|
|
+// return Response.buildSuccess(groupService.createGroup(name));
|
|
|
+// }
|
|
|
+//
|
|
|
+// @ApiOperation(value = "添加组成员", httpMethod = "POST")
|
|
|
+// @ApiImplicitParams({
|
|
|
+// @ApiImplicitParam(name = "invitedUserId",dataType ="int", paramType = "query"),
|
|
|
+// @ApiImplicitParam(name = "groupId",dataType ="int", paramType = "query")
|
|
|
+// })
|
|
|
+// @PostMapping("/members")
|
|
|
+// public Response addMember(@RequestParam("invitedUserId") Integer invitedUserId,
|
|
|
+// @RequestParam("groupId") Integer groupId) throws ServiceException {
|
|
|
+// groupService.addMember(invitedUserId, groupId);
|
|
|
+// return Response.buildSuccess();
|
|
|
+// }
|
|
|
+//}
|