本文整理汇总了Java中io.swagger.annotations.ApiImplicitParams类的典型用法代码示例。如果您正苦于以下问题:Java ApiImplicitParams类的具体用法?Java ApiImplicitParams怎么用?Java ApiImplicitParams使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ApiImplicitParams类属于io.swagger.annotations包,在下文中一共展示了ApiImplicitParams类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CreatePosts
import io.swagger.annotations.ApiImplicitParams; //导入依赖的package包/类
@ApiOperation("发帖接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "content", value = "帖子内容", dataType = "String"),
@ApiImplicitParam(name = "title", value = "帖子标题", dataType = "String"),
@ApiImplicitParam(name = "token", value = "用户令牌", dataType = "String"),
@ApiImplicitParam(name = "labelId", value = "标签ID", dataType = "Integer")
})
@PostMapping
public QuarkResult CreatePosts(Posts posts, String token, Integer labelId) {
QuarkResult result = restProcessor(() -> {
if (token == null) return QuarkResult.warn("请先登录!");
User userbytoken = userService.getUserByToken(token);
if (userbytoken == null) return QuarkResult.warn("用户不存在,请先登录!");
User user = userService.findOne(userbytoken.getId());
if (user.getEnable() != 1) return QuarkResult.warn("用户处于封禁状态!");
postsService.savePosts(posts, labelId, user);
return QuarkResult.ok();
});
return result;
}
示例2: getUserList
import io.swagger.annotations.ApiImplicitParams; //导入依赖的package包/类
@GetMapping("/userListByPage.json")
@ResponseBody
@ApiOperation(value = "分页查询用户列表", notes = "不传分页默认1页15条")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码"),
@ApiImplicitParam(name = "pageSize", value = "条数")
})
public JsonResponse getUserList(@Validated({Search.class}) UserQuery user,
BindingResult bindingResult,
PageKey pageKey)
throws ValidateException {
BindingResultUtil.validateResult(bindingResult);
Page<Object> objects = PageHelper.startPage(pageKey.getPage(), pageKey.getPageSize(), true);
UserExample example = new UserExample();
example.createCriteria().andUserNameLike(StringUtil.turn2LikeStr(user.getName()));
JsonResponse json = new JsonResponse();
List<User> users = userMapper.selectByExample(example);
json.putData("list", users);
System.out.println("**********共有" + objects.getTotal() + "条数据*********");
// redisTemplate.opsForList().rightPushAll("userList", users);
return json;
}
示例3: getParticipantFromCGOR
import io.swagger.annotations.ApiImplicitParams; //导入依赖的package包/类
@ApiOperation(value = "getParticipantFromCGOR", nickname = "getParticipantFromCGOR")
@RequestMapping(value = "/CISConnector/getParticipantFromCGOR/{cgorName}", method = RequestMethod.GET)
@ApiImplicitParams({
@ApiImplicitParam(name = "cgorName", value = "the CGOR name", required = true, dataType = "String", paramType = "path"),
@ApiImplicitParam(name = "organisation", value = "the Organisation name", required = true, dataType = "String", paramType = "query")
})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success", response = Participant.class),
@ApiResponse(code = 400, message = "Bad Request", response = Participant.class),
@ApiResponse(code = 500, message = "Failure", response = Participant.class)})
public ResponseEntity<Participant> getParticipantFromCGOR(@PathVariable String cgorName, @QueryParam("organisation") String organisation) {
log.info("--> getParticipantFromCGOR: " + cgorName);
Participant participant;
try {
participant = connector.getParticipantFromCGOR(cgorName, organisation);
} catch (CISCommunicationException e) {
log.error("Error executing the request: Communication Error" , e);
participant = null;
}
HttpHeaders responseHeaders = new HttpHeaders();
log.info("getParticipantFromCGOR -->");
return new ResponseEntity<Participant>(participant, responseHeaders, HttpStatus.OK);
}
示例4: createAuthenticationToken
import io.swagger.annotations.ApiImplicitParams; //导入依赖的package包/类
@ApiOperation(value = "授权", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query",name = "appName", value = "应用的名字", required = true,dataType = "String"),
@ApiImplicitParam(paramType = "query",name = "vq",value = "vq",required = true,dataType = "String"),
@ApiImplicitParam(paramType = "query",name = "device",value = "设备的名字",required = true,dataType = "String")})
@RequestMapping(value = "${jwt.route.authentication.path}", method = RequestMethod.POST)
public ResponseEntity<?> createAuthenticationToken(String appName,String vq, Device device) throws AuthenticationException {
logger.info("应用:" + appName + " 正在授权!");
App app = appRepository.findFirstByAppname(appName);
if (app == null) {
return ResponseEntity.ok(new ErrorReporter(1, "未找到应用" + appName));
}
YibanOAuth yibanOAuth = new YibanOAuth(vq, app);
yibanOAuth.dealYibanOauth();
if (yibanOAuth.isHasError() == false) {
upcYbUserFactory.createUser(yibanOAuth.getYibanBasicUserInfo());
String ybid = String.valueOf(yibanOAuth.getYibanBasicUserInfo().visit_user.userid);
String ybtocken = yibanOAuth.getYibanBasicUserInfo().visit_oauth.access_token;
logger.info("ybtocken: " + ybtocken);
final JwtUser userDetails = (JwtUser) userDetailsService.loadUserByUsername(ybid);
final String token = jwtTokenUtil.generateToken(userDetails, ybtocken,appName, device);
logger.info("发放token:" + token);
return ResponseEntity.ok(new JwtAuthenticationResponse(token));
} else {
return ResponseEntity.ok(new ErrorReporter(2, "解析vq失败,可能是由于密钥长度不匹配"));
}
}
示例5: getDomainDetails
import io.swagger.annotations.ApiImplicitParams; //导入依赖的package包/类
/**
* 查询某一个域的详细信息
* 如果http请求的参数domain_id为空,则返回null
*/
@RequestMapping(value = "/details", method = RequestMethod.GET)
@ApiOperation(value = "查询域的详细信息", notes = "查询某一个指定域的详细定义信息,如果请求的参数为空,则返回用户自己所在域的详细信息")
@ApiImplicitParams({
@ApiImplicitParam(required = true, name = "domain_id", value = "域编码")
})
public String getDomainDetails(HttpServletRequest request) {
String domainId = request.getParameter("domain_id");
if (domainId == null || domainId.isEmpty()) {
logger.info("domain id is empty, return null");
return null;
}
// 检查用户对域有没有读权限
Boolean status = authService.domainAuth(request, domainId, "r").getStatus();
if (status) {
return Hret.error(403, "您没有被授权访问域【" + domainId + "】", null);
}
DomainEntity domainEntity = domainService.getDomainDetails(domainId);
return new GsonBuilder().create().toJson(domainEntity);
}
示例6: update
import io.swagger.annotations.ApiImplicitParams; //导入依赖的package包/类
/**
* 更新域信息
*/
@RequestMapping(method = RequestMethod.PUT)
@ResponseBody
@ApiOperation(value = "更新域定义信息", notes = "更新域的详细信息,如:域名称,域状态")
@ApiImplicitParams({
@ApiImplicitParam(required = true, name = "domain_id", value = "域编码"),
@ApiImplicitParam(required = true, name = "domain_desc", value = "域描述信息")
})
public String update(HttpServletResponse response, HttpServletRequest request) {
DomainEntity domainEntity = parse(request);
Boolean status = authService.domainAuth(request, domainEntity.getDomain_id(), "w").getStatus();
if (!status) {
response.setStatus(403);
return Hret.error(403, "你没有权限编辑域 [ " + domainEntity.getDomain_desc() + " ]", domainEntity);
}
RetMsg retMsg = domainService.update(domainEntity);
if (retMsg.checkCode()) {
return Hret.success(retMsg);
}
response.setStatus(retMsg.getCode());
return Hret.error(retMsg);
}
示例7: GetPosts
import io.swagger.annotations.ApiImplicitParams; //导入依赖的package包/类
@ApiOperation("翻页查询帖子接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "search", value = "查询条件", dataType = "int"),
@ApiImplicitParam(name = "type", value = "帖子类型[top : good : ]", dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "页码[从1开始]", dataType = "int"),
@ApiImplicitParam(name = "length", value = "返回结果数量[默认20]", dataType = "int")
})
@GetMapping()
public QuarkResult GetPosts(
@RequestParam(required = false, defaultValue = "") String search,
@RequestParam(required = false, defaultValue = "") String type,
@RequestParam(required = false, defaultValue = "1") int pageNo,
@RequestParam(required = false, defaultValue = "20") int length) {
QuarkResult result = restProcessor(() -> {
if (!type.equals("good") && !type.equals("top") && !type.equals(""))
return QuarkResult.error("类型错误!");
Page<Posts> page = postsService.getPostsByPage(type, search, pageNo - 1, length);
return QuarkResult.ok(page.getContent(), page.getTotalElements(), page.getNumberOfElements());
});
return result;
}
示例8: GetPostsDetail
import io.swagger.annotations.ApiImplicitParams; //导入依赖的package包/类
@ApiOperation("翻页帖子详情与回复接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "postsid", value = "帖子的id", dataType = "int"),
@ApiImplicitParam(name = "pageNo", value = "页码[从1开始]", dataType = "int"),
@ApiImplicitParam(name = "length", value = "返回结果数量[默认20]", dataType = "int")
})
@GetMapping("/detail/{postsid}")
public QuarkResult GetPostsDetail(
@PathVariable("postsid") Integer postsid,
@RequestParam(required = false, defaultValue = "1") int pageNo,
@RequestParam(required = false, defaultValue = "20") int length) {
QuarkResult result = restProcessor(() -> {
HashMap<String, Object> map = new HashMap<>();
Posts posts = postsService.findOne(postsid);
if (posts == null) return QuarkResult.error("帖子不存在");
map.put("posts", posts);
Page<Reply> page = replyService.getReplyByPage(postsid, pageNo - 1, length);
map.put("replys", page.getContent());
return QuarkResult.ok(map, page.getTotalElements(), page.getNumberOfElements());
});
return result;
}
示例9: GetPostsByLabel
import io.swagger.annotations.ApiImplicitParams; //导入依赖的package包/类
@ApiOperation("根据labelId获取帖子接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "labelid", value = "标签的id", dataType = "int"),
@ApiImplicitParam(name = "pageNo", value = "页码[从1开始]", dataType = "int"),
@ApiImplicitParam(name = "length", value = "返回结果数量[默认20]", dataType = "int"),
})
@GetMapping("/label/{labelid}")
public QuarkResult GetPostsByLabel(
@PathVariable("labelid") Integer labelid,
@RequestParam(required = false, defaultValue = "1") int pageNo,
@RequestParam(required = false, defaultValue = "20") int length) {
QuarkResult result = restProcessor(() -> {
Label label = labelService.findOne(labelid);
if (label == null) return QuarkResult.error("标签不存在");
Page<Posts> page = postsService.getPostsByLabel(label, pageNo - 1, length);
return QuarkResult.ok(page.getContent(), page.getTotalElements(), page.getNumberOfElements());
});
return result;
}
示例10: checkUserName
import io.swagger.annotations.ApiImplicitParams; //导入依赖的package包/类
@ApiOperation("注册接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "email", value = "用户邮箱",dataType = "String"),
@ApiImplicitParam(name = "username", value = "用户名称",dataType = "String"),
@ApiImplicitParam(name = "password", value = "用户密码",dataType = "String")
})
@PostMapping
public QuarkResult checkUserName(String email,String username,String password) {
QuarkResult result = restProcessor(() -> {
if (!userService.checkUserName(username))
return QuarkResult.warn("用户名已存在,请重新输入");
if (!userService.checkUserEmail(email))
return QuarkResult.warn("用户邮箱已存在,请重新输入");
else
userService.createUser(email,username,password);
return QuarkResult.ok();
});
return result;
}
示例11: Login
import io.swagger.annotations.ApiImplicitParams; //导入依赖的package包/类
@ApiOperation("登录接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "email", value = "用户邮箱",dataType = "String"),
@ApiImplicitParam(name = "password", value = "用户密码",dataType = "String")
})
@PostMapping("/login")
public QuarkResult Login(String email,String password) {
QuarkResult result = restProcessor(() -> {
User loginUser = userService.findByEmail(email);
if (loginUser == null)
return QuarkResult.warn("用户邮箱不存在,请重新输入");
if (!loginUser.getPassword().equals(DigestUtils.md5DigestAsHex(password.getBytes())))
return QuarkResult.warn("用户密码错误,请重新输入");
String token = userService.LoginUser(loginUser);
return QuarkResult.ok(token);
});
return result;
}
示例12: getUserAndMessageByToken
import io.swagger.annotations.ApiImplicitParams; //导入依赖的package包/类
@ApiOperation("根据Token获取用户的信息与通知消息数量")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "发送给用户的唯一令牌",dataType = "String"),
})
@GetMapping("/message/{token}")
public QuarkResult getUserAndMessageByToken(@PathVariable String token){
QuarkResult result = restProcessor(() -> {
HashMap<String, Object> map = new HashMap<>();
User user = userService.getUserByToken(token);
if (user == null) return QuarkResult.warn("session过期,请重新登录");
long count = notificationService.getNotificationCount(user.getId());
map.put("user",user);
map.put("messagecount",count);
return QuarkResult.ok(map);
});
return result;
}
示例13: updateUser
import io.swagger.annotations.ApiImplicitParams; //导入依赖的package包/类
@ApiOperation("根据Token修改用户的信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "发送给用户的唯一令牌",dataType = "String"),
@ApiImplicitParam(name = "username", value = "要修改的用户名",dataType = "String"),
@ApiImplicitParam(name = "signature", value = "用户签名",dataType = "String"),
@ApiImplicitParam(name = "sex", value = "要修改的性别:数值0为男,1为女",dataType = "int"),
})
@PutMapping("/{token}")
public QuarkResult updateUser(@PathVariable("token") String token,String username,String signature,Integer sex){
QuarkResult result = restProcessor(() -> {
if (!userService.checkUserName(username)) return QuarkResult.warn("用户名重复!");
if (sex != 0 && sex != 1) return QuarkResult.warn("性别输入错误!");
userService.updateUser(token, username, signature, sex);
return QuarkResult.ok();
});
return result;
}
示例14: getUserById
import io.swagger.annotations.ApiImplicitParams; //导入依赖的package包/类
@ApiOperation("根据用户ID获取用户详情与用户最近发布的十个帖子[主要用于用户主页展示]")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "用户的id", dataType = "int")
})
@GetMapping("/detail/{userid}")
public QuarkResult getUserById(@PathVariable("userid") Integer userid){
QuarkResult result = restProcessor(() -> {
User user = userService.findOne(userid);
if (user == null || userid == null) return QuarkResult.warn("用户不存在");
List<Posts> postss = postsService.getPostsByUser(user);
HashMap<String, Object> map = new HashMap<>();
map.put("posts",postss);
map.put("user",user);
return QuarkResult.ok(map);
});
return result;
}
示例15: CreateReply
import io.swagger.annotations.ApiImplicitParams; //导入依赖的package包/类
@ApiOperation("发布回复接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "content", value = "回复内容", dataType = "String"),
@ApiImplicitParam(name = "token", value = "用户令牌", dataType = "String"),
@ApiImplicitParam(name = "postsId", value = "帖子ID", dataType = "Integer")
})
@PostMapping
public QuarkResult CreateReply(Reply reply,Integer postsId,String token){
QuarkResult result = restProcessor(() -> {
if (token == null) return QuarkResult.warn("请先登录!");
User userbytoken = userService.getUserByToken(token);
if (userbytoken == null) return QuarkResult.warn("用户不存在,请先登录!");
User user = userService.findOne(userbytoken.getId());
if (user.getEnable() != 1) return QuarkResult.warn("用户处于封禁状态!");
replyService.saveReply(reply, postsId, user);
return QuarkResult.ok();
});
return result;
}