|
|
@@ -6,14 +6,13 @@ 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.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
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
|
|
|
@@ -32,15 +31,29 @@ public class GroupController {
|
|
|
this.groupService = groupService;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "根据组id获取组", httpMethod = "GET")
|
|
|
+ @ApiImplicitParam(name = "groupId",dataType ="string", paramType = "param")
|
|
|
+ @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 = "param")
|
|
|
+ @GetMapping("/members")
|
|
|
+ public Response<List<Integer>> getGroupMemberIds(@RequestParam("groupId") Integer groupId){
|
|
|
+ return Response.buildSuccess(groupService.getGroupMemberIds(groupId));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@ApiOperation(value = "创建组", httpMethod = "POST")
|
|
|
@ApiImplicitParam(name = "userId",dataType ="string", paramType = "param")
|
|
|
@PostMapping()
|
|
|
- public Response createGroup(@RequestParam("name")
|
|
|
+ public Response<GroupVO> createGroup(@RequestParam("name")
|
|
|
@Validated
|
|
|
@Pattern(regexp = "^\\w{3,20}$", message = "组名称只能为长度为3-20且由数字、26个英文字母或者下划线组成的字符串")
|
|
|
String name){
|
|
|
- groupService.createGroup(name);
|
|
|
- return Response.buildSuccess();
|
|
|
+ return Response.buildSuccess(groupService.createGroup(name));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "添加组成员", httpMethod = "POST")
|