本文整理匯總了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;
}